Learn to Code via Tutorials on Repl.it!

← Back to all posts
DISCORD.JS poll command
h
Bruno08432190

// Load modules
const Discord = require("discord.js"),
backup = require("discord-backup"),
client = new Discord.Client(),

settings = {
prefix: "YOUR-PREFIX",
token: "YOUR-TOKEN"
};
require('http').createServer((req, res) => res.end(Bot online)).listen(3000);

function presence(){
client.user.setPresence({
status:"online",
activity: {
name: "how to make a poll command",
type: "WATCHING"
}
})
}
client.once('ready', () => {
console.log("Ready!");
presence();
});

client.on("message", async message => {

if(command === "poll"){

let msgArgs = args.join(' ')
if(!msgArgs) return message.channel.send("You need write something").then(message => message.delete({ timeout: 5000 }))
message.delete().catch()
message.channel.send(msgArgs + "?").then(messageReaction => {
messageReaction.react("✅")
messageReaction.react("❎")
})
}
});
client.login(settings.token);

Voters
eduardogarza4
VIDAcz
Bruno08432190