Created
November 20, 2017 04:36
-
-
Save cswl/9e43eb3517cad8594b64103e8f3480f6 to your computer and use it in GitHub Desktop.
t!fish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Discord = require('discord.io'); | |
var bot = new Discord.Client({ | |
autorun: true, | |
// your discord token | |
token: "" | |
}); | |
var count = 0; | |
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1) + min); | |
} | |
bot.on('ready', function(event) { | |
console.log('Logged in as %s - %s\n', bot.username, bot.id); | |
}); | |
bot.on('message', function(user, userID, channelID, message, event) { | |
if (message === "!fishstart") { | |
setInterval(function () { | |
bot.sendMessage({ | |
to: channelID, | |
message: "t!fish" | |
}); | |
count++; | |
console.log("Count= ", count) | |
if(count % 20 === 0 ) { | |
setTimeout(function() { | |
bot.sendMessage({ | |
to: channelID, | |
message: "t!fish sell common" | |
}); | |
console.log("Sold common at ", count) | |
}, 6*1000); | |
} | |
else if (count % 21 === 0 ) { | |
setTimeout(function() { | |
bot.sendMessage({ | |
to: channelID, | |
message: "t!fish sell uncommon" | |
}); | |
console.log("Sold uncommon at ", count) | |
}, 6*1000); | |
} | |
else if (count % 22 === 0 ) { | |
setTimeout(function() { | |
bot.sendMessage({ | |
to: channelID, | |
message: "t!fish sell garbage" | |
}); | |
console.log("Sold garbage at ", count) | |
}, 6*1000); | |
} | |
}, 31 * 1000); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment