diff options
| author | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
| commit | bb511abc03bb66848947e37a999502b813c77269 (patch) | |
| tree | 612c010fc8317e1cdf11471a18aad0270819d33e /src/commands/server/welcome.ts | |
| parent | fix: if clear amount equal or over 100, round down to 99 (diff) | |
| download | dep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz dep-core-bb511abc03bb66848947e37a999502b813c77269.zip | |
goodbye old uwufier :cry:
Diffstat (limited to 'src/commands/server/welcome.ts')
| -rw-r--r-- | src/commands/server/welcome.ts | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/src/commands/server/welcome.ts b/src/commands/server/welcome.ts deleted file mode 100644 index 68b3046..0000000 --- a/src/commands/server/welcome.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; -//@ts-ignore no types -import emoji from 'emoji-random'; -import Welcome from '../../models/welcome.js'; -import mongo from 'mongoose'; -import config from '../../config.json'; -mongo.connect(config['mongodburi'], { useNewUrlParser: true, useUnifiedTopology: true }) - -module.exports = class WelcomeServer extends Command { - constructor(client: CommandoClient) { - super(client, { - name: 'welcome', - group: 'server', - memberName: 'welcome', - description: 'Allows you to set, change or delete a server welcome message.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - examples: [ - 'uwu!welcome', - 'uwu!welcome set', - 'uwu!welcome remove' - ], - args: [ - { - key: 'wType', - prompt: 'Would you like to set, remove or change the current welcome channel?', - type: 'string', - default: '' - } - ], - throttling: { - usages: 5, - duration: 30 - }, - guildOnly: true - }); - } - //@ts-ignore doesnt matter if not all code paths return - async run(msg: CommandoMessage, { wType }: any) { - const welcome = new Welcome({ - _id: mongo.Types.ObjectId(), - username: msg.author.username, - userID: msg.author.id, - guildname: msg.guild.name, - guildID: msg.guild.id, - channelname: msg.channel, - channelID: msg.channel.id, - time: msg.createdAt - }) - // const guildExist = await Welcome.findOne({ guildID: msg.guild.id }) - - if (msg.member.hasPermission('MANAGE_GUILD')) { - Welcome.findOne({ guildID: msg.guild.id }, async (error, guild) => { - if (error) { - return console.log(error) - } else if (guild && wType == 'remove') { - await Welcome.findOneAndDelete({ guildID: msg.guild.id }) - return msg.say('The current welcome channel has been unset! ' + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild && wType == 'remove') { - return msg.reply('There is no current welcome channel set for this guild! ' + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (guild && wType == 'set') { - //@ts-ignore this exists - return msg.reply(`There already is a welcome channel set! It's ${guild.channelname}! ` + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild && wType == 'set') { - await welcome.save() - .then(result => console.log(result)) - .catch(err => console.log(err)) - - return msg.reply(`The welcome channel has been set to ${msg.channel}! ` + emoji.random()).then(mnotif => { - //@ts-ignore this exists - mnotif.delete({ timeout: 2000 }) - //@ts-ignore this exists - msg.delete({ timeout: 2000 }) - }) - } else if (!guild) { - return msg.reply('There is no current welcome channel set for this guild! To set one, do `uwu!welcome set` in the channel you want to set it in. ' + emoji.random()) - } else if (guild) { - //@ts-ignore this exists - return msg.reply(`The current welcome channel is ${guild.channelname}. ` + emoji.random()) - } - }) - } else { - return msg.reply('Insufficent permissions! ' + emoji.random()) - } - } -};
\ No newline at end of file |