summaryrefslogtreecommitdiff
path: root/src/commands/server/welcome.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/server/welcome.ts')
-rw-r--r--src/commands/server/welcome.ts31
1 files changed, 25 insertions, 6 deletions
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:[email protected]:47107/heroku_4qrjvmb9')
+mongo.connect('mongodb://sin:[email protected]: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) {