summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.js20
-rw-r--r--commands/uptime.js8
2 files changed, 18 insertions, 10 deletions
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