From 0d35c0116c38d1f8642e4c8d8f36509f7500bb05 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Mon, 27 Apr 2020 08:00:29 -0700 Subject: A New World, v8.0.0 - change some formatting - add throttling to all commands - change timout in welcome and clear - add another edge case to welcome and darling - use new mongo.connect params for stability - move some commands around - remove some tsingnores for idk in total, epic update 8) --- src/commands/server/membercount.ts | 1 + src/commands/server/server.ts | 4 ++-- src/commands/server/servercount.ts | 28 ---------------------------- src/commands/server/welcome.ts | 31 +++++++++++++++++++++++++------ 4 files changed, 28 insertions(+), 36 deletions(-) delete mode 100644 src/commands/server/servercount.ts (limited to 'src/commands/server') diff --git a/src/commands/server/membercount.ts b/src/commands/server/membercount.ts index f3fd2ee..7b737ee 100644 --- a/src/commands/server/membercount.ts +++ b/src/commands/server/membercount.ts @@ -13,6 +13,7 @@ module.exports = class MemberCountServer extends Command { usages: 5, duration: 30 }, + guildOnly: true, examples: [ 'uwu!membercount', 'uwu!memberc', diff --git a/src/commands/server/server.ts b/src/commands/server/server.ts index 6758d24..a63362b 100644 --- a/src/commands/server/server.ts +++ b/src/commands/server/server.ts @@ -16,8 +16,8 @@ module.exports = class ServerServer extends Command { memberName: 'server', description: 'Gives you information about the current server.', throttling: { - usages: 2, - duration: 60 + usages: 5, + duration: 30 }, guildOnly: true, examples: [ diff --git a/src/commands/server/servercount.ts b/src/commands/server/servercount.ts deleted file mode 100644 index 4690caa..0000000 --- a/src/commands/server/servercount.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; -import { MessageEmbed } from 'discord.js'; -import emoji from 'emoji-random'; - -module.exports = class ServerCountServer extends Command { - constructor(client) { - super(client, { - name: 'servercount', - aliases: ['sc', 'scount', 'serverc'], - group: 'server', - memberName: 'servercount', - description: 'Tells you the amount of servers uwufy is in.', - userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] - }); - } - run(msg: CommandoMessage) { - msg.channel.send('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription(`Currently running on ${this.client.guilds.cache.size} server(s). ` + emoji.random()) - .setColor(0xFFCC4D) - - msg.channel.send(emb); - }); - } -}; \ No newline at end of file diff --git a/src/commands/server/welcome.ts b/src/commands/server/welcome.ts index 9b92268..08a2911 100644 --- a/src/commands/server/welcome.ts +++ b/src/commands/server/welcome.ts @@ -2,7 +2,7 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import emoji from 'emoji-random'; import Welcome from '../../models/welcome.js'; import mongo from 'mongoose'; -mongo.connect('mongodb://sin:cSDZEygGZz232eJ5bS@ds047107.mlab.com:47107/heroku_4qrjvmb9') +mongo.connect('mongodb://sin:cSDZEygGZz232eJ5bS@ds047107.mlab.com:47107/heroku_4qrjvmb9', { useNewUrlParser: true, useUnifiedTopology: true }) module.exports = class WelcomeServer extends Command { constructor(client) { @@ -25,7 +25,12 @@ module.exports = class WelcomeServer extends Command { type: 'string', default: '' } - ] + ], + throttling: { + usages: 5, + duration: 30 + }, + guildOnly: true }); } async run(msg: CommandoMessage, { wType }) { @@ -47,15 +52,29 @@ module.exports = class WelcomeServer extends Command { console.log(error) } else if (guild && wType == 'remove') { await Welcome.findOneAndDelete({ guildID: msg.guild.id }) - msg.say('The current welcome channel has been unset! ' + emoji.random()) + msg.say('The current welcome channel has been unset! ' + emoji.random()).then(mnotif => { + mnotif.delete({ timeout: 2000 }) + msg.delete({ timeout: 2000 }) + }) } else if (!guild && wType == 'remove') { - msg.reply('There is no current welcome channel set for this guild! ' + emoji.random()) - } else if (wType == 'set') { + msg.reply('There is no current welcome channel set for this guild! ' + emoji.random()).then(mnotif => { + mnotif.delete({ timeout: 2000 }) + msg.delete({ timeout: 2000 }) + }) + } else if (guild && wType == 'set') { + msg.reply(`There already is a welcome channel set! It's ${guild.channelname}! ` + emoji.random()).then(mnotif => { + mnotif.delete({ timeout: 2000 }) + msg.delete({ timeout: 2000 }) + }) + } else if (!guild && wType == 'set') { await welcome.save() .then(result => console.log(result)) .catch(err => console.log(err)) - msg.reply(`The welcome channel has been set to ${msg.channel}! ` + emoji.random()) + msg.reply(`The welcome channel has been set to ${msg.channel}! ` + emoji.random()).then(mnotif => { + mnotif.delete({ timeout: 2000 }) + msg.delete({ timeout: 2000 }) + }) } else if (!guild) { 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) { -- cgit v1.2.3