Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Declarables:
- var buttCounter = 0;
- var buttAllow = false;
- var wordCounter = 0;
- var buttLineLength = 0;
- var res = "";
- //Start command, my thing scans every message and only responds to things starting where the first word is something (splittext[0])
- else if (splittext[0] === "!poyofy") {
- if ((user['display-name'] === "Riekeltje") || (user['user-type'] === "mod")) {
- //This toggles the automatic poyofyer
- if (splittext[1] === "on") {
- buttAllow = true;
- throttledSendMessage(channel, "The poyos are active");
- } else if (splittext[1] === "off") {
- buttAllow = false;
- throttledSendMessage(channel, "The poyos are not active anymore.");
- } else {
- //This part... It's been a while and I have no idea why this code is double... :thinking:
- //--
- buttLineLength = splittext.length;
- if (buttLineLength > 2) {
- res = randomIntInc(buttLineLength, 1);
- message = message.replace(splittext[res - 1], "poyo");
- message = message.slice(6);
- throttledSendMessage(channel, message);
- buttCounter = 0;
- } else {}
- //--
- }
- } else {
- //--x
- buttLineLength = splittext.length;
- if (buttLineLength > 2) {
- res = randomIntInc(buttLineLength, 1);
- message = message.replace(splittext[res - 1], "poyo");
- message = message.slice(6);
- throttledSendMessage(channel, message);
- buttCounter = 0;
- } else {}
- //--
- }
- }
- //REST OF COMMANDS
- //Else if no real command is toggled
- } else {
- //After being activated, waits 35 lines until it does the rest again
- if (buttCounter > 35) {
- //If !poyofy is on
- if (buttAllow === true) {
- //After the 35 lines, there is a 10% chance the script triggers
- if (randomIntInc(100, 1) > 90) {
- buttLineLength = splittext.length;
- if (buttLineLength > 2) {
- res = randomIntInc(buttLineLength, 1);
- message = message.replace(splittext[res - 1], "poyo");
- throttledSendMessage(channel, message);
- buttCounter = 0;
- } else {}
- }
- } else {}
- } else {
- buttCounter++;
- }
- }
- function randomIntInc(high, low) {
- return Math.floor(Math.random() * (high - low + 1) + low);
- }
- //throttledsendmessage makes sure that only 1 message can be send every 5 seconds, you can ignore all of this.
- var throttledSendMessage = _.throttle(function(channel, message) {
- client.say(channel, message);
- }, 5000, {
- leading: true,
- trailing: false
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement