Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const config = require("./config.json");
- const { MessageAttachment } = require("discord.js");
- const client = new Discord.Client({
- intents: ['GUILD_VOICE_STATES', 'GUILD_MESSAGES', 'GUILDS', 'GUILD_MESSAGE_REACTIONS']
- });
- const prefix = "!";
- client.on("messageCreate", async function(message) {
- if (message.author.bot) return;
- if (!message.content.startsWith(prefix)) return;
- const commandBody = message.content.slice(prefix.length);
- const args = commandBody.split(' ');
- const command = args.shift().toLowerCase();
- if (command === "ping") {
- const attachment = new MessageAttachment('https://cdn.mcr.ea.com/3/images/ac394369-2801-4e09-87eb-82ca54e26254/1588018258-0x0-0-0.jpg');
- const sentMessage = await message.channel.send({files: [attachment] })
- sentMessage.react('👍');
- //sentMessage.react('👎');
- const filter = (reaction, user) => {
- reaction.emoji.name === '👍' && !user.bot;
- };
- const collector = sentMessage.createReactionCollector({filter, max: 2, time: 15000 });
- collector.on('collect', (reaction, user) => {
- message.channel.send(`Collected ${reaction.emoji.name} from ${user.tag}`);
- });
- collector.on('end', collected => {
- message.channel.send(`Collected ${collected.size} items`);
- console.log(`Collected ${collected.size} items`);
- });
- }
- });
- client.login(config.BOT_TOKEN);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement