Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const voice_roles = [{
- channel: "795661413246173204", //ايدي او اسم الروم
- role: "754332320273661962" //ايدي او اسم الرتبة
- },
- {
- channel: "Verified", //ايدي او اسم الروم
- role: "Verified" //ايدي او اسم الرتبة
- }
- ]
- client.on("voiceStateUpdate", (oldS, newS) => {
- if (oldS.channel == null && newS.channel !== null) {
- let setting = voice_roles.find(set => set.channel == newS.channelID || set.channel == newS.channel.name);
- if (!setting) return;
- let role = newS.guild.roles.cache.find(r => r.id == setting.role || r.name == setting.role);
- if (role) newS.member.roles.add(role, "Auto Voice Role (Join)");
- } else if (oldS.channel !== null && newS.channel == null) {
- let setting = voice_roles.find(set => set.channel == oldS.channelID);
- if (!setting) return;
- let role = newS.guild.roles.cache.find(r => r.id == setting.role || r.name == setting.role);
- if (role) newS.member.roles.remove(role, "Auto Voice Role (Leave)");
- oldS.channel.overwritePermissions([{
- id: oldS.member.id,
- deny: ["CONNECT"]
- }], "Prevent Spam (Auto Role.)").then((channel) => {
- setTimeout(() => {
- channel.permissionOverwrites.get(oldS.member.id).delete("Time out (Auto Role.)");
- }, 3000);
- })
- }
- });
- //By 3Mo_Steve | Toxic Codes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement