Advertisement
n3k4a

Untitled

May 6th, 2019
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. const Command = require(`${process.cwd()}/base/Command.js`);
  2.  
  3. class karaoke extends Command {
  4. constructor(client) {
  5. super(client, {
  6. name: "karaoke",
  7. description: "Start a karaoke party!",
  8. usage: "karaoke",
  9. aliases: ["k"],
  10. permLevel: 1
  11. });
  12. }
  13.  
  14. async run(bot, msg, args, level) {
  15. let option = args[0];
  16. args.shift();
  17.  
  18. if (option == "open") {
  19. if (!msg.member.hasPermission("MANAGE_MESSAGES")) return;
  20. if (bot.karaokeInProgress)
  21. return msg.reply("a karaoke event is already in progress!");
  22.  
  23. bot.karaokeInProgress = true;
  24. bot.karaokeIsOpen = true;
  25. bot.karaokeQueue = [];
  26. bot.karaokeHost = msg.member;
  27. bot.karaokePerformer = null;
  28.  
  29. await msg.guild.roles.get("521746283447189524").setMentionable(true);
  30. await bot.channels
  31. .get("518940742194954291")
  32. .send(
  33. "🎤 Hey <@&521746283447189524>, it's time for another **KARAOKE PARTY!** Your host today will be " +
  34. bot.karaokeHost.toString() +
  35. "! We'll be starting in a few minutes, so do `/k join` to queue up and get ready to sing your hearts out!"
  36. );
  37. await msg.guild.roles.get("521746283447189524").setMentionable(false);
  38. } else if (option == "join") {
  39. if (!bot.karaokeInProgress)
  40. return msg.reply("there's no karaoke in progress right now :(");
  41. else if (!bot.karaokeIsOpen)
  42. return msg.reply("the queue is closed... maybe next time!");
  43. else if (bot.karaokeQueue.indexOf("<@" + msg.author.id + ">") > -1)
  44. return msg.reply("you're already in the queue!");
  45. else if (
  46. !msg.member.voice.channel ||
  47. msg.member.voice.channel.id != "517095011225960458"
  48. )
  49. return msg.reply("you aren't in the Karaoke voice channel!");
  50.  
  51. bot.karaokeQueue.push(msg.author);
  52. msg.reply(
  53. "you've been added to the queue at position " +
  54. bot.karaokeQueue.length +
  55. "! Current queue:",
  56. {
  57. embed: {
  58. title: "Karaoke Queue",
  59. description: "**Up Next:** " + bot.karaokeQueue.join("\n"),
  60. color: msg.guild.me.displayColor
  61. }
  62. }
  63. );
  64. } else if (option == "start" || option == "begin") {
  65. if (!msg.member.hasPermission("MANAGE_MESSAGES")) return;
  66. if (bot.karaokeQueue.length == 0)
  67. msg.reply("there aren't enough people in queue to begin!");
  68.  
  69. bot.karaokePerformer = bot.karaokeQueue.shift();
  70.  
  71. bot.channels
  72. .get("518940742194954291")
  73. .send(
  74. "🎉🎉🎉 LET THE PARTY BEGIN! First up: <@" +
  75. bot.karaokePerformer +
  76. ">!",
  77. {
  78. embed: {
  79. title: "Karaoke Queue",
  80. description: "**Up Next:** " + bot.karaokeQueue.join("\n"),
  81. color: msg.guild.me.displayColor
  82. }
  83. }
  84. );
  85. } else if (option == "close") {
  86. if (!msg.member.hasPermission("MANAGE_MESSAGES")) return;
  87. bot.karaokeIsOpen = false;
  88. bot.channels
  89. .get("518940742194954291")
  90. .send(
  91. "The karaoke queue has been closed! Thanks for coming, and join in next time!"
  92. );
  93. } else if (option == "next") {
  94. if (!msg.member.hasPermission("MANAGE_MESSAGES")) return;
  95. if (bot.karaokeQueue.length == 0)
  96. return msg.reply("there isn't anyone left in queue :(");
  97.  
  98. bot.lastPerformer = bot.karaokePerformer;
  99. bot.karaokePerformer = bot.karaokeQueue.shift();
  100.  
  101. bot.channels
  102. .get("518940742194954291")
  103. .send(
  104. "Thanks for an amazing performance, " +
  105. bot.lastPerformer +
  106. "! Next up: <@" +
  107. bot.karaokePerformer +
  108. ">!",
  109. {
  110. embed: {
  111. title: "Karaoke Queue",
  112. description: "**Up Next:** " + bot.karaokeQueue.join("\n"),
  113. color: msg.guild.me.displayColor
  114. }
  115. }
  116. );
  117. } else if (option == "end") {
  118. bot.channels
  119. .get("518940742194954291")
  120. .send(
  121. "Thanks for coming out to another great karaoke event! This one is now over, see you next time!"
  122. );
  123.  
  124. bot.karaokeInProgress = null;
  125. bot.karaokeIsOpen = null;
  126. bot.karaokeQueue = null;
  127. bot.karaokeHost = null;
  128. bot.karaokePerformer = null;
  129. } else if (option == "queue") {
  130. if (!bot.karaokeInProgress)
  131. return msg.reply("there's no karaoke in progress right now :(");
  132. let list = "";
  133. for (var i = 0; i < bot.karaokeQueue.length; i++) {
  134. list += "<@" + bot.karaokeQueue[i] + ">\n";
  135. }
  136. bot.channels.get("518940742194954291").send({
  137. embed: {
  138. title: "Karaoke Queue",
  139. description: "**Up Next:** " + list,
  140. color: msg.guild.me.displayColor
  141. }
  142. });
  143. }
  144. }
  145. }
  146.  
  147. module.exports = karaoke;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement