summaryrefslogtreecommitdiff
path: root/src/commands/emma/verify.ts
diff options
context:
space:
mode:
author8cy <[email protected]>2020-07-07 03:55:21 -0700
committer8cy <[email protected]>2020-07-07 03:55:21 -0700
commit385b0960abdc8bb13172330a973dafd56560cf8d (patch)
tree86e85d23404a5170ffbf870a6faeba77b3430e0e /src/commands/emma/verify.ts
parentadd fanart for emma :star2: (diff)
downloaddep-core-385b0960abdc8bb13172330a973dafd56560cf8d.tar.xz
dep-core-385b0960abdc8bb13172330a973dafd56560cf8d.zip
big cool :star:
- add commenting to bot.ts - add types to most of the voice commands - add art and verify cmd for emma - add roastwilly cmd - fix rp cmd formatting
Diffstat (limited to 'src/commands/emma/verify.ts')
-rw-r--r--src/commands/emma/verify.ts54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/commands/emma/verify.ts b/src/commands/emma/verify.ts
new file mode 100644
index 0000000..6f4584a
--- /dev/null
+++ b/src/commands/emma/verify.ts
@@ -0,0 +1,54 @@
+import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
+//@ts-ignore
+import emoji from 'emoji-random';
+import Verify from '../../models/Verify';
+import mongo from 'mongoose';
+import config from '../../config.json';
+mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true })
+
+module.exports = class VerifyEmma extends Command {
+ constructor(client: CommandoClient) {
+ super(client, {
+ name: 'verify',
+ group: 'emma',
+ memberName: 'verify',
+ description: 'Lists all the roles on the current server.',
+ examples: ['uwu!verify set', 'uwu!verify remove'],
+ throttling: {
+ usages: 5,
+ duration: 30
+ },
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ guildOnly: true,
+ args: [
+ {
+ key: 'code',
+ prompt: 'What is the verification code?',
+ type: 'string'
+ }
+ ]
+ });
+ }
+ //@ts-ignore this ok
+ async run(msg: CommandoMessage, { code }: any) {
+ if (msg.guild.id == '704032355987488791') return msg.reply(`You are not submitting from **Kat\'s Korner**! ${emoji.random()}`);
+ Verify.findOne({ userID: msg.author.id }, async (error, member) => {
+ if (error) return console.error(error)
+ //@ts-ignore this exists
+ if (msg.author.id == member.userID) {
+ //@ts-ignore this in-fact
+ if (code == member.key) {
+ await Verify.findOneAndDelete({ userID: msg.author.id });
+ const unverRole = '729928740359897101';
+ return msg.guild.member(msg.author.id)?.roles.remove(unverRole);
+ } else {
+ //@ts-ignore this exists
+ return msg.author.send(`That is not the correct key! Please try again with the correct key: \`${member.key}\`. ${emoji.random()}`);
+ }
+ } else {
+ return msg.author.send(`You are already verified! ${emoji.random()}`)
+ }
+ })
+ }
+}; \ No newline at end of file