TravBot-v3/src/commands/fun/poll.ts

28 lines
951 B
TypeScript
Raw Normal View History

2020-12-15 01:44:28 +00:00
import {MessageEmbed} from "discord.js";
import {Command, NamedCommand} from "../../core";
2020-08-17 17:38:15 +00:00
export default new NamedCommand({
2020-12-15 01:44:28 +00:00
description: "Create a poll.",
usage: "<question>",
run: "Please provide a question.",
any: new Command({
description: "Question for the poll.",
async run({message, channel, guild, author, member, client, args}) {
2020-12-15 01:44:28 +00:00
const embed = new MessageEmbed()
.setAuthor(
`Poll created by ${message.author.username}`,
message.guild?.iconURL({dynamic: true}) ?? undefined
2020-12-15 01:44:28 +00:00
)
.setColor(0xffffff)
.setFooter("React to vote.")
.setDescription(args.join(" "));
const msg = await channel.send(embed);
2020-12-15 01:44:28 +00:00
await msg.react("✅");
await msg.react("⛔");
message.delete({
2020-12-15 01:44:28 +00:00
timeout: 1000
});
}
})
2020-10-15 09:23:24 +00:00
});