From bd0984eb69f1c9e6c8bb98bd73cc31d12f1a4eec Mon Sep 17 00:00:00 2001 From: Keanu Date: Mon, 17 Aug 2020 17:38:15 +0000 Subject: [PATCH] Moved poll command to fun category. --- .gitignore | 3 ++- src/commands/fun/poll.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/commands/fun/poll.ts diff --git a/.gitignore b/.gitignore index 2a0491a..f15e293 100644 --- a/.gitignore +++ b/.gitignore @@ -65,4 +65,5 @@ typings/ # dotenv environment variables file .env -config.json \ No newline at end of file +config.json +.vscode/ \ No newline at end of file diff --git a/src/commands/fun/poll.ts b/src/commands/fun/poll.ts new file mode 100644 index 0000000..d1f0e15 --- /dev/null +++ b/src/commands/fun/poll.ts @@ -0,0 +1,26 @@ +import { MessageEmbed } from "discord.js"; +import Command from "../../core/command"; +import {CommonLibrary} from "../../core/lib"; + +export default new Command({ + description: "Create a poll.", + usage: "", + run: "Please provide a question.", + any: new Command({ + description: "Question for the poll.", + async run($: CommonLibrary): Promise + { + const embed = new MessageEmbed() + .setAuthor(`Poll created by ${$.message.author.username}`, $.message.guild?.iconURL({ dynamic: true }) ?? undefined) + .setColor(0xffffff) + .setFooter("React to vote.") + .setDescription($.args.join(" ")); + const msg = await $.channel.send(embed); + await msg.react("✅"); + await msg.react("⛔"); + $.message.delete({ + timeout: 1000 + }); + } + }) +})