From 06604e6d432c2a82e151f7d2b1776d8546bd2389 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Wed, 8 Apr 2020 02:03:40 -0700 Subject: fix uptime, v1.4.3 --- app.js | 20 ++++++++++---------- commands/uptime.js | 8 ++++++++ 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 commands/uptime.js diff --git a/app.js b/app.js index 7de3df3..aa90a17 100644 --- a/app.js +++ b/app.js @@ -114,6 +114,14 @@ bot.on('message', async msg => { if (msg.member.hasPermission(p)) return true; } + function connectionCheck() { + if (msg.guild.voiceConnection) { + msg.reply('i\'m already playing that lol'); + } else { + msg.reply('you need to join a voice channel first silly'); + } + } + // Cooldown check // TODO: implament cooldowns when needed https://discordjs.guide/command-handling/adding-features.html#cooldowns @@ -121,11 +129,8 @@ bot.on('message', async msg => { try { const cmd = bot.commands.get(command) || bot.commands.find(c => c.aliases && c.aliases.includes(command)); - if (!cmd) { - msg.reply('thats not a command silly'); - } else if (cmd) { - cmd.execute(msg, args, bot); - } + if (!cmd) return; + cmd.execute(msg, args, bot, duration); return; } catch (error) { console.error(error); @@ -133,11 +138,6 @@ bot.on('message', async msg => { return; } - // Small command which need app.js variables - if (command == 'uptime' | command == 'ut') { - msg.reply(duration); - } - // Reacts with ping emoji when @everyone if (msg.mentions.everyone) { msg.react(':ArisaPing:695887537390223402'); diff --git a/commands/uptime.js b/commands/uptime.js new file mode 100644 index 0000000..f6dbefd --- /dev/null +++ b/commands/uptime.js @@ -0,0 +1,8 @@ +module.exports = { + name: 'uptime', + aliases: ['ut'], + description: '', + async execute(msg, args, bot, duration) { + msg.reply(duration); + } +}; \ No newline at end of file -- cgit v1.2.3