Created
October 8, 2020 02:39
-
-
Save sell/57bd6cd55a74d3f2e2451440d2606022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { WebhookClient, MessageEmbed } = require('discord.js'); | |
module.exports = { | |
name: 'suggestion', | |
run: async (client, message, args) => { | |
message.delete(); | |
const webhookClient = new WebhookClient('763575635502694400', 'ep7fmt9ZBTgJg2fmQ8oohUmtNauRCcyGMx7pHGMlovp7dwQGKoz6FNWobbnX5bEU2-9V'); | |
const filter = (m) => m.author.id === message.author.id; | |
const embed = new MessageEmbed() | |
.setTitle('What is your Suggestion?') | |
.setColor('#ff0000'); | |
message.channel.send(embed).then((m) => { | |
message.channel.awaitMessages(filter, {max: 1, time: 60000, errors: ['time']}) | |
.then(collected => { | |
m.edit(embed.setTitle('Thanks for your suggestions.').setColor('#00ff00')) | |
embed.setTitle('New Suggestion'); | |
embed.setColor('#00ff00'); | |
embed.setDescription(collected.first().content) | |
webhookClient.send({ | |
username: collected.first().author.username, | |
avatarURL: collected.first().author.displayAvatarURL({dynamic: true}), | |
embeds: [embed], | |
}); | |
collected.first().delete(); | |
}) | |
.catch(e => { | |
message.delete(); | |
message.channel.send('you took too long').then(m => m.delete({timeout: 5000})) | |
}) | |
}) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (message.channel.id === '729499947308810331' && message.webhookID) { | |
await message.react('✅') | |
await message.react('❌') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment