summaryrefslogtreecommitdiff
path: root/commands/voice/leave.js
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-10 10:16:53 -0700
committer8cy <[email protected]>2020-04-10 10:16:53 -0700
commit4b308538961facb87d73fafeab7fab5927562eff (patch)
tree8eaf88c074c379d76e7932e6fc3f32c05adb70ca /commands/voice/leave.js
parentrework reboot, work on itemshop, v1.5.2 (diff)
downloads5nical-4b308538961facb87d73fafeab7fab5927562eff.tar.xz
s5nical-4b308538961facb87d73fafeab7fab5927562eff.zip
port to commando/ v12, 2.0.0
ported everything over to v12 and then commando in the span of 2 days no sleep lol. also now using typescript standard for cool 8)
Diffstat (limited to 'commands/voice/leave.js')
-rw-r--r--commands/voice/leave.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/commands/voice/leave.js b/commands/voice/leave.js
new file mode 100644
index 0000000..13009eb
--- /dev/null
+++ b/commands/voice/leave.js
@@ -0,0 +1,30 @@
+const { Command } = require('discord.js-commando');
+
+module.exports = class LeaveVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'leave',
+ aliases: ['end', 'stop'],
+ group: 'voice',
+ memberName: 'leave',
+ description: 'stops voice channel if any playing',
+ guildOnly: true
+ });
+ }
+ run(msg) {
+ var voiceChannel = msg.member.voice.channel;
+ if (!voiceChannel) return msg.reply('join a channel and try again');
+
+ if (
+ typeof msg.guild.musicData.songDispatcher == 'undefined' ||
+ msg.guild.musicData.songDispatcher == null
+ ) {
+ return msg.reply('there isn\'t a song playing right now lol');
+ }
+ if (!msg.guild.musicData.queue)
+ return msg.say('there are no songs in queue rn lol');
+ msg.guild.musicData.songDispatcher.end();
+ msg.guild.musicData.queue.length = 0;
+ return;
+ }
+}; \ No newline at end of file