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/zerotwo/darling.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/commands/zerotwo/darling.ts') diff --git a/src/commands/zerotwo/darling.ts b/src/commands/zerotwo/darling.ts index 9999362..18fb3ac 100644 --- a/src/commands/zerotwo/darling.ts +++ b/src/commands/zerotwo/darling.ts @@ -2,7 +2,7 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import emoji from 'emoji-random'; import Darling from '../../models/darling.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 DarlingZeroTwo extends Command { constructor(client) { @@ -25,7 +25,12 @@ module.exports = class DarlingZeroTwo extends Command { type: 'string', default: '' } - ] + ], + throttling: { + usages: 5, + duration: 30 + }, + guildOnly: true }); } async run(msg: CommandoMessage, { darlingName }) { @@ -51,7 +56,9 @@ module.exports = class DarlingZeroTwo extends Command { } } else if (!guild && darlingName == 'remove') { msg.reply('There is no darling set in this server. ' + emoji.random()) - } else if (darlingName == 'set') { + } else if (guild && darlingName == 'set') { + msg.reply(`I already have a darling! It\'s <@${guild.userID}>! ` + emoji.random()) + } else if (!guild && darlingName == 'set') { await darling.save() .then(result => console.log(result)) .catch(err => console.log(err)) -- cgit v1.2.3