This repository was archived by the owner on Aug 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleave.js
55 lines (49 loc) · 1.65 KB
/
leave.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// @ts-check
"use strict"
// @ts-ignore
const langfile = require("../storage/translation/language.json")
module.exports.run = async (client, message, args) => {
let lan
if (client.language.get(message.guild.id) == "eng") {
lan = langfile.english.music.leave
}
if (client.language.get(message.guild.id) == "ger") {
lan = langfile.german.music.leave
}
if (client.language.get(message.guild.id) == "fr") {
lan = langfile.french.music.leave
}
if (client.language.get(message.guild.id) == "cz") {
lan = langfile.czech.music.leave
}
if (client.language.get(message.guild.id) == "ru") {
lan = langfile.russian.music.leave
}
const prefix = client.prefix
if (message.member.voiceChannel) {//commander is in voiceChannel
if (message.guild.voiceConnection) {//I'm in this voiceChannel
if (message.member.voiceChannel.id === message.guild.voiceConnection.channel.id) {//ids of my Voicechannel and commander's one are same -> we are in the same voiceChannel
message.channel.send(`${lan.left} <:voice:601378479274983424>${message.guild.voiceConnection.channel.name}`);
message.member.voiceChannel.leave()
}
else {
message.channel.send(lan.wrongchannel);
}
}
else {
message.channel.send(lan.already);
}
}
else {
message.channel.send(lan.nochannel);
}
}
module.exports.help = {
name: "leave",
description: "Leaves the Voice Channel you are in!",
aliases: [],
permlvl: 1,
hidden: false,
category: "music",
usage: "leave"
}