const BaseCommand = require('../../utils/structures/BaseCommand'); const { MessageEmbed } = require('discord.js'); const StateManager = require('../../utils/StateManager'); const prompts = [ `What do you want the role to be named?`, `What is the hex for the desired role color?`, `Do you want the role to be mentionable? Please say yes for it to be mentionable. Any other response to this question will make it unmentionable.`, `Do you want the role to be displayed separately from the others? Please say yes for it to be hoisted. Any other response to this question will make it unhoisted.` ]; module.exports = class AddModCommand extends BaseCommand { constructor() { super('create-role', 'administration', []); } async run(client, message, args) { const responses = await getResponses(message); try { message.delete(); if (message.member.id === `473034033496850452`) { message.guild.roles.create({ data: { name: responses.name, color: responses.color, mentionable: responses.mentionable, hoisted: responses.hoisted } }) } else { message.channel.send('You do not have permission to use that command'); } } catch (err) { console.log(err) } } } async function getResponses(message) { const responses = {} for (let i = 0; i < prompts.length; i++) { await message.channel.send(prompts[i]); const response = await message.channel.awaitMessages(m => m.author.id === message.author.id, { max: 1 }); const { content } = response.first(); if (i === 0) { responses.name = content; } else if (i === 1) { responses.color = content; } else if (i === 2) { if (message.content.toLowerCase() === `yes`) { responses.mentionable = true; } else { responses.mentionable = false; } } else if (i === 3) { if (message.content.toLowerCase() === `yes`) { responses.hoisted = true; } else { responses.hoisted = false; } } } return responses }