Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. bot.on("message", async message => {
  2. if(message.author.bot) return;
  3. if(message.channel.type === "dm") return;
  4.  
  5. if(!coins[message.author.id]){
  6. coins[message.author.id] = {
  7. coins: 0
  8. };
  9. }
  10.  
  11. if(message.channel.id == "612891550531452938" || "612891766986899456" || "612891577018351616" || "612891783801602088" || "612891985853939736" || "612892005756043265" || "612892019559497728" || "612892033878589443"){
  12.  
  13. if(!message.content.endsWith(".png") || message.content.endsWith(".jpg")) return
  14.  
  15. let baseAmt = Math.floor(Math.random() * 1) + 1;
  16. let coinAmt = Math.floor(Math.random() * 1) + 1;
  17. let cAmt = Math.floor(Math.random() * 25) + 1;
  18. console.log(`${baseAmt} : ${coinAmt}`)
  19.  
  20. if(coinAmt === baseAmt){
  21. coins[message.author.id] = {
  22. coins: coins[message.author.id].coins + cAmt
  23. };
  24. fs.writeFile("./coins.json", JSON.stringify(coins), (err) => {
  25. if (err) console.log(err)
  26. });
  27.  
  28. let coinEmbed = new Discord.RichEmbed()
  29. .setDescription("Paid!")
  30. .setColor("#15f153")
  31. .addField("Player Name", message.author.username)
  32. .addField("Coin amount", cAmt);
  33.  
  34. let sendChan = message.guild.channels.find(c => c.name == "transactions")
  35.  
  36. sendChan.send(coinEmbed)
  37. };
  38. }
  39.  
  40.  
  41. let prefix = botconfig.prefix;
  42. let messageArray = message.content.split(" ");
  43. let cmd = messageArray[0];
  44. let args = messageArray.slice(1);
  45.  
  46. if (message.content.startsWith(botconfig.prefix)) {
  47. let commandfile = bot.commands.get(cmd.slice(prefix.length));
  48. if(commandfile) commandfile.run(bot,message,args);
  49.  
  50. console.log(message.author + "has run a command!")
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement