From b1357e66fb457dc1e8ea3fa558b952f9a57e5396 Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 6 Mar 2015 07:18:57 +0000 Subject: [PATCH 01/59] Update basicBot.js --- basicBot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basicBot.js b/basicBot.js index dd1669cd..fdc02f5c 100644 --- a/basicBot.js +++ b/basicBot.js @@ -821,7 +821,7 @@ } }, eventDjadvance: function (obj) { - $("#woot").click(); + var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ if(basicBot.room.users[i].id === user.id){ @@ -1212,7 +1212,7 @@ basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); API.setVolume(basicBot.settings.startupVolume); - $("#woot").click(); + if (basicBot.settings.startupEmoji) { var emojibuttonoff = $(".icon-emoji-off"); if (emojibuttonoff.length > 0) { From 6839da1125eb11def20673fa8c95e383a2281d0d Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 3 Apr 2015 23:15:28 +0100 Subject: [PATCH 02/59] Update basicBot.js --- basicBot.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index fdc02f5c..a367bdc3 100644 --- a/basicBot.js +++ b/basicBot.js @@ -37,7 +37,7 @@ localStorage.setItem("basicBotStorageInfo", JSON.stringify(basicBotStorageInfo)); }; - + var subChat = function (chat, obj) { if (typeof chat === "undefined") { API.chatLog("There is a chat text missing."); @@ -2991,3 +2991,10 @@ loadChat(basicBot.startup); }).call(this); + + var waitlist = API.getWaitList() + if (waitlist.length > 0) { + API.sendChat ('@' + waitlist[1].username + ' You're up shortly!'') + } + else {console.log('The waitlist is empty, fools')} +}); From 41f450cffa53c8834ae9b90e42129f8e237431c3 Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 3 Apr 2015 23:18:16 +0100 Subject: [PATCH 03/59] Update basicBot.js --- basicBot.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/basicBot.js b/basicBot.js index a367bdc3..c480b5e1 100644 --- a/basicBot.js +++ b/basicBot.js @@ -37,7 +37,13 @@ localStorage.setItem("basicBotStorageInfo", JSON.stringify(basicBotStorageInfo)); }; - + var waitlist = API.getWaitList() + if (waitlist.length > 0) { + API.sendChat ('@' + waitlist[1].username + ' You're up shortly!'') + } + else {console.log('The waitlist is empty, fools')} + +}; var subChat = function (chat, obj) { if (typeof chat === "undefined") { API.chatLog("There is a chat text missing."); @@ -2992,9 +2998,4 @@ loadChat(basicBot.startup); }).call(this); - var waitlist = API.getWaitList() - if (waitlist.length > 0) { - API.sendChat ('@' + waitlist[1].username + ' You're up shortly!'') - } - else {console.log('The waitlist is empty, fools')} -}); + From 1a068d9c13d8311fc3c1fd19175aa6078db7e037 Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 3 Apr 2015 23:20:27 +0100 Subject: [PATCH 04/59] Update basicBot.js --- basicBot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/basicBot.js b/basicBot.js index c480b5e1..c962b4ff 100644 --- a/basicBot.js +++ b/basicBot.js @@ -37,6 +37,7 @@ localStorage.setItem("basicBotStorageInfo", JSON.stringify(basicBotStorageInfo)); }; + API.on(API.ADVANCE, function(){ var waitlist = API.getWaitList() if (waitlist.length > 0) { API.sendChat ('@' + waitlist[1].username + ' You're up shortly!'') From 407192e18ea6a53f8c9e3038dc0bb1e6e3e3e812 Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 3 Apr 2015 23:29:57 +0100 Subject: [PATCH 05/59] Update basicBot.js --- basicBot.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/basicBot.js b/basicBot.js index c962b4ff..dda4b2e2 100644 --- a/basicBot.js +++ b/basicBot.js @@ -43,8 +43,7 @@ API.sendChat ('@' + waitlist[1].username + ' You're up shortly!'') } else {console.log('The waitlist is empty, fools')} - -}; +}); var subChat = function (chat, obj) { if (typeof chat === "undefined") { API.chatLog("There is a chat text missing."); From 758473af4758617c48474a5eeb1657f905a28958 Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 3 Apr 2015 23:36:42 +0100 Subject: [PATCH 06/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index dda4b2e2..b2041f3a 100644 --- a/basicBot.js +++ b/basicBot.js @@ -40,7 +40,7 @@ API.on(API.ADVANCE, function(){ var waitlist = API.getWaitList() if (waitlist.length > 0) { - API.sendChat ('@' + waitlist[1].username + ' You're up shortly!'') + API.sendChat ('@' + waitlist[1].username + ' You\'re up shortly!'') } else {console.log('The waitlist is empty, fools')} }); From 855fb08556eade94ecf286bb25a5f0ffa7b15fac Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 3 Apr 2015 23:37:12 +0100 Subject: [PATCH 07/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index b2041f3a..541a26e2 100644 --- a/basicBot.js +++ b/basicBot.js @@ -40,7 +40,7 @@ API.on(API.ADVANCE, function(){ var waitlist = API.getWaitList() if (waitlist.length > 0) { - API.sendChat ('@' + waitlist[1].username + ' You\'re up shortly!'') + API.sendChat ('@' + waitlist[1].username + ' You\'re up shortly!') } else {console.log('The waitlist is empty, fools')} }); From a81f6ae20e3a90ca3dbd41f8724afd695dda0f9e Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 3 Apr 2015 23:40:59 +0100 Subject: [PATCH 08/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 541a26e2..af7fe211 100644 --- a/basicBot.js +++ b/basicBot.js @@ -40,7 +40,7 @@ API.on(API.ADVANCE, function(){ var waitlist = API.getWaitList() if (waitlist.length > 0) { - API.sendChat ('@' + waitlist[1].username + ' You\'re up shortly!') + API.sendChat ('/me @' + waitlist[1].username + ' You\'re up shortly!') } else {console.log('The waitlist is empty, fools')} }); From befb8419ff8e89a96abad1b35f1ddbc3117df4e5 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Thu, 23 Apr 2015 20:15:03 -0600 Subject: [PATCH 09/59] Update basicBot.js --- basicBot.js | 514 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 449 insertions(+), 65 deletions(-) diff --git a/basicBot.js b/basicBot.js index af7fe211..34bd2c42 100644 --- a/basicBot.js +++ b/basicBot.js @@ -37,13 +37,14 @@ localStorage.setItem("basicBotStorageInfo", JSON.stringify(basicBotStorageInfo)); }; - API.on(API.ADVANCE, function(){ + API.on(API.ADVANCE, function(){ var waitlist = API.getWaitList() - if (waitlist.length > 0) { + if (waitlist.length > 0) { API.sendChat ('/me @' + waitlist[1].username + ' You\'re up shortly!') } else {console.log('The waitlist is empty, fools')} }); + var subChat = function (chat, obj) { if (typeof chat === "undefined") { API.chatLog("There is a chat text missing."); @@ -126,8 +127,8 @@ API.chatLog(basicBot.chat.datarestored); } } - /*var json_sett = null; - var roominfo = document.getElementById("room-info"); + var json_sett = null; + var roominfo = document.getElementById("room-settings"); info = roominfo.textContent; var ref_bot = "@basicBot="; var ind_ref = info.indexOf(ref_bot); @@ -145,7 +146,7 @@ } } }); - }*/ + } }; @@ -182,10 +183,10 @@ var botCreator = "Matthew (Yemasthui)"; var botMaintainer = "Benzi (Quoona)" - var botCreatorIDs = ["3851534", "3934992", "4105209"]; + var botCreatorIDs = ["3851534", "4105209"]; var basicBot = { - version: "2.2.1", + version: "2.3.4", status: false, name: "basicBot", loggedInID: null, @@ -203,6 +204,7 @@ startupCap: 1, // 1-200 startupVolume: 0, // 0-100 startupEmoji: false, // true or false + cmdDeletion: true, maximumAfk: 120, afkRemoval: true, maximumDc: 60, @@ -215,6 +217,7 @@ maximumCycletime: 10, voteSkip: false, voteSkipLimit: 10, + historySkip: false, timeGuard: true, maximumSongLength: 10, autodisable: true, @@ -230,6 +233,41 @@ ["nsfw", "The song you contained was NSFW (image or sound). "], ["unavailable", "The song you played was not available for some users. "] ], + ball: [ + "Signs point to yes.", + "Yes.", + "Reply hazy, try again.", + "Without a doubt.", + "My sources say no.", + "As I see it, yes.", + "You may rely on it.", + "Concentrate and ask again.", + "Outlook not so good.", + "It is decidedly so.", + "Better not tell you now.", + "Very doubtful.", + "Yes - definitely.", + "It is certain.", + "Cannot predict now.", + "Most likely.", + "Ask again later.", + "My reply is no.", + "Outlook good.", + "Don't count on it.", + "Yes, in due time.", + "My sources say no.", + "Definitely not.", + "You will have to wait.", + "I have my doubts.", + "Outlook so so.", + "Looks good to me!", + "Who knows?", + "Looking good!", + "Probably.", + "Are you kidding?", + "Don't bet on it.", + "Forget about it." + ], afkpositionCheck: 15, afkRankCheck: "ambassador", motdEnabled: false, @@ -827,7 +865,8 @@ } }, eventDjadvance: function (obj) { - + + var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ if(basicBot.room.users[i].id === user.id){ @@ -866,7 +905,7 @@ } } - var alreadyPlayed = false; + /*var alreadyPlayed = false; for (var i = 0; i < basicBot.room.historyList.length; i++) { if (basicBot.room.historyList[i][0] === obj.media.cid) { var firstPlayed = basicBot.room.historyList[i][1]; @@ -879,6 +918,23 @@ } if (!alreadyPlayed) { basicBot.room.historyList.push([obj.media.cid, +new Date()]); + }*/ + + if (basicBot.settings.historySkip) { + var alreadyPlayed = false; + var apihistory = API.getHistory(); + var name = obj.dj.username; + for (var i = 0; i < apihistory.length; i++) { + if (apihistory[i].media.cid === obj.media.cid) { + API.sendChat(subChat(basicBot.chat.songknown, {name: name})); + API.moderateForceSkip(); + basicBot.room.historyList[i].push(+new Date()); + alreadyPlayed = true; + } + } + if (!alreadyPlayed) { + basicBot.room.historyList.push([obj.media.cid, +new Date()]); + } } var newMedia = obj.media; if (basicBot.settings.timeGuard && newMedia.duration > basicBot.settings.maximumSongLength * 60 && !basicBot.room.roomevent) { @@ -1080,7 +1136,9 @@ }, basicBot.settings.commandCooldown * 1000); } if (executed) { - API.moderateDeleteChat(chat.cid); + if (basicBot.settings.cmdDeletion) { + API.moderateDeleteChat(chat.cid); + } basicBot.room.allcommand = false; setTimeout(function () { basicBot.room.allcommand = true; @@ -1116,26 +1174,26 @@ eventUserskip: $.proxy(this.eventUserskip, this), eventUserjoin: $.proxy(this.eventUserjoin, this), eventUserleave: $.proxy(this.eventUserleave, this), - eventUserfan: $.proxy(this.eventUserfan, this), - eventFriendjoin: $.proxy(this.eventFriendjoin, this), - eventFanjoin: $.proxy(this.eventFanjoin, this), + //eventUserfan: $.proxy(this.eventUserfan, this), + //eventFriendjoin: $.proxy(this.eventFriendjoin, this), + //eventFanjoin: $.proxy(this.eventFanjoin, this), eventVoteupdate: $.proxy(this.eventVoteupdate, this), eventCurateupdate: $.proxy(this.eventCurateupdate, this), eventRoomscoreupdate: $.proxy(this.eventRoomscoreupdate, this), eventDjadvance: $.proxy(this.eventDjadvance, this), - eventDjupdate: $.proxy(this.eventDjupdate, this), + //eventDjupdate: $.proxy(this.eventDjupdate, this), eventWaitlistupdate: $.proxy(this.eventWaitlistupdate, this), eventVoteskip: $.proxy(this.eventVoteskip, this), eventModskip: $.proxy(this.eventModskip, this), eventChatcommand: $.proxy(this.eventChatcommand, this), - eventHistoryupdate: $.proxy(this.eventHistoryupdate, this) + eventHistoryupdate: $.proxy(this.eventHistoryupdate, this), }; API.on(API.CHAT, this.proxy.eventChat); API.on(API.USER_SKIP, this.proxy.eventUserskip); API.on(API.USER_JOIN, this.proxy.eventUserjoin); API.on(API.USER_LEAVE, this.proxy.eventUserleave); - API.on(API.USER_FAN, this.proxy.eventUserfan); + //API.on(API.USER_FAN, this.proxy.eventUserfan); API.on(API.VOTE_UPDATE, this.proxy.eventVoteupdate); API.on(API.GRAB_UPDATE, this.proxy.eventCurateupdate); API.on(API.ROOM_SCORE_UPDATE, this.proxy.eventRoomscoreupdate); @@ -1150,7 +1208,7 @@ API.off(API.USER_SKIP, this.proxy.eventUserskip); API.off(API.USER_JOIN, this.proxy.eventUserjoin); API.off(API.USER_LEAVE, this.proxy.eventUserleave); - API.off(API.USER_FAN, this.proxy.eventUserfan); + //API.off(API.USER_FAN, this.proxy.eventUserfan); API.off(API.VOTE_UPDATE, this.proxy.eventVoteupdate); API.off(API.CURATE_UPDATE, this.proxy.eventCurateupdate); API.off(API.ROOM_SCORE_UPDATE, this.proxy.eventRoomscoreupdate); @@ -1174,6 +1232,24 @@ type: "DELETE" }) }; + + var roomURL = window.location.pathname; + var Check; + + var detect = function(){ + if(roomURL != window.location.pathname){ + clearInterval(Check) + console.log("Killing bot after room change."); + storeToStorage(); + basicBot.disconnectAPI(); + setTimeout(function () { + kill(); + }, 1000); + } + }; + + Check = setInterval(function(){ detect() }, 100); + retrieveSettings(); retrieveFromStorage(); window.bot = basicBot; @@ -1500,6 +1576,25 @@ } }, + ballCommand: { + command: ['8ball', 'ask'], + rank: 'user', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var crowd = API.getUsers(); + var msg = chat.message; + var argument = msg.substring(cmd.length + 1); + var randomUser = Math.floor(Math.random() * crowd.length); + var randomBall = Math.floor(Math.random() * basicBot.settings.ball.length); + var randomSentence = Math.floor(Math.random() * 1); + API.sendChat(subChat(basicBot.chat.ball, {name: chat.un, botname: basicBot.settings.botName, question: argument, response: basicBot.settings.ball[randomBall]})); + } + } + }, + banCommand: { command: 'ban', rank: 'bouncer', @@ -1628,6 +1723,26 @@ } }, + cmddeletionCommand: { + command: ['commanddeletion', 'cmddeletion', 'cmddel'], + rank: 'mod', + type: 'exact', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + if (basicBot.settings.cmdDeletion) { + basicBot.settings.cmdDeletion = !basicBot.settings.cmdDeletion; + API.sendChat(subChat(basicBot.chat.toggleoff, {name: chat.un, 'function': basicBot.chat.cmddeletion})); + } + else { + basicBot.settings.cmdDeletion = !basicBot.settings.cmdDeletion; + API.sendChat(subChat(basicBot.chat.toggleon, {name: chat.un, 'function': basicBot.chat.cmddeletion})); + } + } + } + }, + cookieCommand: { command: 'cookie', rank: 'user', @@ -1739,49 +1854,6 @@ } }, - voteskipCommand: { - command: 'voteskip', - rank: 'manager', - type: 'startsWith', - functionality: function (chat, cmd) { - if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); - if (!basicBot.commands.executable(this.rank, chat)) return void (0); - else { - var msg = chat.message; - if (msg.length <= cmd.length + 1) return API.sendChat(subChat(basicBot.chat.voteskiplimit, {name: chat.un, limit: basicBot.settings.voteSkipLimit})); - var argument = msg.substring(cmd.length + 1); - if (!basicBot.settings.voteSkip) basicBot.settings.voteSkip = !basicBot.settings.voteSkip; - if (isNaN(argument)) { - API.sendChat(subChat(basicBot.chat.voteskipinvalidlimit, {name: chat.un})); - } - else { - basicBot.settings.voteSkipLimit = argument; - API.sendChat(subChat(basicBot.chat.voteskipsetlimit, {name: chat.un, limit: basicBot.settings.voteSkipLimit})); - } - } - } - }, - - togglevoteskipCommand: { - command: 'togglevoteskip', - rank: 'bouncer', - type: 'exact', - functionality: function (chat, cmd) { - if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); - if (!basicBot.commands.executable(this.rank, chat)) return void (0); - else { - if (basicBot.settings.voteSkip) { - basicBot.settings.voteSkip = !basicBot.settings.voteSkip; - API.sendChat(subChat(basicBot.chat.toggleoff, {name: chat.un, 'function': basicBot.chat.voteskip})); - } - else { - basicBot.settings.motdEnabled = !basicBot.settings.motdEnabled; - API.sendChat(subChat(basicBot.chat.toggleon, {name: chat.un, 'function': basicBot.chat.voteskip})); - } - } - } - }, - dclookupCommand: { command: ['dclookup', 'dc'], rank: 'user', @@ -1846,6 +1918,39 @@ } }, + englishCommand: { + command: 'english', + rank: 'bouncer', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + if(chat.message.length === cmd.length) return API.sendChat('/me No user specified.'); + var name = chat.message.substring(cmd.length + 2); + var user = basicBot.userUtilities.lookupUserName(name); + if(typeof user === 'boolean') return API.sendChat('/me Invalid user specified.'); + var lang = basicBot.userUtilities.getUser(user).language; + var ch = '/me @' + name + ' '; + switch(lang){ + case 'en': break; + case 'da': ch += 'Vær venlig at tale engelsk.'; break; + case 'de': ch += 'Bitte sprechen Sie Englisch.'; break; + case 'es': ch += 'Por favor, hable Inglés.'; break; + case 'fr': ch += 'Parlez anglais, s\'il vous plaît.'; break; + case 'nl': ch += 'Spreek Engels, alstublieft.'; break; + case 'pl': ch += 'Proszę mówić po angielsku.'; break; + case 'pt': ch += 'Por favor, fale Inglês.'; break; + case 'sk': ch += 'Hovorte po anglicky, prosím.'; break; + case 'cs': ch += 'Mluvte prosím anglicky.'; break; + case 'sr': ch += 'Молим Вас, говорите енглески.'; break; + } + ch += ' English please.'; + API.sendChat(ch); + } + } + }, + etaCommand: { command: 'eta', rank: 'user', @@ -1907,6 +2012,98 @@ } }, + ghostbusterCommand: { + command: 'ghostbuster', + rank: 'user', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var msg = chat.message; + var name; + if (msg.length === cmd.length) name = chat.un; + else { + name = msg.substr(cmd.length + 2); + } + var user = basicBot.userUtilities.lookupUserName(name); + if (user === false || !user.inRoom) { + return API.sendChat(subChat(basicBot.chat.ghosting, {name1: chat.un, name2: name})); + } + else API.sendChat(subChat(basicBot.chat.notghosting, {name1: chat.un, name2: name})); + } + } + }, + + gifCommand: { + command: ['gif', 'giphy'], + rank: 'mod', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var msg = chat.message; + if (msg.length !== cmd.length) { + function get_id(api_key, fixedtag, func) + { + $.getJSON( + "https://api.giphy.com/v1/gifs/random?", + { + "format": "json", + "api_key": api_key, + "rating": rating, + "tag": fixedtag + }, + function(response) + { + func(response.data.id); + } + ) + } + var api_key = "dc6zaTOxFJmzC"; // public beta key + var rating = "pg-13"; // PG 13 gifs + var tag = msg.substr(cmd.length + 1); + var fixedtag = tag.replace(/ /g,"+"); + var commatag = tag.replace(/ /g,", "); + get_id(api_key, tag, function(id) { + if (typeof id !== 'undefined') { + API.sendChat(subChat(basicBot.chat.validgiftags, {name: chat.un, id: id, tags: commatag})); + } else { + API.sendChat(subChat(basicBot.chat.invalidgiftags, {name: chat.un, tags: commatag})); + } + }); + } + else { + function get_random_id(api_key, func) + { + $.getJSON( + "https://api.giphy.com/v1/gifs/random?", + { + "format": "json", + "api_key": api_key, + "rating": rating + }, + function(response) + { + func(response.data.id); + } + ) + } + var api_key = "dc6zaTOxFJmzC"; // public beta key + var rating = "pg-13"; // PG 13 gifs + get_random_id(api_key, function(id) { + if (typeof id !== 'undefined') { + API.sendChat(subChat(basicBot.chat.validgifrandom, {name: chat.un, id: id})); + } else { + API.sendChat(subChat(basicBot.chat.invalidgifrandom, {name: chat.un})); + } + }); + } + } + } + }, + helpCommand: { command: 'help', rank: 'user', @@ -1915,12 +2112,32 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "http://i.imgur.com/SBAso1N.jpg"; + var link = "(Updated link coming soon)"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } }, + historyskipCommand: { + command: 'historyskip', + rank: 'bouncer', + type: 'exact', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + if (basicBot.settings.historySkip) { + basicBot.settings.historySkip = !basicBot.settings.historySkip; + API.sendChat(subChat(basicBot.chat.toggleoff, {name: chat.un, 'function': basicBot.chat.historyskip})); + } + else { + basicBot.settings.historySkip = !basicBot.settings.historySkip; + API.sendChat(subChat(basicBot.chat.toggleon, {name: chat.un, 'function': basicBot.chat.historyskip})); + } + } + } + }, + joinCommand: { command: 'join', rank: 'user', @@ -2109,7 +2326,7 @@ else { if (basicBot.settings.lockGuard) { basicBot.settings.lockGuard = !basicBot.settings.lockGuard; - return API.sendChat(subChat(basicBot.chat.toggleoff, {name: chat.un, 'function': basicBot.chat.lockdown})); + return API.sendChat(subChat(basicBot.chat.toggleoff, {name: chat.un, 'function': basicBot.chat.lockguard})); } else { basicBot.settings.lockGuard = !basicBot.settings.lockGuard; @@ -2226,6 +2443,22 @@ } }, + logoutCommand: { + command: 'logout', + rank: 'manager', + type: 'exact', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + API.sendChat(subChat(basicBot.chat.logout, {name: chat.un, botname: basicBot.settings.botName})); + setTimeout(function () { + $(".logout").mousedown() + }, 1000); + } + } + }, + maxlengthCommand: { command: 'maxlength', rank: 'manager', @@ -2419,6 +2652,19 @@ } }, + purchaseCommand: { + command: ['purchase'], + rank: 'user', + type: 'exact', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + API.sendChat(subChat(basicBot.chat.purchase, {name: chat.un})); + } + } + }, + refreshCommand: { command: 'refresh', rank: 'manager', @@ -2653,8 +2899,18 @@ else msg += 'OFF'; msg += '. '; + msg += basicBot.chat.historyskip + ': '; + if (basicBot.settings.historySkip) msg += 'ON'; + else msg += 'OFF'; + msg += '. '; + msg += basicBot.chat.voteskip + ': '; - if (basicBot.settings.voteskip) msg += 'ON'; + if (basicBot.settings.voteSkip) msg += 'ON'; + else msg += 'OFF'; + msg += '. '; + + msg += basicBot.chat.cmddeletion + ': '; + if (basicBot.settings.cmdDeletion) msg += 'ON'; else msg += 'OFF'; msg += '. '; @@ -2779,6 +3035,26 @@ } }, + togglevoteskipCommand: { + command: 'togglevoteskip', + rank: 'bouncer', + type: 'exact', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + if (basicBot.settings.voteSkip) { + basicBot.settings.voteSkip = !basicBot.settings.voteSkip; + API.sendChat(subChat(basicBot.chat.toggleoff, {name: chat.un, 'function': basicBot.chat.voteskip})); + } + else { + basicBot.settings.voteSkip = !basicBot.settings.voteSkip; + API.sendChat(subChat(basicBot.chat.toggleon, {name: chat.un, 'function': basicBot.chat.voteskip})); + } + } + } + }, + unbanCommand: { command: 'unban', rank: 'bouncer', @@ -2945,6 +3221,29 @@ } }, + voteskipCommand: { + command: 'voteskip', + rank: 'manager', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var msg = chat.message; + if (msg.length <= cmd.length + 1) return API.sendChat(subChat(basicBot.chat.voteskiplimit, {name: chat.un, limit: basicBot.settings.voteSkipLimit})); + var argument = msg.substring(cmd.length + 1); + if (!basicBot.settings.voteSkip) basicBot.settings.voteSkip = !basicBot.settings.voteSkip; + if (isNaN(argument)) { + API.sendChat(subChat(basicBot.chat.voteskipinvalidlimit, {name: chat.un})); + } + else { + basicBot.settings.voteSkipLimit = argument; + API.sendChat(subChat(basicBot.chat.voteskipsetlimit, {name: chat.un, limit: basicBot.settings.voteSkipLimit})); + } + } + } + }, + welcomeCommand: { command: 'welcome', rank: 'mod', @@ -2979,6 +3278,93 @@ } }, + whoisCommand: { + command: 'whois', + rank: 'bouncer', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var msg = chat.message; + var name; + if (msg.length === cmd.length) name = chat.un; + else { + name = msg.substr(cmd.length + 2); + } + users = API.getUsers(); + var len = users.length; + for (var i = 0; i < len; ++i){ + if (users[i].username == name){ + var id = users[i].id; + var avatar = API.getUser(id).avatarID; + var level = API.getUser(id).level; + var rawjoined = API.getUser(id).joined; + var joined = rawjoined.substr(0, 10); + var rawlang = API.getUser(id).language; + if (rawlang == "en"){ + var language = "English"; + } else if (rawlang == "bg"){ + var language = "Bulgarian"; + } else if (rawlang == "cs"){ + var language = "Czech"; + } else if (rawlang == "fi"){ + var language = "Finnish" + } else if (rawlang == "fr"){ + var language = "French" + } else if (rawlang == "pt"){ + var language = "Portuguese" + } else if (rawlang == "zh"){ + var language = "Chinese" + } else if (rawlang == "sk"){ + var language = "Slovak" + } else if (rawlang == "nl"){ + var language = "Dutch" + } else if (rawlang == "ms"){ + var language = "Malay" + } + var rawstatus = API.getUser(id).status; + if (rawstatus == "0"){ + var status = "Available"; + } else if (rawstatus == "1"){ + var status = "Away"; + } else if (rawstatus == "2"){ + var status = "Working"; + } else if (rawstatus == "3"){ + var status = "Gaming" + } + var rawrank = API.getUser(id).role; + if (rawrank == "0"){ + var rank = "User"; + } else if (rawrank == "1"){ + var rank = "Resident DJ"; + } else if (rawrank == "2"){ + var rank = "Bouncer"; + } else if (rawrank == "3"){ + var rank = "Manager" + } else if (rawrank == "4"){ + var rank = "Co-Host" + } else if (rawrank == "5"){ + var rank = "Host" + } else if (rawrank == "7"){ + var rank = "Brand Ambassador" + } else if (rawrank == "10"){ + var rank = "Admin" + } + var slug = API.getUser(id).slug; + if (typeof slug !== 'undefined') { + var profile = ", Profile: http://plug.dj/@/" + slug; + } else { + var profile = ""; + } + + API.sendChat(subChat(basicBot.chat.whois, {name1: chat.un, name2: name, id: id, avatar: avatar, profile: profile, language: language, level: level, status: status, joined: joined, rank: rank})); + } + } + } + } + }, + youtubeCommand: { command: 'youtube', rank: 'user', @@ -2997,5 +3383,3 @@ loadChat(basicBot.startup); }).call(this); - - From 84619e89545f3b55f4e531a64a996c9bbba97bd3 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Fri, 24 Apr 2015 16:57:11 -0600 Subject: [PATCH 10/59] Update basicBot.js Enabled the history list. --- basicBot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basicBot.js b/basicBot.js index 34bd2c42..daff7c7c 100644 --- a/basicBot.js +++ b/basicBot.js @@ -905,7 +905,7 @@ } } - /*var alreadyPlayed = false; + var alreadyPlayed = false; for (var i = 0; i < basicBot.room.historyList.length; i++) { if (basicBot.room.historyList[i][0] === obj.media.cid) { var firstPlayed = basicBot.room.historyList[i][1]; @@ -918,7 +918,7 @@ } if (!alreadyPlayed) { basicBot.room.historyList.push([obj.media.cid, +new Date()]); - }*/ + } if (basicBot.settings.historySkip) { var alreadyPlayed = false; From 82077ce18cde704366ec4b6a454e26b6de93e9d4 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Mon, 4 May 2015 19:21:23 -0600 Subject: [PATCH 11/59] Update en.json --- lang/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/en.json b/lang/en.json index eaf17396..ba00fdda 100644 --- a/lang/en.json +++ b/lang/en.json @@ -16,7 +16,7 @@ "isblacklisted": "/me This track is on the %%BLACKLIST%% blacklist! Skipping...", - "isopen": "/me The roulette is now open! Type !join to participate!", + "isopen": "/me The roulette is now open! If you are chosen, it will move you up or down in the waitlist. Type !join to participate!", "winnerpicked": "/me A winner has been picked! @%%NAME%% to position %%POSITION%%.", From 7d8850c914773dbbcd11023d57ef04fb99e14874 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Mon, 18 May 2015 22:21:10 -0600 Subject: [PATCH 12/59] Update basicBot.js --- basicBot.js | 233 +++++++++++++++++++++++++--------------------------- 1 file changed, 113 insertions(+), 120 deletions(-) diff --git a/basicBot.js b/basicBot.js index daff7c7c..e633431b 100644 --- a/basicBot.js +++ b/basicBot.js @@ -37,13 +37,14 @@ localStorage.setItem("basicBotStorageInfo", JSON.stringify(basicBotStorageInfo)); }; - API.on(API.ADVANCE, function(){ - var waitlist = API.getWaitList() - if (waitlist.length > 0) { - API.sendChat ('/me @' + waitlist[1].username + ' You\'re up shortly!') - } - else {console.log('The waitlist is empty, fools')} -}); + + API.on(API.ADVANCE, function(){ + var waitlist = API.getWaitList() + if (waitlist.length > 0) { + API.sendChat ('/me @' + waitlist[1].username + ' You\'re up shortly!') + } + else {console.log('The waitlist is empty, fools')} + }); var subChat = function (chat, obj) { if (typeof chat === "undefined") { @@ -186,7 +187,7 @@ var botCreatorIDs = ["3851534", "4105209"]; var basicBot = { - version: "2.3.4", + version: "2.4.5", status: false, name: "basicBot", loggedInID: null, @@ -233,41 +234,6 @@ ["nsfw", "The song you contained was NSFW (image or sound). "], ["unavailable", "The song you played was not available for some users. "] ], - ball: [ - "Signs point to yes.", - "Yes.", - "Reply hazy, try again.", - "Without a doubt.", - "My sources say no.", - "As I see it, yes.", - "You may rely on it.", - "Concentrate and ask again.", - "Outlook not so good.", - "It is decidedly so.", - "Better not tell you now.", - "Very doubtful.", - "Yes - definitely.", - "It is certain.", - "Cannot predict now.", - "Most likely.", - "Ask again later.", - "My reply is no.", - "Outlook good.", - "Don't count on it.", - "Yes, in due time.", - "My sources say no.", - "Definitely not.", - "You will have to wait.", - "I have my doubts.", - "Outlook so so.", - "Looks good to me!", - "Who knows?", - "Looking good!", - "Probably.", - "Are you kidding?", - "Don't bet on it.", - "Forget about it." - ], afkpositionCheck: 15, afkRankCheck: "ambassador", motdEnabled: false, @@ -865,7 +831,7 @@ } }, eventDjadvance: function (obj) { - + // $("#woot").click(); // autowoot var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ @@ -904,37 +870,24 @@ } } } - - var alreadyPlayed = false; - for (var i = 0; i < basicBot.room.historyList.length; i++) { - if (basicBot.room.historyList[i][0] === obj.media.cid) { - var firstPlayed = basicBot.room.historyList[i][1]; - var plays = basicBot.room.historyList[i].length - 1; - var lastPlayed = basicBot.room.historyList[i][plays]; - API.sendChat(subChat(basicBot.chat.songknown, {plays: plays, timetotal: basicBot.roomUtilities.msToStr(Date.now() - firstPlayed), lasttime: basicBot.roomUtilities.msToStr(Date.now() - lastPlayed)})); - basicBot.room.historyList[i].push(+new Date()); - alreadyPlayed = true; - } - } - if (!alreadyPlayed) { - basicBot.room.historyList.push([obj.media.cid, +new Date()]); - } - + clearTimeout(historySkip); if (basicBot.settings.historySkip) { var alreadyPlayed = false; var apihistory = API.getHistory(); var name = obj.dj.username; - for (var i = 0; i < apihistory.length; i++) { - if (apihistory[i].media.cid === obj.media.cid) { - API.sendChat(subChat(basicBot.chat.songknown, {name: name})); - API.moderateForceSkip(); - basicBot.room.historyList[i].push(+new Date()); - alreadyPlayed = true; + var historySkip = setTimeout(function () { + for (var i = 0; i < apihistory.length; i++) { + if (apihistory[i].media.cid === obj.media.cid) { + API.sendChat(subChat(basicBot.chat.songknown, {name: name})); + API.moderateForceSkip(); + basicBot.room.historyList[i].push(+new Date()); + alreadyPlayed = true; + } } - } - if (!alreadyPlayed) { - basicBot.room.historyList.push([obj.media.cid, +new Date()]); - } + if (!alreadyPlayed) { + basicBot.room.historyList.push([obj.media.cid, +new Date()]); + } + }, 2000); } var newMedia = obj.media; if (basicBot.settings.timeGuard && newMedia.duration > basicBot.settings.maximumSongLength * 60 && !basicBot.room.roomevent) { @@ -1174,9 +1127,7 @@ eventUserskip: $.proxy(this.eventUserskip, this), eventUserjoin: $.proxy(this.eventUserjoin, this), eventUserleave: $.proxy(this.eventUserleave, this), - //eventUserfan: $.proxy(this.eventUserfan, this), //eventFriendjoin: $.proxy(this.eventFriendjoin, this), - //eventFanjoin: $.proxy(this.eventFanjoin, this), eventVoteupdate: $.proxy(this.eventVoteupdate, this), eventCurateupdate: $.proxy(this.eventCurateupdate, this), eventRoomscoreupdate: $.proxy(this.eventRoomscoreupdate, this), @@ -1193,7 +1144,6 @@ API.on(API.USER_SKIP, this.proxy.eventUserskip); API.on(API.USER_JOIN, this.proxy.eventUserjoin); API.on(API.USER_LEAVE, this.proxy.eventUserleave); - //API.on(API.USER_FAN, this.proxy.eventUserfan); API.on(API.VOTE_UPDATE, this.proxy.eventVoteupdate); API.on(API.GRAB_UPDATE, this.proxy.eventCurateupdate); API.on(API.ROOM_SCORE_UPDATE, this.proxy.eventRoomscoreupdate); @@ -1208,7 +1158,6 @@ API.off(API.USER_SKIP, this.proxy.eventUserskip); API.off(API.USER_JOIN, this.proxy.eventUserjoin); API.off(API.USER_LEAVE, this.proxy.eventUserleave); - //API.off(API.USER_FAN, this.proxy.eventUserfan); API.off(API.VOTE_UPDATE, this.proxy.eventVoteupdate); API.off(API.CURATE_UPDATE, this.proxy.eventCurateupdate); API.off(API.ROOM_SCORE_UPDATE, this.proxy.eventRoomscoreupdate); @@ -1294,7 +1243,7 @@ basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); API.setVolume(basicBot.settings.startupVolume); - + // $("#woot").click(); if (basicBot.settings.startupEmoji) { var emojibuttonoff = $(".icon-emoji-off"); if (emojibuttonoff.length > 0) { @@ -1503,7 +1452,15 @@ var lastActive = basicBot.userUtilities.getLastActivity(user); var inactivity = Date.now() - lastActive; var time = basicBot.roomUtilities.msToStr(inactivity); + + var launchT = basicBot.room.roomstats.launchTime; + var durationOnline = Date.now() - launchT; + + if (inactivity == durationOnline){ + API.sendChat(subChat(basicBot.chat.inactivelonger, {botname: basicBot.settings.botName, name: chat.un, username: name})); + } else { API.sendChat(subChat(basicBot.chat.inactivefor, {name: chat.un, username: name, time: time})); + } } } }, @@ -1588,9 +1545,9 @@ var msg = chat.message; var argument = msg.substring(cmd.length + 1); var randomUser = Math.floor(Math.random() * crowd.length); - var randomBall = Math.floor(Math.random() * basicBot.settings.ball.length); + var randomBall = Math.floor(Math.random() * basicBot.chat.balls.length); var randomSentence = Math.floor(Math.random() * 1); - API.sendChat(subChat(basicBot.chat.ball, {name: chat.un, botname: basicBot.settings.botName, question: argument, response: basicBot.settings.ball[randomBall]})); + API.sendChat(subChat(basicBot.chat.ball, {name: chat.un, botname: basicBot.settings.botName, question: argument, response: basicBot.chat.balls[randomBall]})); } } }, @@ -1693,6 +1650,25 @@ } }, + botnameCommand: { + command: 'botname', + rank: 'manager', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var msg = chat.message; + if (msg.length <= cmd.length + 1) return API.sendChat(subChat(basicBot.chat.currentbotname, {botname: basicBot.settings.botName})); + var argument = msg.substring(cmd.length + 1); + if (argument) { + basicBot.settings.botName = argument; + API.sendChat(subChat(basicBot.chat.botnameset, {botName: basicBot.settings.botName})); + } + } + } + }, + clearchatCommand: { command: 'clearchat', rank: 'manager', @@ -1747,30 +1723,9 @@ command: 'cookie', rank: 'user', type: 'startsWith', - cookies: ['has given you a chocolate chip cookie!', - 'has given you a soft homemade oatmeal cookie!', - 'has given you a plain, dry, old cookie. It was the last one in the bag. Gross.', - 'gives you a sugar cookie. What, no frosting and sprinkles? 0/10 would not touch.', - 'gives you a chocolate chip cookie. Oh wait, those are raisins. Bleck!', - 'gives you an enormous cookie. Poking it gives you more cookies. Weird.', - 'gives you a fortune cookie. It reads "Why aren\'t you working on any projects?"', - 'gives you a fortune cookie. It reads "Give that special someone a compliment"', - 'gives you a fortune cookie. It reads "Take a risk!"', - 'gives you a fortune cookie. It reads "Go outside."', - 'gives you a fortune cookie. It reads "Don\'t forget to eat your veggies!"', - 'gives you a fortune cookie. It reads "Do you even lift?"', - 'gives you a fortune cookie. It reads "m808 pls"', - 'gives you a fortune cookie. It reads "If you move your hips, you\'ll get all the ladies."', - 'gives you a fortune cookie. It reads "I love you."', - 'gives you a Golden Cookie. You can\'t eat it because it is made of gold. Dammit.', - 'gives you an Oreo cookie with a glass of milk!', - 'gives you a rainbow cookie made with love :heart:', - 'gives you an old cookie that was left out in the rain, it\'s moldy.', - 'bakes you fresh cookies, it smells amazing.' - ], - getCookie: function () { - var c = Math.floor(Math.random() * this.cookies.length); - return this.cookies[c]; + getCookie: function (chat) { + var c = Math.floor(Math.random() * basicBot.chat.cookies.length); + return basicBot.chat.cookies[c]; }, functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -1892,11 +1847,29 @@ var user = basicBot.userUtilities.lookupUserName(name); if (typeof user === 'boolean') return API.sendChat(subChat(basicBot.chat.invaliduserspecified, {name: chat.un})); var chats = $('.from'); + var message = $('.message'); + var emote = $('.emote'); + var from = $('.un.clickable'); for (var i = 0; i < chats.length; i++) { - var n = chats[i].textContent; + var n = from[i].textContent; if (name.trim() === n.trim()) { - var cid = $(chats[i]).parent()[0].getAttribute('data-cid'); - API.moderateDeleteChat(cid); + + // var messagecid = $(message)[i].getAttribute('data-cid'); + // var emotecid = $(emote)[i].getAttribute('data-cid'); + // API.moderateDeleteChat(messagecid); + + // try { + // API.moderateDeleteChat(messagecid); + // } + // finally { + // API.moderateDeleteChat(emotecid); + // } + + if (typeof $(message)[i].getAttribute('data-cid') == "undefined"){ + API.moderateDeleteChat($(emote)[i].getAttribute('data-cid')); // works well with normal messages but not with emotes due to emotes and messages are seperate. + } else { + API.moderateDeleteChat($(message)[i].getAttribute('data-cid')); + } } } API.sendChat(subChat(basicBot.chat.deletechat, {name: chat.un, username: name})); @@ -2048,7 +2021,7 @@ function get_id(api_key, fixedtag, func) { $.getJSON( - "https://api.giphy.com/v1/gifs/random?", + "https://tv.giphy.com/v1/gifs/random?", { "format": "json", "api_key": api_key, @@ -2078,7 +2051,7 @@ function get_random_id(api_key, func) { $.getJSON( - "https://api.giphy.com/v1/gifs/random?", + "https://tv.giphy.com/v1/gifs/random?", { "format": "json", "api_key": api_key, @@ -2238,6 +2211,34 @@ } }, + languageCommand: { + command: 'language', + rank: 'manager', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var msg = chat.message; + if (msg.length <= cmd.length + 1) return API.sendChat(subChat(basicBot.chat.currentlang, {language: basicBot.settings.language})); + var argument = msg.substring(cmd.length + 1); + + $.get("https://rawgit.com/Yemasthui/basicBot/master/lang/langIndex.json", function (json) { + var langIndex = json; + var link = langIndex[argument.toLowerCase()]; + if (typeof link === "undefined") { + API.sendChat(subChat(basicBot.chat.langerror, {link: "http://git.io/vJ9nI"})); + } + else { + basicBot.settings.language = argument; + loadChat(); + API.sendChat(subChat(basicBot.chat.langset, {language: basicBot.settings.language})); + } + }); + } + } + }, + leaveCommand: { command: 'leave', rank: 'user', @@ -2272,7 +2273,7 @@ if (dj === chat.uid) isDj = true; if (perm >= 1 || isDj) { if (media.format === 1) { - var linkToSong = "https://www.youtube.com/watch?v=" + media.cid; + var linkToSong = "http://youtu.be/" + media.cid; API.sendChat(subChat(basicBot.chat.songlink, {name: from, link: linkToSong})); } if (media.format === 2) { @@ -2652,19 +2653,6 @@ } }, - purchaseCommand: { - command: ['purchase'], - rank: 'user', - type: 'exact', - functionality: function (chat, cmd) { - if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); - if (!basicBot.commands.executable(this.rank, chat)) return void (0); - else { - API.sendChat(subChat(basicBot.chat.purchase, {name: chat.un})); - } - } - }, - refreshCommand: { command: 'refresh', rank: 'manager', @@ -2914,6 +2902,11 @@ else msg += 'OFF'; msg += '. '; + msg += basicBot.chat.autoskip + ': '; + if (basicBot.room.autoskip) msg += 'ON'; + else msg += 'OFF'; + msg += '. '; + var launchT = basicBot.room.roomstats.launchTime; var durationOnline = Date.now() - launchT; var since = basicBot.roomUtilities.msToStr(durationOnline); From f90e034d92d6618741cd6062808cea479eec3128 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Mon, 18 May 2015 22:23:15 -0600 Subject: [PATCH 13/59] Update en.json --- lang/en.json | 295 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 177 insertions(+), 118 deletions(-) diff --git a/lang/en.json b/lang/en.json index ba00fdda..1ca9890d 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,70 +1,125 @@ { - + "cookies": [ + "has given you a chocolate chip cookie!", + "has given you a soft homemade oatmeal cookie!", + "has given you a plain, dry, old cookie. It was the last one in the bag. Gross.", + "gives you a sugar cookie. What, no frosting and sprinkles? 0\/10 would not touch.", + "gives you a chocolate chip cookie. Oh wait, those are raisins. Bleck!", + "gives you an enormous cookie. Poking it gives you more cookies. Weird.", + "gives you a fortune cookie. It reads \"Why aren't you working on any projects?\"", + "gives you a fortune cookie. It reads \"Give that special someone a compliment\"", + "gives you a fortune cookie. It reads \"Take a risk!\"", + "gives you a fortune cookie. It reads \"Go outside.\"", + "gives you a fortune cookie. It reads \"Don't forget to eat your veggies!\"", + "gives you a fortune cookie. It reads \"Do you even lift?\"", + "gives you a fortune cookie. It reads \"m808 pls\"", + "gives you a fortune cookie. It reads \"If you move your hips, you'll get all the ladies.\"", + "gives you a fortune cookie. It reads \"I love you.\"", + "gives you a Golden Cookie. You can't eat it because it is made of gold. Dammit.", + "gives you an Oreo cookie with a glass of milk!", + "gives you a rainbow cookie made with love :heart:", + "gives you an old cookie that was left out in the rain, it's moldy.", + "bakes you fresh cookies, it smells amazing." + ], + "balls": [ + "Signs point to yes.", + "Yes.", + "Reply hazy, try again.", + "Without a doubt.", + "My sources say no.", + "As I see it, yes.", + "You may rely on it.", + "Concentrate and ask again.", + "Outlook not so good.", + "It is decidedly so.", + "Better not tell you now.", + "Very doubtful.", + "Yes - definitely.", + "It is certain.", + "Cannot predict now.", + "Most likely.", + "Ask again later.", + "My reply is no.", + "Outlook good.", + "Don't count on it.", + "Yes, in due time.", + "My sources say no.", + "Definitely not.", + "You will have to wait.", + "I have my doubts.", + "Outlook so so.", + "Looks good to me!", + "Who knows?", + "Looking good!", + "Probably.", + "Are you kidding?", + "Don't bet on it.", + "Forget about it." + ], "nodatafound": "No previous data found.", + "currentlang": "\/me Language currently set to: %%LANGUAGE%%", + "langerror": "\/me The language you've selected isn't available. Please visit %%LINK%% to find a list of languages available.", + "langset": "\/me Language now set to: %%LANGUAGE%%", "retrievingdata": "Retrieving previously stored data.", "datarestored": "Previously stored data successfully retrieved.", "greyuser": "Only bouncers and up can run a bot.", "bouncer": "The bot can't move people when it's run as a bouncer.", - "online": "/me %%BOTNAME%% v%%VERSION%% online!", - - - "welcome": "/me Welcome %%NAME%%", - "welcomeback": "/me Welcome back, %%NAME%%", - "songknown": "/me :repeat: This song has been played %%PLAYS%% time(s) in the last %%TIMETOTAL%%, last play was %%LASTTIME%% ago. :repeat:", - "timelimit": "/me @%%NAME%%, your song is longer than %%MAXLENGTH%% minutes, you need permission to play longer songs.", - "permissionownsong": "/me :up: @%%NAME%% has permission to play their own production!", - "isblacklisted": "/me This track is on the %%BLACKLIST%% blacklist! Skipping...", - - - "isopen": "/me The roulette is now open! If you are chosen, it will move you up or down in the waitlist. Type !join to participate!", - "winnerpicked": "/me A winner has been picked! @%%NAME%% to position %%POSITION%%.", - - - "alreadyadding": "/me User is already being added! Changed the desired position to %%POSITION%%.", - "adding": "/me Added @%%NAME%% to the queue. Current queue: %%POSITION%%.", - - - "usernotfound": "/me User not found.", - "notdisconnected": "/me @%%NAME%% did not disconnect during my time here.", - "noposition": "/me No last position known. The waitlist needs to update at least once to register a user's last position.", - "toolongago": "/me @%%NAME%%'s last disconnect (DC or leave) was too long ago: %%TIME%%.", - "valid": "/me @%%NAME%% disconnected %%TIME%% ago and should be at position %%POSITION%%.", - - - "warning1": "/me @%%NAME%%, you have been afk for %%TIME%%, please respond within 2 minutes or you will be removed.", - "warning2": "/me @%%NAME%%, you will be removed due to AFK soon if you don't respond.", - "afkremove": "/me @%%NAME%%, you have been removed for being afk for %%TIME%%. You were at position %%POSITION%%. Chat at least once every %%MAXIMUMAFK%% minutes if you want to play a song.", - - - "caps": "/me @%%NAME%%, unglue your capslock button please.", - "askskip": "/me @%%NAME%%, don't ask for skips.", - "spam": "/me @%%NAME%%, please don't spam.", - "roomadvertising": "/me @%%NAME%%, don't post links to other rooms please.", - "adfly": "/me @%%NAME%%, please change your autowoot program. We suggest PlugCubed: http://plugcubed.net/", - - - "invalidtime": "/me [@%%NAME%%] Invalid time specified.", - "nouserspecified": "/me [@%%NAME%%] No user specified.", - "invaliduserspecified": "/me [@%%NAME%%] Invalid user specified.", - "nolistspecified": "/me [@%%NAME%%] No list specified.", - "invalidlistspecified": "/me [@%%NAME%%] Invalid list specified.", - "novaliduserspecified": "/me [@%%NAME%%] No valid user specified.", - "nolimitspecified": "/me [@%%NAME%%] No limit specified.", - "invalidlimitspecified": "/me [@%%NAME%%] Invalid limit.", - "invalidpositionspecified": "/me [@%%NAME%%] Invalid position specified.", - "toggleon": "/me [@%%NAME%%] %%FUNCTION%% enabled.", - "toggleoff": "/me [@%%NAME%%] %%FUNCTION%% disabled.", + "online": "\/me %%BOTNAME%% v%%VERSION%% online!", + "welcome": "\/me Welcome %%NAME%%", + "welcomeback": "\/me Welcome back, %%NAME%%", + "songknown": "\/me @%%NAME%%, this song is in the DJ history.", + "timelimit": "\/me @%%NAME%%, your song is longer than %%MAXLENGTH%% minutes, you need permission to play longer songs.", + "permissionownsong": "\/me :up: @%%NAME%% has permission to play their own production!", + "isblacklisted": "\/me This track is on the %%BLACKLIST%% blacklist! Skipping...", + "isopen": "\/me The roulette is now open! Type !join to participate!", + "winnerpicked": "\/me A winner has been picked! @%%NAME%% to position %%POSITION%%.", + "ball": "\/me %%NAME%%'s question was: \"%%QUESTION%%\" and %%BOTNAME%%'s response is: \"%%RESPONSE%%\"", + "notghosting": "[%%NAME1%%] %%NAME2%% is not ghosting.", + "ghosting": "[%%NAME1%%] %%NAME2%% is either ghosting or not here.", + "alreadyadding": "\/me User is already being added! Changed the desired position to %%POSITION%%.", + "adding": "\/me Added @%%NAME%% to the queue. Current queue: %%POSITION%%.", + "usernotfound": "\/me User not found.", + "notdisconnected": "\/me @%%NAME%% did not disconnect during my time here.", + "noposition": "\/me No last position known. The waitlist needs to update at least once to register a user's last position.", + "toolongago": "\/me @%%NAME%%'s last disconnect (DC or leave) was too long ago: %%TIME%%.", + "valid": "\/me @%%NAME%% disconnected %%TIME%% ago and should be at position %%POSITION%%.", + "warning1": "\/me @%%NAME%%, you have been afk for %%TIME%%, please respond within 2 minutes or you will be removed.", + "warning2": "\/me @%%NAME%%, you will be removed due to AFK soon if you don't respond.", + "afkremove": "\/me @%%NAME%%, you have been removed for being afk for %%TIME%%. You were at position %%POSITION%%. Chat at least once every %%MAXIMUMAFK%% minutes if you want to play a song.", + "caps": "\/me @%%NAME%%, unglue your capslock button please.", + "askskip": "\/me @%%NAME%%, don't ask for skips.", + "spam": "\/me @%%NAME%%, please don't spam.", + "roomadvertising": "\/me @%%NAME%%, don't post links to other rooms please.", + "adfly": "\/me @%%NAME%%, please change your autowoot program. We suggest PlugCubed: http:\/\/plugcubed.net\/", + "validgiftags": "\/me [@%%NAME%%] http:\/\/media.giphy.com\/media\/%%ID%%\/giphy.gif [Tags: %%TAGS%%]", + "invalidgiftags": "\/me [@%%NAME%%] Invalid tags, try something different. [Tags: %%TAGS%%]", + "validgifrandom": "\/me [@%%NAME%%] http:\/\/media.giphy.com\/media\/%%ID%%\/giphy.gif [Random GIF]", + "invalidgifrandom": "\/me [@%%NAME%%] Invalid request, try again.", + "invalidtime": "\/me [@%%NAME%%] Invalid time specified.", + "nouserspecified": "\/me [@%%NAME%%] No user specified.", + "invaliduserspecified": "\/me [@%%NAME%%] Invalid user specified.", + "nolistspecified": "\/me [@%%NAME%%] No list specified.", + "invalidlistspecified": "\/me [@%%NAME%%] Invalid list specified.", + "novaliduserspecified": "\/me [@%%NAME%%] No valid user specified.", + "nolimitspecified": "\/me [@%%NAME%%] No limit specified.", + "invalidlimitspecified": "\/me [@%%NAME%%] Invalid limit.", + "invalidpositionspecified": "\/me [@%%NAME%%] Invalid position specified.", + "whois": "\/me [%%NAME1%%] Username: %%NAME2%%, ID: %%ID%%, Rank: %%RANK%%, Joined: %%JOINED%%, Level: %%LEVEL%%, Language: %%LANGUAGE%%, Avatar: %%AVATAR%%, Status: %%STATUS%%%%PROFILE%%", + "toggleon": "\/me [@%%NAME%%] %%FUNCTION%% enabled.", + "toggleoff": "\/me [@%%NAME%%] %%FUNCTION%% disabled.", + "cmddeletion": "command deletion", "afkremoval": "AFK removal", "afksremoved": "AFK's removed", "afklimit": "AFK limit", "autodisable": "autodisable", "autoskip": "autoskip", - "newblacklisted": "/me [@%%NAME%%] This track belongs on the %%BLACKLIST%% blacklist! [ %%AUTHOR%% - %%TITLE%% - %%MID%% ]", + "newblacklisted": "\/me [@%%NAME%%] This track belongs on the %%BLACKLIST%% blacklist! [ %%AUTHOR%% - %%TITLE%% - %%MID%% ]", "blinfo": "[@%%NAME%%] Blacklist Info - author: %%AUTHOR%%, title: %%TITLE%%, mid: %%SONGID%%", "blacklist": "blacklist", "cycleguard": "cycleguard", "timeguard": "timeguard", "chatfilter": "chatfilter", + "historyskip": "historyskip", "lockdown": "lockdown", "lockguard": "lockguard", "usercommands": "usercommands", @@ -73,72 +128,76 @@ "songstats": "song statistics", "etarestriction": "eta restriction", "voteskip": "voteskip", - "voteskiplimit": "/me [@%%NAME%%] Voteskip limit is currently set to %%LIMIT%% mehs.", - "voteskipexceededlimit": "/me @%%NAME%%, your song has exceeded the voteskip limit (%%LIMIT%% mehs).", - "voteskipinvalidlimit": "/me [@%%NAME%%] Invalid voteskip limit, please try again using a number to signify the number of mehs.", - "voteskipsetlimit": "/me [@%%NAME%%] Voteskip limit set to %%LIMIT%%.", - "activeusersintime": "/me [@%%NAME%% There have been %%AMOUNT%% users chatting in the past %%TIME%% minutes.", - "maximumafktimeset": "/me [@%%NAME%%] Maximum afk duration set to %%TIME%% minutes.", - "afkstatusreset": "/me [@%%NAME%%] Reset the afk status of @%%USERNAME%%.", - "inactivefor": "/me [@%%NAME%%] @%%USERNAME%% has been inactive for %%TIME%%.", - "autowoot": "/me We recommend PlugCubed for autowooting: http://plugcubed.net/", - "brandambassador": "/me A Brand Ambassador is the voice of the plug.dj users. They promote events, engage the community and share the plug.dj message around the world. For more info: https://plug.dj/ba", - "bouncerplusrank": "/me [@%%NAME%%] You have to be manager or up to enable Bouncer+.", - "chatcleared": "/me [@%%NAME%%] Cleared the chat.", - "deletechat": "/me [@%%NAME%%] Cleared the chat of %%USERNAME%%.", - "commandslink": "/me %%BOTNAME%% commands: %%LINK%%", - "eatcookie": "/me eats a cookie.", - "nousercookie": "/em doesn't see %%NAME%% in room and eats a cookie himself.", - "selfcookie": "/me @%%NAME%%, you're a bit greedy, aren't you? Giving cookies to yourself, bah. Share some with other people!", - "cookie": "/me @%%NAMETO%%, @%%NAMEFROM%% %%COOKIE%%", - "cycleguardtime": "/me [@%%NAME%%] The cycleguard is set to %%TIME%% minute(s).", - "dclookuprank": "/me [@%%NAME%%] Only bouncers and above can do a lookup for others.", - "emojilist": "/me Emoji list: %%LINK%%", - "notinwaitlist": "/me @%%NAME%%, you are not on the waitlist.", - "eta": "/me @%%NAME%% you will reach the booth in approximately %%TIME%%.", - "facebook": "/me Like us on facebook: %%LINK%%", - "starterhelp": "/me This image will get you started on plug: %%LINK%%", - "roulettejoin": "/me @%%NAME%% joined the roulette! (!leave if you regret it.)", - "jointime": "/me [@%%NAMEFROM%%] @%%USERNAME%% has been in the room for %%TIME%%.", - "kickrank": "/me [@%%NAME%%] you can't kick users with an equal or higher rank than you!", - "kick": "/me [@%%NAME%%], @%%USERNAME%% you are being kicked from the community for %%TIME%% minutes.", - "kill": "/me Shutting down.", - "rouletteleave": "/me @%%NAME%% left the roulette!", - "songlink": "/me [@%%NAME%%] Link to current song: %%LINK%%", - "usedlockskip": "/me [%%NAME%% used lockskip.]", - "lockskippos": "/me [@%%NAME%%] Lockskip will now move the dj to position %%POSITION%%.", - "lockguardtime": "/me [@%%NAME%%] The lockguard is set to %%TIME%% minute(s).", - "maxlengthtime": "/me [@%%NAME%%] The maximum song duration is set to %%TIME%% minutes.", - "motdset": "/me MotD set to: %%MSG%%", - "motdintervalset": "/me MotD interval set to %%INTERVAL%%.", - "addbotwaitlist": "/me @%%NAME%%, don't try to add me to the waitlist, please.", - "move": "/me [%%NAME%% used move.]", - "mutednotime": "/me [@%%NAME%%] Muted @%%USERNAME%%.", - "mutedmaxtime": "/me [@%%NAME%%] You can only mute for maximum %%TIME%% minutes.", - "mutedtime": "/me [@%%NAME%%] Muted @%%USERNAME%% for %%TIME%% minutes.", - "unmuted": "/me [@%%NAME%%] Unmuted @%%USERNAME%%.", - "muterank": "/me [@%%NAME%%] You can't mute persons with an equal or higher rank than you.", - "oplist": "/me OP list: %%LINK%%", - "pong": "/me Pong!", - "reload": "/me Be right back.", - "removenotinwl": "/me [@%%NAME%%] Specified user @%%USERNAME%% is not in the waitlist.", - "roomrules": "/me Please find the room rules here: %%LINK%%", - "sessionstats": "/me [@%%NAME%%] Total woots: %%WOOTS%%, total mehs: %%MEHS%%, total grabs: %%GRABS%%.", - "skip": "/me [%%NAME%% used skip.]", - "madeby": "/me This bot was made by %%NAME%%.", + "voteskiplimit": "\/me [@%%NAME%%] Voteskip limit is currently set to %%LIMIT%% mehs.", + "voteskipexceededlimit": "\/me @%%NAME%%, your song has exceeded the voteskip limit (%%LIMIT%% mehs).", + "voteskipinvalidlimit": "\/me [@%%NAME%%] Invalid voteskip limit, please try again using a number to signify the number of mehs.", + "voteskipsetlimit": "\/me [@%%NAME%%] Voteskip limit set to %%LIMIT%%.", + "activeusersintime": "\/me [@%%NAME%% There have been %%AMOUNT%% users chatting in the past %%TIME%% minutes.", + "maximumafktimeset": "\/me [@%%NAME%%] Maximum afk duration set to %%TIME%% minutes.", + "afkstatusreset": "\/me [@%%NAME%%] Reset the afk status of @%%USERNAME%%.", + "inactivefor": "\/me [@%%NAME%%] @%%USERNAME%% has been inactive for %%TIME%%.", + "inactivelonger": "\/me [@%%NAME%%] @%%USERNAME%% has been inactive longer than %%BOTNAME%%'s been online.", + "autowoot": "\/me We recommend PlugCubed for autowooting: http:\/\/plugcubed.net\/", + "brandambassador": "\/me A Brand Ambassador is the voice of the plug.dj users. They promote events, engage the community and share the plug.dj message around the world. For more info: https:\/\/plug.dj\/ba", + "bouncerplusrank": "\/me [@%%NAME%%] You have to be manager or up to enable Bouncer+.", + "chatcleared": "\/me [@%%NAME%%] Cleared the chat.", + "deletechat": "\/me [@%%NAME%%] Cleared the chat of %%USERNAME%%.", + "commandslink": "\/me %%BOTNAME%% commands: %%LINK%%", + "eatcookie": "\/me eats a cookie.", + "nousercookie": "\/em doesn't see %%NAME%% in room and eats a cookie himself.", + "selfcookie": "\/me @%%NAME%%, you're a bit greedy, aren't you? Giving cookies to yourself, bah. Share some with other people!", + "cookie": "\/me @%%NAMETO%%, %%NAMEFROM%% %%COOKIE%%", + "cycleguardtime": "\/me [@%%NAME%%] The cycleguard is set to %%TIME%% minute(s).", + "dclookuprank": "\/me [@%%NAME%%] Only bouncers and above can do a lookup for others.", + "emojilist": "\/me Emoji list: %%LINK%%", + "notinwaitlist": "\/me @%%NAME%%, you are not on the waitlist.", + "eta": "\/me @%%NAME%% you will reach the booth in approximately %%TIME%%.", + "facebook": "\/me Like us on facebook: %%LINK%%", + "starterhelp": "\/me This image will get you started on plug: %%LINK%%", + "roulettejoin": "\/me @%%NAME%% joined the roulette! (!leave if you regret it.)", + "jointime": "\/me [@%%NAMEFROM%%] @%%USERNAME%% has been in the room for %%TIME%%.", + "kickrank": "\/me [@%%NAME%%] you can't kick users with an equal or higher rank than you!", + "kick": "\/me [@%%NAME%%], @%%USERNAME%% you are being kicked from the community for %%TIME%% minutes.", + "kill": "\/me Shutting down.", + "logout": "\/me [@%%NAME%%] Logging out %%BOTNAME%%", + "rouletteleave": "\/me @%%NAME%% left the roulette!", + "songlink": "\/me [@%%NAME%%] Link to current song: %%LINK%%", + "usedlockskip": "\/me [%%NAME%% used lockskip.]", + "lockskippos": "\/me [@%%NAME%%] Lockskip will now move the dj to position %%POSITION%%.", + "lockguardtime": "\/me [@%%NAME%%] The lockguard is set to %%TIME%% minute(s).", + "maxlengthtime": "\/me [@%%NAME%%] The maximum song duration is set to %%TIME%% minutes.", + "motdset": "\/me MotD set to: %%MSG%%", + "motdintervalset": "\/me MotD interval set to %%INTERVAL%%.", + "currentbotname": "\/me Bot name currently set to: %%BOTNAME%%", + "botnameset": "\/me Bot name now set to: %%BOTNAME%%", + "addbotwaitlist": "\/me @%%NAME%%, don't try to add me to the waitlist, please.", + "move": "\/me [%%NAME%% used move.]", + "mutednotime": "\/me [@%%NAME%%] Muted @%%USERNAME%%.", + "mutedmaxtime": "\/me [@%%NAME%%] You can only mute for maximum %%TIME%% minutes.", + "mutedtime": "\/me [@%%NAME%%] Muted @%%USERNAME%% for %%TIME%% minutes.", + "unmuted": "\/me [@%%NAME%%] Unmuted @%%USERNAME%%.", + "muterank": "\/me [@%%NAME%%] You can't mute persons with an equal or higher rank than you.", + "oplist": "\/me OP list: %%LINK%%", + "pong": "\/me Pong!", + "reload": "\/me Be right back.", + "removenotinwl": "\/me [@%%NAME%%] Specified user @%%USERNAME%% is not in the waitlist.", + "roomrules": "\/me Please find the room rules here: %%LINK%%", + "sessionstats": "\/me [@%%NAME%%] Total woots: %%WOOTS%%, total mehs: %%MEHS%%, total grabs: %%GRABS%%.", + "skip": "\/me [%%NAME%% used skip.]", + "madeby": "\/me This bot was made by %%NAME%%.", "activefor": "I have been active for %%TIME%%.", - "swapinvalid": "/me [@%%NAME%%] Invalid user specified. (No names with spaces!)", - "swapwlonly": "/me [@%%NAME%%] Please only swap users that are in the waitlist!", - "swapping": "/me Swapping %%NAME1%% with %%NAME2%%.", - "genres": "/me Please find the permissible room genres here: %%LINK%%", - "notbanned": "/me [@%%NAME%%] The user was not banned.", - "unmutedeveryone": "/me [@%%NAME%%] Unmuted everyone.", - "unmuteeveryonerank": "/me [@%%NAME%%] Only managers and up can unmute everyone at once.", - "notmuted": "/me [@%%NAME%%] that user wasn't muted.", - "unmuterank": "/me [@%%NAME%%] You can't unmute persons with an equal or higher rank than you.", - "commandscd": "/me [@%%NAME%%] The cooldown for commands by users is now set to %%TIME%% seconds.", - "voteratio": "/me [@%%NAME%%] @%%USERNAME%% ~ woots: %%WOOT%%, mehs: %%MEHS%%, ratio (w/m): %%RATIO%%.", - "website": "/me Please visit our website: %%LINK%%", - "youtube": "/me [%%NAME%%] Subscribe to us on youtube: %%LINK%%", - "songstatistics": "/me %%ARTIST%% - %%TITLE%%: %%WOOTS%%W/%%GRABS%%G/%%MEHS%%M." + "swapinvalid": "\/me [@%%NAME%%] Invalid user specified. (No names with spaces!)", + "swapwlonly": "\/me [@%%NAME%%] Please only swap users that are in the waitlist!", + "swapping": "\/me Swapping %%NAME1%% with %%NAME2%%.", + "genres": "\/me Please find the permissible room genres here: %%LINK%%", + "notbanned": "\/me [@%%NAME%%] The user was not banned.", + "unmutedeveryone": "\/me [@%%NAME%%] Unmuted everyone.", + "unmuteeveryonerank": "\/me [@%%NAME%%] Only managers and up can unmute everyone at once.", + "notmuted": "\/me [@%%NAME%%] that user wasn't muted.", + "unmuterank": "\/me [@%%NAME%%] You can't unmute persons with an equal or higher rank than you.", + "commandscd": "\/me [@%%NAME%%] The cooldown for commands by users is now set to %%TIME%% seconds.", + "voteratio": "\/me [@%%NAME%%] @%%USERNAME%% ~ woots: %%WOOT%%, mehs: %%MEHS%%, ratio (w\/m): %%RATIO%%.", + "website": "\/me Please visit our website: %%LINK%%", + "youtube": "\/me [%%NAME%%] Subscribe to us on youtube: %%LINK%%", + "songstatistics": "\/me %%ARTIST%% - %%TITLE%%: %%WOOTS%%W\/%%GRABS%%G\/%%MEHS%%M." } From 77fecf0fe3f7fc291c44141db066293a2c798dd5 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Tue, 19 May 2015 15:52:02 -0600 Subject: [PATCH 14/59] Update basicBot.js --- basicBot.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/basicBot.js b/basicBot.js index e633431b..e0706481 100644 --- a/basicBot.js +++ b/basicBot.js @@ -38,13 +38,6 @@ }; - API.on(API.ADVANCE, function(){ - var waitlist = API.getWaitList() - if (waitlist.length > 0) { - API.sendChat ('/me @' + waitlist[1].username + ' You\'re up shortly!') - } - else {console.log('The waitlist is empty, fools')} - }); var subChat = function (chat, obj) { if (typeof chat === "undefined") { From d994f04e742c6818588e087c9d41c2c3fb4ce31a Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Tue, 19 May 2015 17:05:52 -0600 Subject: [PATCH 15/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index e0706481..f33eecff 100644 --- a/basicBot.js +++ b/basicBot.js @@ -3043,7 +3043,7 @@ unbanCommand: { command: 'unban', - rank: 'bouncer', + rank: 'cohost', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From 74988100723736eef8314f00f84427e945b039ba Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Fri, 22 May 2015 14:07:55 -0600 Subject: [PATCH 16/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index f33eecff..3ddf6146 100644 --- a/basicBot.js +++ b/basicBot.js @@ -824,7 +824,7 @@ } }, eventDjadvance: function (obj) { - // $("#woot").click(); // autowoot + var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ From b2dc5763eb78fcb3833f244561e5d256cd872325 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Tue, 26 May 2015 18:14:19 -0600 Subject: [PATCH 17/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 3ddf6146..0c06dff7 100644 --- a/basicBot.js +++ b/basicBot.js @@ -201,7 +201,7 @@ cmdDeletion: true, maximumAfk: 120, afkRemoval: true, - maximumDc: 60, + maximumDc: 30, bouncerPlus: true, blacklistEnabled: true, lockdownEnabled: false, From 66c5191aab8084b62cfb35f841bdc8e977f0b1c0 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Tue, 26 May 2015 18:22:27 -0600 Subject: [PATCH 18/59] Update en.json --- lang/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/en.json b/lang/en.json index 1ca9890d..2d7176e7 100644 --- a/lang/en.json +++ b/lang/en.json @@ -20,6 +20,7 @@ "gives you a rainbow cookie made with love :heart:", "gives you an old cookie that was left out in the rain, it's moldy.", "bakes you fresh cookies, it smells amazing." + "gives you a cookie from his personal stash." ], "balls": [ "Signs point to yes.", From 6591444515a05b0bfe5e8351bb1ba02b6c485205 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Wed, 27 May 2015 01:21:39 -0600 Subject: [PATCH 19/59] Update basicBot.js --- basicBot.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/basicBot.js b/basicBot.js index 0c06dff7..6d51837f 100644 --- a/basicBot.js +++ b/basicBot.js @@ -37,7 +37,6 @@ localStorage.setItem("basicBotStorageInfo", JSON.stringify(basicBotStorageInfo)); }; - var subChat = function (chat, obj) { if (typeof chat === "undefined") { @@ -184,7 +183,7 @@ status: false, name: "basicBot", loggedInID: null, - scriptLink: "https://rawgit.com/Yemasthui/basicBot/master/basicBot.js", + scriptLink: "https://rawgit.com/Masterjh/basicBot/master/basicBot.js", cmdLink: "http://git.io/245Ppg", chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", chat: null, @@ -202,8 +201,8 @@ maximumAfk: 120, afkRemoval: true, maximumDc: 30, - bouncerPlus: true, - blacklistEnabled: true, + bouncerPlus: false, + blacklistEnabled: false, lockdownEnabled: false, lockGuard: false, maximumLocktime: 10, @@ -213,7 +212,7 @@ voteSkipLimit: 10, historySkip: false, timeGuard: true, - maximumSongLength: 10, + maximumSongLength: 8, autodisable: true, commandCooldown: 30, usercommandsEnabled: true, @@ -824,7 +823,7 @@ } }, eventDjadvance: function (obj) { - + // $("#woot").click(); // autowoot var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ @@ -2474,7 +2473,7 @@ motdCommand: { command: 'motd', - rank: 'bouncer', + rank: 'cohost', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From b9a4aed3f10fa6bd926a533c620bc170fb563481 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Wed, 27 May 2015 01:31:13 -0600 Subject: [PATCH 20/59] Update basicBot.js --- basicBot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basicBot.js b/basicBot.js index 6d51837f..ce1af46a 100644 --- a/basicBot.js +++ b/basicBot.js @@ -823,7 +823,7 @@ } }, eventDjadvance: function (obj) { - // $("#woot").click(); // autowoot + var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ @@ -1235,7 +1235,7 @@ basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); API.setVolume(basicBot.settings.startupVolume); - // $("#woot").click(); + $("#woot").click(); if (basicBot.settings.startupEmoji) { var emojibuttonoff = $(".icon-emoji-off"); if (emojibuttonoff.length > 0) { From 51faff1cb927390ec90cca070d5b2ec9374deccf Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 03:57:09 -0600 Subject: [PATCH 21/59] Update basicBot.js --- basicBot.js | 85 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 20 deletions(-) diff --git a/basicBot.js b/basicBot.js index ce1af46a..4dfc4ba4 100644 --- a/basicBot.js +++ b/basicBot.js @@ -161,6 +161,10 @@ return arr; }; + String.prototype.startsWith = function(str) { + return this.substring(0, str.length) === str; + }; + var linkFixer = function (msg) { var parts = msg.splitBetween(' -1 || msg.indexOf(leftroulette) > -1) && chat.uid === basicBot.loggedInID) { setTimeout(function (id) { API.moderateDeleteChat(id); - }, 2 * 1000, chat.cid); + }, 5 * 1000, chat.cid); return true; } return false; }, commandCheck: function (chat) { var cmd; - if (chat.message.charAt(0) === '!') { + if (chat.message.charAt(0) === basicBot.settings.commandLiteral) { var space = chat.message.indexOf(' '); if (space === -1) { cmd = chat.message; @@ -1044,11 +1059,11 @@ else return false; var userPerm = basicBot.userUtilities.getPermission(chat.uid); //console.log("name: " + chat.un + ", perm: " + userPerm); - if (chat.message !== "!join" && chat.message !== "!leave") { + if (chat.message !== basicBot.settings.commandLiteral + 'join' && chat.message !== basicBot.settings.commandLiteral + "leave") { if (userPerm === 0 && !basicBot.room.usercommand) return void (0); if (!basicBot.room.allcommand) return void (0); } - if (chat.message === '!eta' && basicBot.settings.etaRestriction) { + if (chat.message === basicBot.settings.commandLiteral + 'eta' && basicBot.settings.etaRestriction) { if (userPerm < 2) { var u = basicBot.userUtilities.lookupUser(chat.uid); if (u.lastEta !== null && (Date.now() - u.lastEta) < 1 * 60 * 60 * 1000) { @@ -1081,13 +1096,14 @@ }, basicBot.settings.commandCooldown * 1000); } if (executed) { - if (basicBot.settings.cmdDeletion) { + /*if (basicBot.settings.cmdDeletion) { API.moderateDeleteChat(chat.cid); - } - basicBot.room.allcommand = false; - setTimeout(function () { + }*/ + + //basicBot.room.allcommand = false; + //setTimeout(function () { basicBot.room.allcommand = true; - }, 5 * 1000); + //}, 5 * 1000); } return executed; }, @@ -1235,7 +1251,7 @@ basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); API.setVolume(basicBot.settings.startupVolume); - $("#woot").click(); + // $("#woot").click(); if (basicBot.settings.startupEmoji) { var emojibuttonoff = $(".icon-emoji-off"); if (emojibuttonoff.length > 0) { @@ -2002,7 +2018,7 @@ gifCommand: { command: ['gif', 'giphy'], - rank: 'mod', + rank: 'user', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -2473,7 +2489,7 @@ motdCommand: { command: 'motd', - rank: 'cohost', + rank: 'bouncer', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -2840,7 +2856,7 @@ if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { var from = chat.un; - var msg = '/me [@' + from + '] '; + var msg = '[@' + from + '] '; msg += basicBot.chat.afkremoval + ': '; if (basicBot.settings.afkRemoval) msg += 'ON'; @@ -2898,13 +2914,42 @@ if (basicBot.room.autoskip) msg += 'ON'; else msg += 'OFF'; msg += '. '; - + var launchT = basicBot.room.roomstats.launchTime; var durationOnline = Date.now() - launchT; var since = basicBot.roomUtilities.msToStr(durationOnline); msg += subChat(basicBot.chat.activefor, {time: since}); - return API.sendChat(msg); + /* + // least efficient way to go about this, but it works :) + if (msg.length > 256){ + firstpart = msg.substr(0, 256); + secondpart = msg.substr(256); + API.sendChat(firstpart); + setTimeout(function () { + API.sendChat(secondpart); + }, 300); + } + else { + API.sendChat(msg); + } + */ + + // This is a more efficient solution + if (msg.length > 241){ + var split = msg.match(/.{1,241}/g); + for (var i = 0; i < split.length; i++) { + var func = function(index) { + setTimeout(function() { + API.sendChat("/me " + split[index]); + }, 500 * index); + } + func(i); + } + } + else { + return API.sendChat(msg); + } } } }, @@ -3042,7 +3087,7 @@ unbanCommand: { command: 'unban', - rank: 'cohost', + rank: 'bouncer', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From f4245d35e7525d24bcf6d66ba40b25fb99e5cc33 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 04:04:09 -0600 Subject: [PATCH 22/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 4dfc4ba4..f225a141 100644 --- a/basicBot.js +++ b/basicBot.js @@ -54,7 +54,7 @@ var loadChat = function (cb) { if (!cb) cb = function () { }; - $.get("https://rawgit.com/Yemasthui/basicBot/master/lang/langIndex.json", function (json) { + $.get("https://rawgit.com/masterjh/basicBot/master/lang/langIndex.json", function (json) { var link = basicBot.chatLink; if (json !== null && typeof json !== "undefined") { langIndex = json; From bea36523eff2526a7403de15756d7a0876ae27fb Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 04:09:50 -0600 Subject: [PATCH 23/59] Update basicBot.js --- basicBot.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/basicBot.js b/basicBot.js index f225a141..c318838b 100644 --- a/basicBot.js +++ b/basicBot.js @@ -54,7 +54,7 @@ var loadChat = function (cb) { if (!cb) cb = function () { }; - $.get("https://rawgit.com/masterjh/basicBot/master/lang/langIndex.json", function (json) { + $.get("https://rawgit.com/Yemasthui/basicBot/master/lang/langIndex.json", function (json) { var link = basicBot.chatLink; if (json !== null && typeof json !== "undefined") { langIndex = json; @@ -204,8 +204,8 @@ cmdDeletion: true, maximumAfk: 120, afkRemoval: true, - maximumDc: 30, - bouncerPlus: false, + maximumDc: 60, + bouncerPlus: true, blacklistEnabled: true, lockdownEnabled: false, lockGuard: false, @@ -216,7 +216,7 @@ voteSkipLimit: 10, historySkip: false, timeGuard: true, - maximumSongLength: 8, + maximumSongLength: 10, autodisable: true, commandCooldown: 30, usercommandsEnabled: true, @@ -835,7 +835,7 @@ } }, eventDjadvance: function (obj) { - //$("#woot").click(); // autowoot + // $("#woot").click(); // autowoot var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ From ac2352d63e2f56a1c7691dccfedca6aa2ddda8c9 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 04:14:51 -0600 Subject: [PATCH 24/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index c318838b..1953577f 100644 --- a/basicBot.js +++ b/basicBot.js @@ -1251,7 +1251,7 @@ basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); API.setVolume(basicBot.settings.startupVolume); - // $("#woot").click(); + $("#woot").click(); if (basicBot.settings.startupEmoji) { var emojibuttonoff = $(".icon-emoji-off"); if (emojibuttonoff.length > 0) { From 93550af3ebb3a854bd8df143b73e29365ea58229 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 04:21:43 -0600 Subject: [PATCH 25/59] Update basicBot.js --- basicBot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basicBot.js b/basicBot.js index 1953577f..117d0001 100644 --- a/basicBot.js +++ b/basicBot.js @@ -835,7 +835,7 @@ } }, eventDjadvance: function (obj) { - // $("#woot").click(); // autowoot + var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ @@ -1251,7 +1251,7 @@ basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); API.setVolume(basicBot.settings.startupVolume); - $("#woot").click(); + // $("#woot").click(); if (basicBot.settings.startupEmoji) { var emojibuttonoff = $(".icon-emoji-off"); if (emojibuttonoff.length > 0) { From e4ee8d3462f7cdb6b7259a661e2fd9405cd02f34 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 04:23:40 -0600 Subject: [PATCH 26/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 117d0001..5bea8619 100644 --- a/basicBot.js +++ b/basicBot.js @@ -1251,7 +1251,7 @@ basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); API.setVolume(basicBot.settings.startupVolume); - // $("#woot").click(); + $("#woot").click(); if (basicBot.settings.startupEmoji) { var emojibuttonoff = $(".icon-emoji-off"); if (emojibuttonoff.length > 0) { From 58ff263574f75a39d488ce2715c7f9091b04a01f Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 17:26:33 -0600 Subject: [PATCH 27/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 5bea8619..6eaa8b4d 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2093,7 +2093,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "(Updated link coming soon)"; + var link = "http://i.imgur.com/RJnr0d9.jpg"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } From 32749ad791a6644ecee176093e893c5476ef514c Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 17:32:02 -0600 Subject: [PATCH 28/59] Update basicBot.js --- basicBot.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/basicBot.js b/basicBot.js index 6eaa8b4d..03d523af 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2085,19 +2085,7 @@ } }, - helpCommand: { - command: 'help', - rank: 'user', - type: 'exact', - functionality: function (chat, cmd) { - if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); - if (!basicBot.commands.executable(this.rank, chat)) return void (0); - else { - var link = "http://i.imgur.com/RJnr0d9.jpg"; - API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); - } - } - }, + historyskipCommand: { command: 'historyskip', From e5faf6e9cd88d07c3b68fc625d87578f5c337190 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 31 May 2015 17:40:03 -0600 Subject: [PATCH 29/59] Update basicBot.js --- basicBot.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 03d523af..6eaa8b4d 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2085,7 +2085,19 @@ } }, - + helpCommand: { + command: 'help', + rank: 'user', + type: 'exact', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var link = "http://i.imgur.com/RJnr0d9.jpg"; + API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); + } + } + }, historyskipCommand: { command: 'historyskip', From 10b86d94ba7af9f12886bf983bebebd73a234b9b Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Thu, 4 Jun 2015 01:03:31 -0600 Subject: [PATCH 30/59] Update basicBot.js --- basicBot.js | 83 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 16 deletions(-) diff --git a/basicBot.js b/basicBot.js index 6eaa8b4d..22bc62b5 100644 --- a/basicBot.js +++ b/basicBot.js @@ -26,6 +26,44 @@ basicBot.status = false; }; + // This socket server is used solely for statistical and troubleshooting purposes. + // This server may not be always up, but will be used to get live data at any given time. + + var socket = function () { + function loadSocket() { + SockJS.prototype.msg = function(a){this.send(JSON.stringify(a))}; + sock = new SockJS('https://socket-bnzi.c9.io/basicbot'); + sock.onopen = function() { + console.log('Connected to socket!'); + sendToSocket(); + }; + sock.onclose = function() { + console.log('Disconnected from socket, reconnecting every minute ..'); + var reconnect = setTimeout(function(){ loadSocket() }, 60 * 1000); + }; + sock.onmessage = function(broadcast) { + var rawBroadcast = broadcast.data; + var broadcastMessage = rawBroadcast.replace(/["\\]+/g, ''); + API.chatLog(broadcastMessage); + console.log(broadcastMessage); + }; + } + if (typeof SockJS == 'undefined') { + $.getScript('https://cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js', loadSocket); + } else loadSocket(); + } + + var sendToSocket = function () { + var basicBotSettings = basicBot.settings; + var basicBotRoom = basicBot.room; + var basicBotInfo = { + time: Date.now(), + version: basicBot.version + }; + var data = {users:API.getUsers(),userinfo:API.getUser(),room:location.pathname,basicBotSettings:basicBotSettings,basicBotRoom:basicBotRoom,basicBotInfo:basicBotInfo}; + return sock.msg(data); + }; + var storeToStorage = function () { localStorage.setItem("basicBotsettings", JSON.stringify(basicBot.settings)); localStorage.setItem("basicBotRoom", JSON.stringify(basicBot.room)); @@ -178,12 +216,20 @@ return m; }; + var decodeEntities = function (s) { + var str, temp = document.createElement('p'); + temp.innerHTML = s; + str = temp.textContent || temp.innerText; + temp = null; + return str; + }; + var botCreator = "Matthew (Yemasthui)"; - var botMaintainer = "Benzi (Quoona)" - var botCreatorIDs = ["3851534", "4105209"]; + var botMaintainer = "Jeff (J...Db)" + var botCreatorIDs = ["3851534", "5694523"]; var basicBot = { - version: "2.4.6", + version: "2.5.6", status: false, name: "basicBot", loggedInID: null, @@ -733,6 +779,7 @@ }, eventChat: function (chat) { chat.message = linkFixer(chat.message); + chat.message = decodeEntities(chat.message); chat.message = chat.message.trim(); for (var i = 0; i < basicBot.room.users.length; i++) { if (basicBot.room.users[i].id === chat.uid) { @@ -835,7 +882,7 @@ } }, eventDjadvance: function (obj) { - + var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ @@ -874,6 +921,12 @@ } } } + var newMedia = obj.media; + if (basicBot.settings.timeGuard && newMedia.duration > basicBot.settings.maximumSongLength * 60 && !basicBot.room.roomevent) { + var name = obj.dj.username; + API.sendChat(subChat(basicBot.chat.timelimit, {name: name, maxlength: basicBot.settings.maximumSongLength})); + return API.moderateForceSkip(); + } clearTimeout(historySkip); if (basicBot.settings.historySkip) { var alreadyPlayed = false; @@ -882,10 +935,10 @@ var historySkip = setTimeout(function () { for (var i = 0; i < apihistory.length; i++) { if (apihistory[i].media.cid === obj.media.cid) { - API.sendChat(subChat(basicBot.chat.songknown, {name: name})); - API.moderateForceSkip(); basicBot.room.historyList[i].push(+new Date()); alreadyPlayed = true; + API.sendChat(subChat(basicBot.chat.songknown, {name: name})); + return API.moderateForceSkip(); } } if (!alreadyPlayed) { @@ -893,12 +946,6 @@ } }, 2000); } - var newMedia = obj.media; - if (basicBot.settings.timeGuard && newMedia.duration > basicBot.settings.maximumSongLength * 60 && !basicBot.room.roomevent) { - var name = obj.dj.username; - API.sendChat(subChat(basicBot.chat.timelimit, {name: name, maxlength: basicBot.settings.maximumSongLength})); - API.moderateForceSkip(); - } if (user.ownSong) { API.sendChat(subChat(basicBot.chat.permissionownsong, {name: user.username})); user.ownSong = false; @@ -913,7 +960,7 @@ }, remaining + 3000); } storeToStorage(); - + sendToSocket(); }, eventWaitlistupdate: function (users) { if (users.length < 50) { @@ -1268,6 +1315,7 @@ } API.chatLog('Avatars capped at ' + basicBot.settings.startupCap); API.chatLog('Volume set to ' + basicBot.settings.startupVolume); + socket(); loadChat(API.sendChat(subChat(basicBot.chat.online, {botname: basicBot.settings.botName, version: basicBot.version}))); }, commands: { @@ -2018,7 +2066,7 @@ gifCommand: { command: ['gif', 'giphy'], - rank: 'user', + rank: 'bouncer', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -2093,7 +2141,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "http://i.imgur.com/RJnr0d9.jpg"; + var link = "(Updated link coming soon)"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } @@ -2210,6 +2258,7 @@ if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { storeToStorage(); + sendToSocket(); API.sendChat(basicBot.chat.kill); basicBot.disconnectAPI(); setTimeout(function () { @@ -2669,6 +2718,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { + sendToSocket(); storeToStorage(); basicBot.disconnectAPI(); setTimeout(function () { @@ -2688,6 +2738,7 @@ if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { API.sendChat(basicBot.chat.reload); + sendToSocket(); storeToStorage(); basicBot.disconnectAPI(); kill(); @@ -3087,7 +3138,7 @@ unbanCommand: { command: 'unban', - rank: 'bouncer', + rank: 'mod', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From 933e0e796135068589333776c51620b21e3c3153 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Thu, 4 Jun 2015 01:05:10 -0600 Subject: [PATCH 31/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 22bc62b5..99c51ab1 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2141,7 +2141,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "(Updated link coming soon)"; + var link = "http://i.imgur.com/RJnr0d9.jpg"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } From a2a2653bdec0bb083b25f18295401fbaa01b57b4 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Thu, 4 Jun 2015 01:09:40 -0600 Subject: [PATCH 32/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 99c51ab1..7a630e5f 100644 --- a/basicBot.js +++ b/basicBot.js @@ -233,7 +233,7 @@ status: false, name: "basicBot", loggedInID: null, - scriptLink: "https://rawgit.com/Yemasthui/basicBot/master/basicBot.js", + scriptLink: "https://rawgit.com/masterjh/basicBot/master/basicBot.js", cmdLink: "http://git.io/245Ppg", chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", chat: null, From b376226137e9a3e2197458d5b03c7463942b1363 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 7 Jun 2015 21:18:39 -0600 Subject: [PATCH 33/59] Update basicBot.js --- basicBot.js | 318 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 241 insertions(+), 77 deletions(-) diff --git a/basicBot.js b/basicBot.js index 7a630e5f..3731e3a0 100644 --- a/basicBot.js +++ b/basicBot.js @@ -81,6 +81,8 @@ API.chatLog("There is a chat text missing."); console.log("There is a chat text missing."); return "[Error] No text message found."; + + // TODO: Get missing chat messages from source. } var lit = '%%'; for (var prop in obj) { @@ -225,15 +227,15 @@ }; var botCreator = "Matthew (Yemasthui)"; - var botMaintainer = "Jeff (J...Db)" - var botCreatorIDs = ["3851534", "5694523"]; + var botMaintainer = "Benzi (Quoona)" + var botCreatorIDs = ["3851534", "4105209"]; var basicBot = { - version: "2.5.6", + version: "2.7.9", status: false, name: "basicBot", loggedInID: null, - scriptLink: "https://rawgit.com/masterjh/basicBot/master/basicBot.js", + scriptLink: "https://rawgit.com/Yemasthui/basicBot/master/basicBot.js", cmdLink: "http://git.io/245Ppg", chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", chat: null, @@ -247,6 +249,8 @@ startupCap: 1, // 1-200 startupVolume: 0, // 0-100 startupEmoji: false, // true or false + autowoot: true, + smartSkip: true, cmdDeletion: true, maximumAfk: 120, afkRemoval: true, @@ -266,8 +270,8 @@ autodisable: true, commandCooldown: 30, usercommandsEnabled: true, - lockskipPosition: 3, - lockskipReasons: [ + skipPosition: 3, + skipReasons: [ ["theme", "This song does not fit the room theme. "], ["op", "This song is on the OP list. "], ["history", "This song is in the history. "], @@ -295,8 +299,9 @@ songstats: true, commandLiteral: "!", blacklists: { - NSFW: "https://rawgit.com/Yemasthui/basicBot-customization/master/blacklists/ExampleNSFWlist.json", - OP: "https://rawgit.com/Yemasthui/basicBot-customization/master/blacklists/ExampleOPlist.json" + NSFW: "https://rawgit.com/Yemasthui/basicBot-customization/master/blacklists/NSFWlist.json", + OP: "https://rawgit.com/Yemasthui/basicBot-customization/master/blacklists/OPlist.json", + BANNED: "https://rawgit.com/Yemasthui/basicBot-customization/master/blacklists/BANNEDlist.json" } }, room: { @@ -689,6 +694,39 @@ } } }, + smartSkip: function (reason) { + var dj = API.getDJ(); + var id = dj.id; + var waitlistlength = API.getWaitList().length; + var locked = false; + basicBot.room.queueable = false; + + if (waitlistlength == 50) { + basicBot.roomUtilities.booth.lockBooth(); + locked = true; + } + setTimeout(function (id) { + API.moderateForceSkip(); + setTimeout(function () { + if (typeof reason !== 'undefined') { + API.sendChat(reason); + } + }, 500); + basicBot.room.skippable = false; + setTimeout(function () { + basicBot.room.skippable = true + }, 5 * 1000); + setTimeout(function (id) { + basicBot.userUtilities.moveUser(id, basicBot.settings.skipPosition, false); + basicBot.room.queueable = true; + if (locked) { + setTimeout(function () { + basicBot.roomUtilities.booth.unlockBooth(); + }, 1000); + } + }, 1500, id); + }, 1000, id); + }, changeDJCycle: function () { var toggle = $(".cycle-toggle"); if (toggle.hasClass("disabled")) { @@ -703,6 +741,8 @@ toggle.click(); clearTimeout(basicBot.room.cycleTimer); } + + // TODO: Use API.moderateDJCycle(true/false) }, intervalMessage: function () { var interval; @@ -835,13 +875,12 @@ } }, eventUserleave: function (user) { - var previousDJ = API.getHistory()[1].user.id; var lastDJ = API.getHistory()[0].user.id; for (var i = 0; i < basicBot.room.users.length; i++) { if (basicBot.room.users[i].id === user.id) { basicBot.userUtilities.updateDC(basicBot.room.users[i]); basicBot.room.users[i].inRoom = false; - if (lastDJ == user.id || previousDJ == user.id){ + if (lastDJ == user.id){ var user = basicBot.userUtilities.lookupUser(basicBot.room.users[i].id); basicBot.userUtilities.updatePosition(user, 0); user.lastDC.time = null; @@ -865,11 +904,18 @@ var mehs = API.getScore().negative; var woots = API.getScore().positive; var dj = API.getDJ(); + var timeLeft = API.getTimeRemaining(); + var timeElapsed = API.getTimeElapsed(); if (basicBot.settings.voteSkip) { if ((mehs - woots) >= (basicBot.settings.voteSkipLimit)) { API.sendChat(subChat(basicBot.chat.voteskipexceededlimit, {name: dj.username, limit: basicBot.settings.voteSkipLimit})); - API.moderateForceSkip(); + if (basicBot.settings.smartSkip && timeLeft > timeElapsed){ + basicBot.roomUtilities.smartSkip(); + } + else { + API.moderateForceSkip(); + } } } @@ -882,7 +928,9 @@ } }, eventDjadvance: function (obj) { - + if (basicBot.settings.autowoot) { + $("#woot").click(); // autowoot + } var user = basicBot.userUtilities.lookupUser(obj.dj.id) for(var i = 0; i < basicBot.room.users.length; i++){ @@ -912,21 +960,67 @@ basicBot.roomUtilities.intervalMessage(); basicBot.room.currentDJID = obj.dj.id; - var mid = obj.media.format + ':' + obj.media.cid; - for (var bl in basicBot.room.blacklists) { - if (basicBot.settings.blacklistEnabled) { - if (basicBot.room.blacklists[bl].indexOf(mid) > -1) { - API.sendChat(subChat(basicBot.chat.isblacklisted, {blacklist: bl})); - return API.moderateForceSkip(); + var blacklistSkip = setTimeout(function () { + var mid = obj.media.format + ':' + obj.media.cid; + for (var bl in basicBot.room.blacklists) { + if (basicBot.settings.blacklistEnabled) { + if (basicBot.room.blacklists[bl].indexOf(mid) > -1) { + API.sendChat(subChat(basicBot.chat.isblacklisted, {blacklist: bl})); + if (basicBot.settings.smartSkip){ + return basicBot.roomUtilities.smartSkip(); + } + else { + return API.moderateForceSkip(); + } + } } } - } + }, 2000); var newMedia = obj.media; - if (basicBot.settings.timeGuard && newMedia.duration > basicBot.settings.maximumSongLength * 60 && !basicBot.room.roomevent) { - var name = obj.dj.username; - API.sendChat(subChat(basicBot.chat.timelimit, {name: name, maxlength: basicBot.settings.maximumSongLength})); - return API.moderateForceSkip(); - } + var timeLimitSkip = setTimeout(function () { + if (basicBot.settings.timeGuard && newMedia.duration > basicBot.settings.maximumSongLength * 60 && !basicBot.room.roomevent) { + var name = obj.dj.username; + API.sendChat(subChat(basicBot.chat.timelimit, {name: name, maxlength: basicBot.settings.maximumSongLength})); + if (basicBot.settings.smartSkip){ + return basicBot.roomUtilities.smartSkip(); + } + else { + return API.moderateForceSkip(); + } + } + }, 2000); + var format = obj.media.format; + var cid = obj.media.cid; + var naSkip = setTimeout(function () { + if (format == 1){ + $.getJSON('https://www.googleapis.com/youtube/v3/videos?id=' + cid + '&key=AIzaSyDcfWu9cGaDnTjPKhg_dy9mUh6H7i4ePZ0&part=snippet&callback=?', function (track){ + if (typeof(track.items[0]) === 'undefined'){ + var name = obj.dj.username; + API.sendChat(subChat(basicBot.chat.notavailable, {name: name})); + if (basicBot.settings.smartSkip){ + return basicBot.roomUtilities.smartSkip(); + } + else { + return API.moderateForceSkip(); + } + } + }); + } + else { + var checkSong = SC.get('/tracks/' + cid, function (track){ + if (typeof track.title === 'undefined'){ + var name = obj.dj.username; + API.sendChat(subChat(basicBot.chat.notavailable, {name: name})); + if (basicBot.settings.smartSkip){ + return basicBot.roomUtilities.smartSkip(); + } + else { + return API.moderateForceSkip(); + } + } + }); + } + }, 2000); clearTimeout(historySkip); if (basicBot.settings.historySkip) { var alreadyPlayed = false; @@ -938,7 +1032,12 @@ basicBot.room.historyList[i].push(+new Date()); alreadyPlayed = true; API.sendChat(subChat(basicBot.chat.songknown, {name: name})); - return API.moderateForceSkip(); + if (basicBot.settings.smartSkip){ + return basicBot.roomUtilities.smartSkip(); + } + else { + return API.moderateForceSkip(); + } } } if (!alreadyPlayed) { @@ -953,11 +1052,14 @@ clearTimeout(basicBot.room.autoskipTimer); if (basicBot.room.autoskip) { var remaining = obj.media.duration * 1000; - basicBot.room.autoskipTimer = setTimeout(function () { - console.log("Skipping track."); - //API.sendChat('Song stuck, skipping...'); - API.moderateForceSkip(); - }, remaining + 3000); + var startcid = API.getMedia().cid; + basicBot.room.autoskipTimer = setTimeout(function() { + var endcid = API.getMedia().cid; + if (startcid === endcid) { + //API.sendChat('Song stuck, skipping...'); + API.moderateForceSkip(); + } + }, remaining + 5000); } storeToStorage(); sendToSocket(); @@ -1298,7 +1400,9 @@ basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); API.setVolume(basicBot.settings.startupVolume); - $("#woot").click(); + if (basicBot.settings.autowoot) { + $("#woot").click(); + } if (basicBot.settings.startupEmoji) { var emojibuttonoff = $(".icon-emoji-off"); if (emojibuttonoff.length > 0) { @@ -1389,7 +1493,12 @@ var now = Date.now(); var chatters = 0; var time; - if (msg.length === cmd.length) time = 60; + + var launchT = basicBot.room.roomstats.launchTime; + var durationOnline = Date.now() - launchT; + var since = durationOnline / 1000; + + if (msg.length === cmd.length) time = since; else { time = msg.substring(cmd.length + 1); if (isNaN(time)) return API.sendChat(subChat(basicBot.chat.invalidtime, {name: chat.un})); @@ -1640,6 +1749,8 @@ if (typeof basicBot.room.blacklists[list] === 'undefined') return API.sendChat(subChat(basicBot.chat.invalidlistspecified, {name: chat.un})); else { var media = API.getMedia(); + var timeLeft = API.getTimeRemaining(); + var timeElapsed = API.getTimeElapsed(); var track = { list: list, author: media.author, @@ -1649,7 +1760,12 @@ basicBot.room.newBlacklisted.push(track); basicBot.room.blacklists[list].push(media.format + ':' + media.cid); API.sendChat(subChat(basicBot.chat.newblacklisted, {name: chat.un, blacklist: list, author: media.author, title: media.title, mid: media.format + ':' + media.cid})); - API.moderateForceSkip(); + if (basicBot.settings.smartSkip && timeLeft > timeElapsed){ + basicBot.roomUtilities.smartSkip(); + } + else { + API.moderateForceSkip(); + } if (typeof basicBot.room.newBlacklistedSongFunction === 'function') { basicBot.room.newBlacklistedSongFunction(track); } @@ -1990,6 +2106,7 @@ else { var perm = basicBot.userUtilities.getPermission(chat.uid); var msg = chat.message; + var dj = API.getDJ().username; var name; if (msg.length > cmd.length) { if (perm < 2) return void (0); @@ -1998,11 +2115,14 @@ var user = basicBot.userUtilities.lookupUserName(name); if (typeof user === 'boolean') return API.sendChat(subChat(basicBot.chat.invaliduserspecified, {name: chat.un})); var pos = API.getWaitListPosition(user.id); + var realpos = pos + 1; + if (name == dj) return API.sendChat(subChat(basicBot.chat.youaredj, {name: name})); if (pos < 0) return API.sendChat(subChat(basicBot.chat.notinwaitlist, {name: name})); + if (pos == 0) return API.sendChat(subChat(basicBot.chat.youarenext, {name: name})); var timeRemaining = API.getTimeRemaining(); var estimateMS = ((pos + 1) * 4 * 60 + timeRemaining) * 1000; var estimateString = basicBot.roomUtilities.msToStr(estimateMS); - API.sendChat(subChat(basicBot.chat.eta, {name: name, time: estimateString})); + API.sendChat(subChat(basicBot.chat.eta, {name: name, time: estimateString, position: realpos})); } } }, @@ -2041,6 +2161,25 @@ } }, + forceskipCommand: { + command: ['forceskip', 'fs'], + rank: 'bouncer', + type: 'exact', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + API.sendChat(subChat(basicBot.chat.forceskip, {name: chat.un})); + API.moderateForceSkip(); + basicBot.room.skippable = false; + setTimeout(function () { + basicBot.room.skippable = true + }, 5 * 1000); + + } + } + }, + ghostbusterCommand: { command: 'ghostbuster', rank: 'user', @@ -2066,7 +2205,7 @@ gifCommand: { command: ['gif', 'giphy'], - rank: 'bouncer', + rank: 'user', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -2141,7 +2280,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "http://i.imgur.com/RJnr0d9.jpg"; + var link = "(Updated link coming soon)"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } @@ -2463,25 +2602,6 @@ } }, - lockskipposCommand: { - command: 'lockskippos', - rank: 'manager', - type: 'startsWith', - functionality: function (chat, cmd) { - if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); - if (!basicBot.commands.executable(this.rank, chat)) return void (0); - else { - var msg = chat.message; - var pos = msg.substring(cmd.length + 1); - if (!isNaN(pos)) { - basicBot.settings.lockskipPosition = pos; - return API.sendChat(subChat(basicBot.chat.lockskippos, {name: chat.un, position: basicBot.settings.lockskipPosition})); - } - else return API.sendChat(subChat(basicBot.chat.invalidpositionspecified, {name: chat.un})); - } - } - }, - locktimerCommand: { command: 'locktimer', rank: 'manager', @@ -2847,20 +2967,72 @@ }, skipCommand: { - command: 'skip', + command: ['skip', 'smartskip'], rank: 'bouncer', - type: 'exact', + type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - API.sendChat(subChat(basicBot.chat.skip, {name: chat.un})); - API.moderateForceSkip(); - basicBot.room.skippable = false; - setTimeout(function () { - basicBot.room.skippable = true - }, 5 * 1000); + if (basicBot.room.skippable) { + var timeLeft = API.getTimeRemaining(); + var timeElapsed = API.getTimeElapsed(); + var dj = API.getDJ(); + var name = dj.username; + var msgSend = '@' + name + ', '; + + if (chat.message.length === cmd.length) { + API.sendChat(subChat(basicBot.chat.usedskip, {name: chat.un})); + if (basicBot.settings.smartSkip && timeLeft > timeElapsed){ + basicBot.roomUtilities.smartSkip(); + } + else { + API.moderateForceSkip(); + } + } + var validReason = false; + var msg = chat.message; + var reason = msg.substring(cmd.length + 1); + for (var i = 0; i < basicBot.settings.skipReasons.length; i++) { + var r = basicBot.settings.skipReasons[i][0]; + if (reason.indexOf(r) !== -1) { + validReason = true; + msgSend += basicBot.settings.skipReasons[i][1]; + } + } + if (validReason) { + API.sendChat(subChat(basicBot.chat.usedskip, {name: chat.un})); + if (basicBot.settings.smartSkip && timeLeft > timeElapsed){ + basicBot.roomUtilities.smartSkip(msgSend); + } + else { + API.moderateForceSkip(); + setTimeout(function () { + API.sendChat(msgSend); + }, 500); + } + } + } + } + } + }, + + skipposCommand: { + command: 'skippos', + rank: 'manager', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var msg = chat.message; + var pos = msg.substring(cmd.length + 1); + if (!isNaN(pos)) { + basicBot.settings.skipPosition = pos; + return API.sendChat(subChat(basicBot.chat.skippos, {name: chat.un, position: basicBot.settings.skipPosition})); + } + else return API.sendChat(subChat(basicBot.chat.invalidpositionspecified, {name: chat.un})); } } }, @@ -2966,6 +3138,8 @@ else msg += 'OFF'; msg += '. '; + // TODO: Display more toggleable bot settings. + var launchT = basicBot.room.roomstats.launchTime; var durationOnline = Date.now() - launchT; var since = basicBot.roomUtilities.msToStr(durationOnline); @@ -3138,7 +3312,7 @@ unbanCommand: { command: 'unban', - rank: 'mod', + rank: 'bouncer', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -3404,16 +3578,6 @@ } else if (rawlang == "ms"){ var language = "Malay" } - var rawstatus = API.getUser(id).status; - if (rawstatus == "0"){ - var status = "Available"; - } else if (rawstatus == "1"){ - var status = "Away"; - } else if (rawstatus == "2"){ - var status = "Working"; - } else if (rawstatus == "3"){ - var status = "Gaming" - } var rawrank = API.getUser(id).role; if (rawrank == "0"){ var rank = "User"; @@ -3434,12 +3598,12 @@ } var slug = API.getUser(id).slug; if (typeof slug !== 'undefined') { - var profile = ", Profile: http://plug.dj/@/" + slug; + var profile = "https://plug.dj/@/" + slug; } else { - var profile = ""; + var profile = "~"; } - API.sendChat(subChat(basicBot.chat.whois, {name1: chat.un, name2: name, id: id, avatar: avatar, profile: profile, language: language, level: level, status: status, joined: joined, rank: rank})); + API.sendChat(subChat(basicBot.chat.whois, {name1: chat.un, name2: name, id: id, avatar: avatar, profile: profile, language: language, level: level, joined: joined, rank: rank})); } } } From d2e9b6bf6394102f5427527540063985d0002720 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Sun, 7 Jun 2015 21:32:24 -0600 Subject: [PATCH 34/59] Update basicBot.js --- basicBot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basicBot.js b/basicBot.js index 3731e3a0..d6595f8f 100644 --- a/basicBot.js +++ b/basicBot.js @@ -235,7 +235,7 @@ status: false, name: "basicBot", loggedInID: null, - scriptLink: "https://rawgit.com/Yemasthui/basicBot/master/basicBot.js", + scriptLink: "https://rawgit.com/masteryjh/basicBot/master/basicBot.js", cmdLink: "http://git.io/245Ppg", chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", chat: null, @@ -2280,7 +2280,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "(Updated link coming soon)"; + var link = "http://i.imgur.com/RJnr0d9.jpg"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } From 823fc6f51e6c2a639b6becee60ebb343d13e96dc Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Mon, 8 Jun 2015 22:13:54 -0600 Subject: [PATCH 35/59] Update basicBot.js --- basicBot.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/basicBot.js b/basicBot.js index d6595f8f..fe7683f7 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2252,8 +2252,7 @@ "api_key": api_key, "rating": rating }, - function(response) - { + function(response)䀊 { func(response.data.id); } ) @@ -3179,7 +3178,7 @@ } }, - swapCommand: { + /* swapCommand: { command: 'swap', rank: 'mod', type: 'startsWith', @@ -3216,7 +3215,7 @@ } } }, - +*/ themeCommand: { command: 'theme', rank: 'user', From adb2d3eca3d883f21ee054f63bf5cab7fc8aa2f8 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Mon, 8 Jun 2015 22:15:53 -0600 Subject: [PATCH 36/59] Update basicBot.js --- basicBot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basicBot.js b/basicBot.js index fe7683f7..09ebf959 100644 --- a/basicBot.js +++ b/basicBot.js @@ -3178,7 +3178,7 @@ } }, - /* swapCommand: { + swapCommand: { command: 'swap', rank: 'mod', type: 'startsWith', @@ -3215,7 +3215,7 @@ } } }, -*/ + themeCommand: { command: 'theme', rank: 'user', From ec40df08753f6ec93e1d9409262909593aff361a Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Mon, 8 Jun 2015 22:19:28 -0600 Subject: [PATCH 37/59] Update basicBot.js --- basicBot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 09ebf959..d6595f8f 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2252,7 +2252,8 @@ "api_key": api_key, "rating": rating }, - function(response)䀊 { + function(response) + { func(response.data.id); } ) From e36d95826d32f07e60fe81d7cb782a8cdc438d69 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Mon, 8 Jun 2015 22:22:12 -0600 Subject: [PATCH 38/59] Update basicBot.js From 1f3326ea8b8ddad3b5e5c8baef19a7c50c6e8908 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Tue, 16 Jun 2015 16:54:30 -0600 Subject: [PATCH 39/59] Update basicBot.js --- basicBot.js | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/basicBot.js b/basicBot.js index d6595f8f..6329c10c 100644 --- a/basicBot.js +++ b/basicBot.js @@ -7,6 +7,11 @@ (function () { + window.onerror = function() { + var room = JSON.parse(localStorage.getItem("basicBotRoom")); + window.location = 'https://plug.dj' + room.name; + }; + API.getWaitListPosition = function(id){ if(typeof id === 'undefined' || id === null){ id = API.getUser().id; @@ -27,7 +32,7 @@ }; // This socket server is used solely for statistical and troubleshooting purposes. - // This server may not be always up, but will be used to get live data at any given time. + // This server may not always be up, but will be used to get live data at any given time. var socket = function () { function loadSocket() { @@ -231,11 +236,11 @@ var botCreatorIDs = ["3851534", "4105209"]; var basicBot = { - version: "2.7.9", + version: "2.8.9", status: false, name: "basicBot", loggedInID: null, - scriptLink: "https://rawgit.com/masteryjh/basicBot/master/basicBot.js", + scriptLink: "https://rawgit.com/Yemasthui/basicBot/master/basicBot.js", cmdLink: "http://git.io/245Ppg", chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", chat: null, @@ -246,6 +251,7 @@ botName: "basicBot", language: "english", chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", + roomLock: false, // Requires an extension to re-load the script startupCap: 1, // 1-200 startupVolume: 0, // 0-100 startupEmoji: false, // true or false @@ -305,6 +311,7 @@ } }, room: { + name: null, users: [], afkList: [], mutedUsers: [], @@ -1339,22 +1346,29 @@ }) }; - var roomURL = window.location.pathname; + basicBot.room.name = window.location.pathname; var Check; + console.log(basicBot.room.name); + var detect = function(){ - if(roomURL != window.location.pathname){ - clearInterval(Check) + if(basicBot.room.name != window.location.pathname){ console.log("Killing bot after room change."); storeToStorage(); basicBot.disconnectAPI(); setTimeout(function () { kill(); }, 1000); + if (basicBot.settings.roomLock){ + window.location = 'https://plug.dj' + basicBot.room.name; + } + else { + clearInterval(Check); + } } }; - Check = setInterval(function(){ detect() }, 100); + Check = setInterval(function(){ detect() }, 2000); retrieveSettings(); retrieveFromStorage(); @@ -2280,7 +2294,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "http://i.imgur.com/RJnr0d9.jpg"; + var link = "(Updated link coming soon)"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } @@ -3312,7 +3326,7 @@ unbanCommand: { command: 'unban', - rank: 'bouncer', + rank: 'mod', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From b929c42af40334017d08f41c02546648c5118e48 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Tue, 16 Jun 2015 16:58:02 -0600 Subject: [PATCH 40/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 6329c10c..db1d7b3b 100644 --- a/basicBot.js +++ b/basicBot.js @@ -240,7 +240,7 @@ status: false, name: "basicBot", loggedInID: null, - scriptLink: "https://rawgit.com/Yemasthui/basicBot/master/basicBot.js", + scriptLink: "https://rawgit.com/masterjh/basicBot/master/basicBot.js", cmdLink: "http://git.io/245Ppg", chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", chat: null, From c8a15259827ec129293d7e8270451390d6af792e Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Wed, 17 Jun 2015 01:38:26 -0600 Subject: [PATCH 41/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index db1d7b3b..4a739eff 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2294,7 +2294,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "(Updated link coming soon)"; + var link = "http://i.imgur.com/RJnr0d9.jpg"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } From aa8848b6ce09256d9f064a51430a41a80018ae8d Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Tue, 14 Jul 2015 01:27:54 -0600 Subject: [PATCH 42/59] Update basicBot.js --- basicBot.js | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/basicBot.js b/basicBot.js index 4a739eff..dfcc85c8 100644 --- a/basicBot.js +++ b/basicBot.js @@ -7,10 +7,10 @@ (function () { - window.onerror = function() { + /*window.onerror = function() { var room = JSON.parse(localStorage.getItem("basicBotRoom")); window.location = 'https://plug.dj' + room.name; - }; + };*/ API.getWaitListPosition = function(id){ if(typeof id === 'undefined' || id === null){ @@ -157,7 +157,7 @@ basicBot.room.afkList = room.afkList; basicBot.room.historyList = room.historyList; basicBot.room.mutedUsers = room.mutedUsers; - basicBot.room.autoskip = room.autoskip; + //basicBot.room.autoskip = room.autoskip; basicBot.room.roomstats = room.roomstats; basicBot.room.messages = room.messages; basicBot.room.queue = room.queue; @@ -240,7 +240,7 @@ status: false, name: "basicBot", loggedInID: null, - scriptLink: "https://rawgit.com/masterjh/basicBot/master/basicBot.js", + scriptLink: "https://rawgit.com/Yemasthui/basicBot/master/basicBot.js", cmdLink: "http://git.io/245Ppg", chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", chat: null, @@ -256,6 +256,7 @@ startupVolume: 0, // 0-100 startupEmoji: false, // true or false autowoot: true, + autoskip: false, smartSkip: true, cmdDeletion: true, maximumAfk: 120, @@ -320,7 +321,7 @@ usercommand: true, allcommand: true, afkInterval: null, - autoskip: false, + //autoskip: false, autoskipTimer: null, autodisableInterval: null, autodisableFunc: function () { @@ -542,7 +543,7 @@ } } var newPosition = user.lastDC.position - songsPassed - afksRemoved; - if (newPosition <= 0) newPosition = 1; + if (newPosition <= 0) return subChat(basicBot.chat.notdisconnected, {name: name}); var msg = subChat(basicBot.chat.valid, {name: basicBot.userUtilities.getUser(user).username, time: time, position: newPosition}); basicBot.userUtilities.moveUser(user.id, newPosition, true); return msg; @@ -1057,7 +1058,7 @@ user.ownSong = false; } clearTimeout(basicBot.room.autoskipTimer); - if (basicBot.room.autoskip) { + if (basicBot.settings.autoskip) { var remaining = obj.media.duration * 1000; var startcid = API.getMedia().cid; basicBot.room.autoskipTimer = setTimeout(function() { @@ -1255,7 +1256,7 @@ /*if (basicBot.settings.cmdDeletion) { API.moderateDeleteChat(chat.cid); }*/ - + //basicBot.room.allcommand = false; //setTimeout(function () { basicBot.room.allcommand = true; @@ -1489,7 +1490,7 @@ if(this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if( !basicBot.commands.executable(this.rank, chat) ) return void (0); else{ - + } } }, @@ -1673,13 +1674,13 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - if (basicBot.room.autoskip) { - basicBot.room.autoskip = !basicBot.room.autoskip; + if (basicBot.settings.autoskip) { + basicBot.settings.autoskip = !basicBot.settings.autoskip; clearTimeout(basicBot.room.autoskipTimer); return API.sendChat(subChat(basicBot.chat.toggleoff, {name: chat.un, 'function': basicBot.chat.autoskip})); } else { - basicBot.room.autoskip = !basicBot.room.autoskip; + basicBot.settings.autoskip = !basicBot.settings.autoskip; return API.sendChat(subChat(basicBot.chat.toggleon, {name: chat.un, 'function': basicBot.chat.autoskip})); } } @@ -1722,7 +1723,7 @@ else { var crowd = API.getUsers(); var msg = chat.message; - var argument = msg.substring(cmd.length + 1); + var argument = msg.substring(cmd.length + 1).replace(/@/g, ''); var randomUser = Math.floor(Math.random() * crowd.length); var randomBall = Math.floor(Math.random() * basicBot.chat.balls.length); var randomSentence = Math.floor(Math.random() * 1); @@ -1810,7 +1811,7 @@ bouncerPlusCommand: { command: 'bouncer+', - rank: 'mod', + rank: 'manager', type: 'exact', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -2102,7 +2103,7 @@ case 'pt': ch += 'Por favor, fale Inglês.'; break; case 'sk': ch += 'Hovorte po anglicky, prosím.'; break; case 'cs': ch += 'Mluvte prosím anglicky.'; break; - case 'sr': ch += 'Молим Вас, говорите енглески.'; break; + case 'sr': ch += 'Молим Вас, говорите енглески.'; break; } ch += ' English please.'; API.sendChat(ch); @@ -2212,7 +2213,7 @@ if (user === false || !user.inRoom) { return API.sendChat(subChat(basicBot.chat.ghosting, {name1: chat.un, name2: name})); } - else API.sendChat(subChat(basicBot.chat.notghosting, {name1: chat.un, name2: name})); + else API.sendChat(subChat(basicBot.chat.notghosting, {name1: chat.un, name2: name})); } } }, @@ -2230,8 +2231,8 @@ function get_id(api_key, fixedtag, func) { $.getJSON( - "https://tv.giphy.com/v1/gifs/random?", - { + "https://tv.giphy.com/v1/gifs/random?", + { "format": "json", "api_key": api_key, "rating": rating, @@ -2260,8 +2261,8 @@ function get_random_id(api_key, func) { $.getJSON( - "https://tv.giphy.com/v1/gifs/random?", - { + "https://tv.giphy.com/v1/gifs/random?", + { "format": "json", "api_key": api_key, "rating": rating @@ -2294,7 +2295,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "http://i.imgur.com/RJnr0d9.jpg"; + var link = "(Updated link coming soon)"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } @@ -3106,7 +3107,7 @@ if (basicBot.settings.bouncerPlus) msg += 'ON'; else msg += 'OFF'; msg += '. '; - + msg += basicBot.chat.blacklist + ': '; if (basicBot.settings.blacklistEnabled) msg += 'ON'; else msg += 'OFF'; @@ -3148,7 +3149,7 @@ msg += '. '; msg += basicBot.chat.autoskip + ': '; - if (basicBot.room.autoskip) msg += 'ON'; + if (basicBot.settings.autoskip) msg += 'ON'; else msg += 'OFF'; msg += '. '; @@ -3283,7 +3284,7 @@ } } }, - + togglemotdCommand: { command: 'togglemotd', rank: 'bouncer', @@ -3326,7 +3327,7 @@ unbanCommand: { command: 'unban', - rank: 'mod', + rank: 'bouncer', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From fa03c19ef3268f3e137470c4959d1666bdf97313 Mon Sep 17 00:00:00 2001 From: jbarney86 Date: Tue, 14 Jul 2015 01:30:53 -0600 Subject: [PATCH 43/59] Update basicBot.js --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index dfcc85c8..43876124 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2295,7 +2295,7 @@ if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); if (!basicBot.commands.executable(this.rank, chat)) return void (0); else { - var link = "(Updated link coming soon)"; + var link = "http://i.imgur.com/RJnr0d9.jpg"; API.sendChat(subChat(basicBot.chat.starterhelp, {link: link})); } } From 5df79f6b1fbaa9b928f9a12943988c5477c9343f Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Sun, 9 Aug 2015 18:11:22 +0100 Subject: [PATCH 44/59] Change roulette to only work for managers Only managers can start roulette now, even on bouncer+ --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 43876124..049098b4 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2937,7 +2937,7 @@ rouletteCommand: { command: 'roulette', - rank: 'mod', + rank: 'manager', type: 'exact', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From 6820c9ee3b321b8538e2a79daed0c43e5af67373 Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Sun, 9 Aug 2015 19:18:27 +0100 Subject: [PATCH 45/59] change the permission of !lock !lockdown and !welcome from bouncer+ to manager --- basicBot.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basicBot.js b/basicBot.js index 049098b4..831c06af 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2499,7 +2499,7 @@ lockCommand: { command: 'lock', - rank: 'mod', + rank: 'manager', type: 'exact', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -2512,7 +2512,7 @@ lockdownCommand: { command: 'lockdown', - rank: 'mod', + rank: 'manager', type: 'exact', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); @@ -3516,7 +3516,7 @@ welcomeCommand: { command: 'welcome', - rank: 'mod', + rank: 'manager', type: 'exact', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From aa4323cd2c716764e81e05c582aabfb876e7b042 Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Sat, 15 Aug 2015 18:13:28 +0100 Subject: [PATCH 46/59] reporting to slack: hourly users, bans,kicks and mutes --- basicBot.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/basicBot.js b/basicBot.js index 831c06af..6287813b 100644 --- a/basicBot.js +++ b/basicBot.js @@ -28,6 +28,7 @@ var kill = function () { clearInterval(basicBot.room.autodisableInterval); clearInterval(basicBot.room.afkInterval); + clearInterval(basicBot.room.slackInterval); basicBot.status = false; }; @@ -231,6 +232,11 @@ return str; }; + var sendSlack = function(text) { + $.post("https://hooks.slack.com/services/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", + {payload:'{"text":"'+text+'"}'}); + }; + var botCreator = "Matthew (Yemasthui)"; var botMaintainer = "Benzi (Quoona)" var botCreatorIDs = ["3851534", "4105209"]; @@ -823,6 +829,11 @@ }); } return list; + }, + reportUsersSlack: function() { + numberUsers=API.getUsers().length; + numberDjs=API.getWaitList().length; + sendSlack("Users: "+numberUsers+"\nWaitlist: "+numberDjs); } }, eventChat: function (chat) { @@ -1411,6 +1422,9 @@ basicBot.room.autodisableInterval = setInterval(function () { basicBot.room.autodisableFunc(); }, 60 * 60 * 1000); + basicBot.room.slackInterval = setInterval(function(){ + basicBot.roomUtilities.reportUsersSlack(); + },60*60*1000) basicBot.loggedInID = API.getUser().id; basicBot.status = true; API.sendChat('/cap ' + basicBot.settings.startupCap); @@ -1746,6 +1760,7 @@ var user = basicBot.userUtilities.lookupUserName(name); if (typeof user === 'boolean') return API.sendChat(subChat(basicBot.chat.invaliduserspecified, {name: chat.un})); API.moderateBanUser(user.id, 1, API.BAN.DAY); + sendSlack("!ban: "+chat.un+" banned "+name); } } }, @@ -2393,6 +2408,7 @@ API.sendChat(subChat(basicBot.chat.kick, {name: chat.un, username: name, time: time})); if (time > 24 * 60 * 60) API.moderateBanUser(user.id, 1, API.BAN.PERMA); else API.moderateBanUser(user.id, 1, API.BAN.DAY); + sendSlack("!kick: "+chat.un+" kicked "+name+" for "+time+" minutes"); setTimeout(function (id, name) { API.moderateUnbanUser(id); console.log('Unbanned @' + name + '. (' + id + ')'); @@ -2808,10 +2824,12 @@ else { API.moderateMuteUser(user.id, 1, API.MUTE.SHORT); API.sendChat(subChat(basicBot.chat.mutedtime, {name: chat.un, username: name, time: time})); + setTimeout(function (id) { API.moderateUnmuteUser(id); }, time * 60 * 1000, user.id); } + sendSlack("!mute: "+chat.un+" muted "+name+" for "+time+" minutes"); } else API.sendChat(subChat(basicBot.chat.muterank, {name: chat.un})); } From b4abdb7b1b2f31479ba369e3fdc3221429e2dad4 Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Sat, 15 Aug 2015 18:21:59 +0100 Subject: [PATCH 47/59] fix explicit variable declaration and remove an extra comma --- basicBot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/basicBot.js b/basicBot.js index 6287813b..6603182a 100644 --- a/basicBot.js +++ b/basicBot.js @@ -327,6 +327,7 @@ usercommand: true, allcommand: true, afkInterval: null, + slackInterval: null, //autoskip: false, autoskipTimer: null, autodisableInterval: null, @@ -831,8 +832,8 @@ return list; }, reportUsersSlack: function() { - numberUsers=API.getUsers().length; - numberDjs=API.getWaitList().length; + var numberUsers=API.getUsers().length; + var numberDjs=API.getWaitList().length; sendSlack("Users: "+numberUsers+"\nWaitlist: "+numberDjs); } }, @@ -1313,7 +1314,7 @@ eventVoteskip: $.proxy(this.eventVoteskip, this), eventModskip: $.proxy(this.eventModskip, this), eventChatcommand: $.proxy(this.eventChatcommand, this), - eventHistoryupdate: $.proxy(this.eventHistoryupdate, this), + eventHistoryupdate: $.proxy(this.eventHistoryupdate, this) }; API.on(API.CHAT, this.proxy.eventChat); From f07dc7153fb312ca6a00d348b8d9ff0ce08f641b Mon Sep 17 00:00:00 2001 From: fviii Date: Sat, 15 Aug 2015 17:42:50 -0400 Subject: [PATCH 48/59] Update basicBot.js Changed !ban to only work for the host rank or higher. --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 831c06af..b83faa60 100644 --- a/basicBot.js +++ b/basicBot.js @@ -1734,7 +1734,7 @@ banCommand: { command: 'ban', - rank: 'bouncer', + rank: 'host', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From 4bf3da160fdf5793d8a5214590bbfd6b914b2021 Mon Sep 17 00:00:00 2001 From: fviii Date: Sun, 16 Aug 2015 04:17:06 -0400 Subject: [PATCH 49/59] Update basicBot.js Changed the !kick command permission to host only since BB isn't unbanning afterwords. Bouncers are using this to kick autojoiners who keep joining after BB removes them, and people are wondering what's up when they can't come back the following day. --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index 831c06af..a4ee7a74 100644 --- a/basicBot.js +++ b/basicBot.js @@ -2360,7 +2360,7 @@ kickCommand: { command: 'kick', - rank: 'bouncer', + rank: 'host', type: 'startsWith', functionality: function (chat, cmd) { if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); From 5bf4511ced7c2ffc25aa9e6dff1e7992106217fe Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Mon, 17 Aug 2015 17:42:44 +0100 Subject: [PATCH 50/59] change the language files to our repository. Update autowoot message to recommend RCS --- basicBot.js | 16 ++++++++-------- lang/en.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/basicBot.js b/basicBot.js index c30bd1d9..a800529c 100644 --- a/basicBot.js +++ b/basicBot.js @@ -100,7 +100,7 @@ var loadChat = function (cb) { if (!cb) cb = function () { }; - $.get("https://rawgit.com/Yemasthui/basicBot/master/lang/langIndex.json", function (json) { + $.get("https://rawgit.com/Masterjh/basicBot/master/lang/langIndex.json", function (json) { var link = basicBot.chatLink; if (json !== null && typeof json !== "undefined") { langIndex = json; @@ -246,9 +246,9 @@ status: false, name: "basicBot", loggedInID: null, - scriptLink: "https://rawgit.com/Yemasthui/basicBot/master/basicBot.js", + scriptLink: "https://rawgit.com/Masterjh/basicBot/master/basicBot.js", cmdLink: "http://git.io/245Ppg", - chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", + chatLink: "https://rawgit.com/Masterjh/basicBot/master/lang/en.json", chat: null, loadChat: loadChat, retrieveSettings: retrieveSettings, @@ -256,7 +256,7 @@ settings: { botName: "basicBot", language: "english", - chatLink: "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", + chatLink: "https://rawgit.com/Masterjh/basicBot/master/lang/en.json", roomLock: false, // Requires an extension to re-load the script startupCap: 1, // 1-200 startupVolume: 0, // 0-100 @@ -312,9 +312,9 @@ songstats: true, commandLiteral: "!", blacklists: { - NSFW: "https://rawgit.com/Yemasthui/basicBot-customization/master/blacklists/NSFWlist.json", - OP: "https://rawgit.com/Yemasthui/basicBot-customization/master/blacklists/OPlist.json", - BANNED: "https://rawgit.com/Yemasthui/basicBot-customization/master/blacklists/BANNEDlist.json" + NSFW: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/NSFWlist.json", + OP: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/OPlist.json", + BANNED: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/BANNEDlist.json" } }, room: { @@ -2451,7 +2451,7 @@ if (msg.length <= cmd.length + 1) return API.sendChat(subChat(basicBot.chat.currentlang, {language: basicBot.settings.language})); var argument = msg.substring(cmd.length + 1); - $.get("https://rawgit.com/Yemasthui/basicBot/master/lang/langIndex.json", function (json) { + $.get("https://rawgit.com/Masterjh/basicBot/master/lang/langIndex.json", function (json) { var langIndex = json; var link = langIndex[argument.toLowerCase()]; if (typeof link === "undefined") { diff --git a/lang/en.json b/lang/en.json index 2d7176e7..6a1870ee 100644 --- a/lang/en.json +++ b/lang/en.json @@ -91,7 +91,7 @@ "askskip": "\/me @%%NAME%%, don't ask for skips.", "spam": "\/me @%%NAME%%, please don't spam.", "roomadvertising": "\/me @%%NAME%%, don't post links to other rooms please.", - "adfly": "\/me @%%NAME%%, please change your autowoot program. We suggest PlugCubed: http:\/\/plugcubed.net\/", + "adfly": "\/me @%%NAME%%, please change your autowoot program. We suggest RCS: http:\/\/rcs.radiant.dj\/", "validgiftags": "\/me [@%%NAME%%] http:\/\/media.giphy.com\/media\/%%ID%%\/giphy.gif [Tags: %%TAGS%%]", "invalidgiftags": "\/me [@%%NAME%%] Invalid tags, try something different. [Tags: %%TAGS%%]", "validgifrandom": "\/me [@%%NAME%%] http:\/\/media.giphy.com\/media\/%%ID%%\/giphy.gif [Random GIF]", @@ -138,7 +138,7 @@ "afkstatusreset": "\/me [@%%NAME%%] Reset the afk status of @%%USERNAME%%.", "inactivefor": "\/me [@%%NAME%%] @%%USERNAME%% has been inactive for %%TIME%%.", "inactivelonger": "\/me [@%%NAME%%] @%%USERNAME%% has been inactive longer than %%BOTNAME%%'s been online.", - "autowoot": "\/me We recommend PlugCubed for autowooting: http:\/\/plugcubed.net\/", + "autowoot": "\/me We recommend RCS for autowooting: http:\/\/rcs.radiant.dj\/", "brandambassador": "\/me A Brand Ambassador is the voice of the plug.dj users. They promote events, engage the community and share the plug.dj message around the world. For more info: https:\/\/plug.dj\/ba", "bouncerplusrank": "\/me [@%%NAME%%] You have to be manager or up to enable Bouncer+.", "chatcleared": "\/me [@%%NAME%%] Cleared the chat.", From 1a3a8b140047bcf1b04121b11d5d708aa5ec7974 Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Mon, 17 Aug 2015 22:53:44 +0100 Subject: [PATCH 51/59] add allowSong command --- basicBot.js | 28 ++++++++++++++++++++++++++-- lang/en.json | 3 ++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/basicBot.js b/basicBot.js index a800529c..7fcf8dbf 100644 --- a/basicBot.js +++ b/basicBot.js @@ -413,6 +413,7 @@ songCount: 0 }; this.lastKnownPosition = null; + this.allowSong=false; }, userUtilities: { getJointime: function (user) { @@ -952,7 +953,8 @@ $("#woot").click(); // autowoot } - var user = basicBot.userUtilities.lookupUser(obj.dj.id) + var user = basicBot.userUtilities.lookupUser(obj.dj.id); + var allowSong = false; for(var i = 0; i < basicBot.room.users.length; i++){ if(basicBot.room.users[i].id === user.id){ basicBot.room.users[i].lastDC = { @@ -960,6 +962,8 @@ position: null, songCount: 0 }; + allowSong = basicbot.room.users[i].allowSong; + basicbot.room.users[i].allowSong = false; } } @@ -998,7 +1002,7 @@ }, 2000); var newMedia = obj.media; var timeLimitSkip = setTimeout(function () { - if (basicBot.settings.timeGuard && newMedia.duration > basicBot.settings.maximumSongLength * 60 && !basicBot.room.roomevent) { + if (basicBot.settings.timeGuard && newMedia.duration > basicBot.settings.maximumSongLength * 60 && !basicBot.room.roomevent && !allowSong ) { var name = obj.dj.username; API.sendChat(subChat(basicBot.chat.timelimit, {name: name, maxlength: basicBot.settings.maximumSongLength})); if (basicBot.settings.smartSkip){ @@ -1660,6 +1664,26 @@ } }, + allowsongCommand: { + command: 'allowsong', + rank: 'mod', + type: 'startsWith', + functionality: function (chat, cmd) { + if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0); + if (!basicBot.commands.executable(this.rank, chat)) return void (0); + else { + var msg = chat.message; + if (msg.length === cmd.length) return API.sendChat(subChat(basicBot.chat.nouserspecified, {name: chat.un})); + var name; + name = msg.substring(cmd.length + 2); + var user = basicBot.userUtilities.lookupUserName(name); + if (typeof user === 'boolean') return API.sendChat(subChat(basicBot.chat.invaliduserspecified, {name: chat.un})); + user.allowSong=true; + return API.sendChat(subChat(basicBot.chat.allownextsong, {name: user.username})); + } + } + }, + autodisableCommand: { command: 'autodisable', rank: 'bouncer', diff --git a/lang/en.json b/lang/en.json index 6a1870ee..81079ed3 100644 --- a/lang/en.json +++ b/lang/en.json @@ -200,5 +200,6 @@ "voteratio": "\/me [@%%NAME%%] @%%USERNAME%% ~ woots: %%WOOT%%, mehs: %%MEHS%%, ratio (w\/m): %%RATIO%%.", "website": "\/me Please visit our website: %%LINK%%", "youtube": "\/me [%%NAME%%] Subscribe to us on youtube: %%LINK%%", - "songstatistics": "\/me %%ARTIST%% - %%TITLE%%: %%WOOTS%%W\/%%GRABS%%G\/%%MEHS%%M." + "songstatistics": "\/me %%ARTIST%% - %%TITLE%%: %%WOOTS%%W\/%%GRABS%%G\/%%MEHS%%M.", + "allownextsong": "\/me Allowing next song by @%%NAME%% to be played over limit." } From daea06a5cad84ad73456cbb3f000aa6ea93efcf6 Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Mon, 17 Aug 2015 23:07:55 +0100 Subject: [PATCH 52/59] set user.allowsong on lookupcycle --- basicBot.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/basicBot.js b/basicBot.js index 7fcf8dbf..e23f9ec1 100644 --- a/basicBot.js +++ b/basicBot.js @@ -461,6 +461,16 @@ } return false; }, + allowSong: function (name) { + for (var i = 0; i < basicBot.room.users.length; i++) { + var match = basicBot.room.users[i].username.trim() == name.trim(); + if (match) { + basicBot.room.users[i].allowSong = true; + return basicBot.room.users[i]; + } + } + return false; + }, voteRatio: function (id) { var user = basicBot.userUtilities.lookupUser(id); var votes = user.votes; @@ -1676,9 +1686,8 @@ if (msg.length === cmd.length) return API.sendChat(subChat(basicBot.chat.nouserspecified, {name: chat.un})); var name; name = msg.substring(cmd.length + 2); - var user = basicBot.userUtilities.lookupUserName(name); + var user = basicBot.userUtilities.allowSong(name); if (typeof user === 'boolean') return API.sendChat(subChat(basicBot.chat.invaliduserspecified, {name: chat.un})); - user.allowSong=true; return API.sendChat(subChat(basicBot.chat.allownextsong, {name: user.username})); } } From 4e8c1d845b53667da5ae1603350ac6b07f3f66a0 Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Tue, 18 Aug 2015 21:47:57 +0100 Subject: [PATCH 53/59] add roulette logging to slack --- basicBot.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index a800529c..4132681c 100644 --- a/basicBot.js +++ b/basicBot.js @@ -379,12 +379,14 @@ }, endRoulette: function () { basicBot.room.roulette.rouletteStatus = false; - var ind = Math.floor(Math.random() * basicBot.room.roulette.participants.length); + var participants = basicBot.room.roulette.participants.length; + var ind = Math.floor(Math.random() * participants); var winner = basicBot.room.roulette.participants[ind]; basicBot.room.roulette.participants = []; var pos = Math.floor((Math.random() * API.getWaitList().length) + 1); var user = basicBot.userUtilities.lookupUser(winner); var name = user.username; + sendSlack("Roulette: "+name+" won position "+pos+" (was "+user.lastKnownPosition+"), with "+participants+" participants"); API.sendChat(subChat(basicBot.chat.winnerpicked, {name: name, position: pos})); setTimeout(function (winner, pos) { basicBot.userUtilities.moveUser(winner, pos, false); From 2abc8ac13a6d1a1a019d27aa799145e58e24405c Mon Sep 17 00:00:00 2001 From: Diogo Basto Date: Fri, 21 Aug 2015 14:32:31 +0100 Subject: [PATCH 54/59] fix the language files link --- lang/langIndex.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/langIndex.json b/lang/langIndex.json index 894113af..0f70d2dc 100644 --- a/lang/langIndex.json +++ b/lang/langIndex.json @@ -1,5 +1,5 @@ { - "english": "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", - "portuguese": "https://rawgit.com/Yemasthui/basicBot/master/lang/pt.json", - "french": "https://rawgit.com/Yemasthui/basicBot/master/lang/fr.json" + "english": "https://rawgit.com/Masterjh/basicBot/master/lang/en.json", + "portuguese": "https://rawgit.com/Masterjh/basicBot/master/lang/pt.json", + "french": "https://rawgit.com/Masterjh/basicBot/master/lang/fr.json" } \ No newline at end of file From 5ee9c975ebec7ea6d756d96bd4fa617c90c2b860 Mon Sep 17 00:00:00 2001 From: Masterjh Date: Fri, 28 Aug 2015 14:48:20 +0100 Subject: [PATCH 55/59] Revert "fix the language files link" --- lang/langIndex.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/langIndex.json b/lang/langIndex.json index 0f70d2dc..894113af 100644 --- a/lang/langIndex.json +++ b/lang/langIndex.json @@ -1,5 +1,5 @@ { - "english": "https://rawgit.com/Masterjh/basicBot/master/lang/en.json", - "portuguese": "https://rawgit.com/Masterjh/basicBot/master/lang/pt.json", - "french": "https://rawgit.com/Masterjh/basicBot/master/lang/fr.json" + "english": "https://rawgit.com/Yemasthui/basicBot/master/lang/en.json", + "portuguese": "https://rawgit.com/Yemasthui/basicBot/master/lang/pt.json", + "french": "https://rawgit.com/Yemasthui/basicBot/master/lang/fr.json" } \ No newline at end of file From 4bb13a06ff30a97a8c5ac8094edec4d3f88fc656 Mon Sep 17 00:00:00 2001 From: fviii Date: Thu, 3 Sep 2015 21:13:13 -0400 Subject: [PATCH 56/59] Update basicBot.js A link to a blacklist file I'm trying out. --- basicBot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/basicBot.js b/basicBot.js index be417a1a..d11199d0 100644 --- a/basicBot.js +++ b/basicBot.js @@ -312,6 +312,7 @@ songstats: true, commandLiteral: "!", blacklists: { + TEST: "https://rawgit.com/fviii/basicBot/blob/master/bl.json" NSFW: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/NSFWlist.json", OP: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/OPlist.json", BANNED: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/BANNEDlist.json" From e70f9296c5486b05cd0801dea746bee33c5116b7 Mon Sep 17 00:00:00 2001 From: fviii Date: Fri, 4 Sep 2015 23:12:13 -0400 Subject: [PATCH 57/59] Update basicBot.js Changed the !commands link to the correct to take you to the correct page. --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index d11199d0..690fd907 100644 --- a/basicBot.js +++ b/basicBot.js @@ -247,7 +247,7 @@ name: "basicBot", loggedInID: null, scriptLink: "https://rawgit.com/Masterjh/basicBot/master/basicBot.js", - cmdLink: "http://git.io/245Ppg", + cmdLink: "http://git.io/vGxPG", chatLink: "https://rawgit.com/Masterjh/basicBot/master/lang/en.json", chat: null, loadChat: loadChat, From 88e74a2d222b0c3bb4dfeeb73c258e15d8df71b9 Mon Sep 17 00:00:00 2001 From: fviii Date: Sun, 6 Sep 2015 04:36:51 -0400 Subject: [PATCH 58/59] Update basicBot.js Forgot a comma.. The syntax error directed me to line 316 and then I noticed the missing comma. Bot should function again, I hope. --- basicBot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basicBot.js b/basicBot.js index d11199d0..aee0bdb5 100644 --- a/basicBot.js +++ b/basicBot.js @@ -312,7 +312,7 @@ songstats: true, commandLiteral: "!", blacklists: { - TEST: "https://rawgit.com/fviii/basicBot/blob/master/bl.json" + TEST: "https://rawgit.com/fviii/basicBot/blob/master/bl.json", NSFW: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/NSFWlist.json", OP: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/OPlist.json", BANNED: "https://rawgit.com/Masterjh/basicBot-customization/master/blacklists/BANNEDlist.json" From 17ebf67f3ab9971979b67a7ca34a9ea5b67f100d Mon Sep 17 00:00:00 2001 From: fviii Date: Thu, 10 Sep 2015 23:22:26 -0400 Subject: [PATCH 59/59] Update commands.md Added !swap to the bouncer+ command list and moved !roulette up to the manager list to reflect changes. --- commands.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands.md b/commands.md index 7395be83..1249d4c5 100644 --- a/commands.md +++ b/commands.md @@ -16,6 +16,7 @@ Manager |!cycletimer | X | set the maximum DJ cycle time for when cycleguard is enabled | |!locktimer | X | set the maximum time the waitlist can be locked if lockguard is enabled | |!refresh | | refreshes the browser of whoever runs the bot | +|!roulette | | start a roulette | |!usercmdcd | X | set the cooldown on commands by grey users | |!usercommands | | toggle user commands | |!voteskip | (X) | when no argument is specified, returns the current voteskip limit, when X is specified, voteskip limit is updated to the new specified limit. | @@ -35,8 +36,8 @@ Bouncer+ |!maxlength | X | specify the maximum length a song can be when timeguard is enabled | |!move | @user (X) | moves user to position X on the waitlist, default is position 1 | |!remove | @user | remove user from the waitlist | -|!roulette | | start a roulette | |!songstats | | toggle song statistics | +|!swap | @user @user | swaps positions of two users | |!unlock | | unlock the waitlist | |!welcome | | toggle the welcome message on user join |