-
Notifications
You must be signed in to change notification settings - Fork 4
/
Start.js
74 lines (69 loc) · 3.17 KB
/
Start.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const Settings = require('./Settings.json');
let { ACAR } = require('./Voices.Global.Client');
const {
joinVoiceChannel,
} = require('@discordjs/voice');
for (let index = 0; index < Settings.tokens.length; index++) {
let token = Settings.tokens[index]
let channel = Settings.channels < 1 ? Settings.channels[0] : Settings.channels[index]
if(channel) {
let client = new ACAR()
client.login(token).catch(err => {
console.log(`${index + 1}. Satırdaki Token Arızalı!`)
})
client.on("voiceStateUpdate", async (oldState, newState) => {
if(oldState.member.id === client.user.id && oldState.channelId && !newState.channelId) {
client.user.setPresence({ activities: [{name: Settings.state}], status: "dnd" })
let guild = client.guilds.cache.get(Settings.guild);
if(!guild) return console.log("sunucu yok!");
let Channel = global.Voice = guild.channels.cache.get(channel);
if(!Channel) return console.log("channel yok");
client.voiceConnection = await joinVoiceChannel({
channelId: Channel.id,
guildId: Channel.guild.id,
adapterCreator: Channel.guild.voiceAdapterCreator,
group: client.user.id
});
}
})
client.on('ready', async () => {
console.log(`${client.user.tag}`)
client.user.setPresence({ activities: [{name: Settings.state}], status: "dnd" })
let guild = client.guilds.cache.get(Settings.guild);
if(!guild) return console.log("sunucu yok!");
let Channel = global.Voice = guild.channels.cache.get(channel);
if(!Channel) return console.log("channel yok");
client.voiceConnection = await joinVoiceChannel({
channelId: Channel.id,
guildId: Channel.guild.id,
adapterCreator: Channel.guild.voiceAdapterCreator,
group: client.user.id
});
if(!Channel.hasStaff()) await client._start(channel)
else client.staffJoined = true, client.playing = false, await client._start(channel);
})
client.on('voiceStateUpdate', async (oldState, newState) => {
if(
newState.channelId && (oldState.channelId !== newState.channelId) &&
newState.member.isStaff() &&
newState.channelId === channel &&
!newState.channel.hasStaff(newState.member)
) {
client.staffJoined = true;
client.player.stop()
return;
}
if(
oldState.channelId &&
(oldState.channelId !== newState.channelId) &&
newState.member.isStaff() &&
oldState.channelId === channel &&
!oldState.channel.hasStaff()
) {
client.staffJoined = false;
client._start(channel, true)
return
}
})
}
}