Advertisement
iiFireKingii

Points (JS) quick.db

Dec 6th, 2019
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. client.on("message", async msg => {
  2. if(msg.author.bot || msg.channel.type === "dm") return undefined;
  3. let args = msg.content.split(' ');
  4. if(args[0].toLowerCase() == `${prefix}point`) {
  5. await db.fetch(`point_${msg.guild.id}_${msg.author.id}`)
  6. if(!args[1]) {
  7. let pp = db.fetchAll().valueOf(`point_${msg.guild.id}`, { sort: 'data'})
  8. let content = "";
  9. for(let i = 0; i < pp.length; i++) {
  10. let user = client.users.get(pp[i].ID.split('_')[2]).id
  11. content += `**\`#${i+1}\` | <@${user}> > \`${pp[i].data}\` Points**\n`
  12. }
  13. if(pp === null) return undefined;
  14. const embed = new Discord.RichEmbed()
  15. .setAuthor('Points:')
  16. .setDescription(content)
  17. .setColor("#36393e")
  18. msg.channel.send(embed)
  19. }
  20. }
  21. })
  22. client.on("message", async msg => {
  23. if(msg.author.bot || msg.channel.type === "dm") return undefined;
  24. let args = msg.content.split(' ');
  25. if(args[0].toLowerCase() == `${prefix}point+`) {
  26. let num = msg.content.split(" ")[2]
  27. var ss = msg.mentions.users.first();
  28. const err = new Discord.RichEmbed()
  29. .setDescription(`command: \`${prefix}point+ ${msg.author} 1\``)
  30. .setColor("BLUE")
  31. if(!num || !ss) return msg.channel.send(err)
  32. await db.fetch(`pointuser_${msg.guild.id}_${ss.id}`)
  33. msg.channel.send(`**βœ… | Done**`);
  34. db.add(`point_${msg.guild.id}_${ss.id}`, Number(num))
  35. }
  36. })
  37. client.on("message", async msg => {
  38. if(msg.author.bot || msg.channel.type === "dm") return undefined;
  39. let args = msg.content.split(' ');
  40. if(args[0].toLowerCase() == `${prefix}point-`) {
  41. let num = msg.content.split(" ")[2]
  42. var ss = msg.mentions.users.first();
  43. const err = new Discord.RichEmbed()
  44. .setDescription(`command: \`${prefix}point- ${msg.author} 1\``)
  45. .setColor("BLUE")
  46. if(!num || !ss) return msg.channel.send(err)
  47. let ssad = await db.fetch(`pointuser_${msg.guild.id}_${ss.id}`)
  48. if(ssad == 0) return msg.channel.send(`**❌ | Error**`);
  49. msg.channel.send(`**βœ… | Done**`);
  50. db.subtract(`point_${msg.guild.id}_${ss.id}`, Number(num))
  51. }
  52. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement