Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- module.exports = class request {
- // Command Handler
- constructor() {
- this.name = 'request',
- // Name of command
- this.alias = [''],
- // Alias of Command
- this.usage = 'request';
- // Main Command
- }
- run(bot, message, args) {
- // Embed Design
- const Embed = new Discord.RichEmbed()
- .setAuthor("New Request Approval")
- .setFooter("Hangout Manager v1.0.0")
- .setDescription("A new user has requested approval to the discord server.\n" +
- "React with <a:Agree:645279978929258506> to Approve\n" +
- "React with <a:Disagree:645279979650809856> to Deny.")
- .addField("User ", `<@${message.author.id}>`, true)
- .addField("Id", `${message.author.id}`, true);
- // If command is sent outside of #waiting-lobby
- if (message.channel.id != '645302564409311232') {
- message.channel.send(`<@${message.author.id}>, You cannot use this command here.`);
- return;
- } else {
- bot.channels.get("645306384975659012").send(Embed).then(m => {
- message.delete();
- // Add reactions
- m.react('✅').then(() =>
- m.react('⛔'));
- // Tell the message author it was sent.
- message.author.send("I have sent your approval request to admins, Please be patient. <a:PanGLoveP:644305939222102057>");
- // Start the timer for the wait until it gets the Agree Reaction.
- const accepted = m.awaitReactions(reaction => reaction.name === 'white_check_mark', { max: 2, time: 10000 }).then((collected1) => {
- if (collected1.first() === 'white_check_mark') {
- Embed.setDescription("**Status:** Accepted <a:Agree:645279978929258506>");
- message.member.removeRole('645299990654222396');
- // If they don't have Approved Role, Give it.
- message.member.addRole('609324765798465546');
- // Tell the Command Author they were accepted.
- message.author.send('You have been accepted into Ori\'s Hangout! Please read <#608906752175374336> and <#608982522269007885>');
- m.clearReactions();
- m.edit(Embed);
- }
- }).catch(() => message.author.send(`<@${message.author.id}>, Your application did not gain a response after 24 Hours.\nFeel Free to send another application with "!request"`));
- break;
- // Start the time for the wait until it gets the Disagree Reaction.
- const denied = m.awaitReactions(reaction => reaction.name === 'no_entry', { max: 2, time: 10000 }).then((collected2) => {
- if (collected2.first() === 'no_entry') {
- Embed.setDescription("**Status:** Denied <a:Disagree:645279979650809856>");
- message.author.send('You were denied into Ori\'s Hangout. <a:Disagree:645279979650809856>');
- message.member.kick();
- m.clearReactions();
- m.edit(Embed);
- }
- });
- });
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement