-
Notifications
You must be signed in to change notification settings - Fork 0
Voice Moderation
Discord+PS has multiple ways of moderating VCs that are not currently supported in Discord.JS as heavily
Compared to Discord.JS muting is a lot simpler only requiring a user
To mute and unmute a user they have to be in a voice channel due to Discord.JS limitations
PSClient.voice.mute(user);
PSClient.voice.unmute(user);
In this example we have a mute command that mutes a user in vc for 5 seconds then unmutes them
PSClient.command({name: "mute"}, async (ctx, cmd) => {
let user = PSClient.fetchUser(cmd.args[0]);
PSClient.voice.mute(user);
console.log("Muted user");
await PSClient.sleep(5);
PSClient.voice.unmute(user);
console.log("Unmuted user");
});
Deafening is also a lot simpler than Discord.JS To deafen and undeafen a user they have to be in a voice channel due to Discord.JS limitations
PSClient.voice.deafen(user);
PSClient.voice.undeafen(user);
In this example we have a deafen command that deafens a user in vc for 5 seconds then undeafens them
PSClient.command({name: "deafen"}, async (ctx, cmd) => {
let user = PSClient.fetchUser(cmd.args[0]);
PSClient.voice.deafen(user);
console.log("Deafened user");
await PSClient.sleep(5);
PSClient.voice.undeafen(user);
console.log("Undeafened user");
});
Locking is a new Discord+PS feature that mutes and deafens, you can lock individual users using PSClient.voice.lockUser() or you can lock entire vcs using PSClient.voice.lock()
PSClient.voice.lock(channel);
PSClient.voice.unlock(channel);
PSClient.voice.lockUser(user);
PSClient.voice.unlockUser(user);
In this example we have a lock command that locks a channel for 5 seconds then unlocks it
PSClient.command({name: "lock"}, async (ctx, cmd) => {
PSClient.voice.find(user, async (channel) => {
PSClient.voice.lock(channel);
await PSClient.sleep(5);
PSClient.voice.unlock(channel);
});
});
If you are interested the reason why it's more difficult is because of how Discord.JS handles muting and deafening
In Discord.JS the only way to mute/deafen a user in a voice channel is by finding them in a voice channel and then using user.setMute()
This is how it's handled in Discord+PS:
mute(user) {
var [psc, client, ctx] = Holder;
psc.guild.channelF( (channels) => {
channels.forEach( (channel) => {
if (channel.members.has(user.id) && channel.type == 2) {
let vcUser = channel.members.get(user.id);
voice.setMute(true);
}
});
});
}
unmute(user) {
var [psc, client, ctx] = Holder;
psc.guild.channelF( (channels) => {
channels.forEach( (channel) => {
if (channel.members.has(user.id) && channel.type == 2) {
let vcUser = channel.members.get(user.id);
voice.setMute(false);
}
});
});
}
deafen(user) {
var [psc, client, ctx] = Holder;
psc.guild.channelF( (channels) => {
channels.forEach( (channel) => {
if (channel.members.has(user.id) && channel.type == 2) {
let vcUser = channel.members.get(user.id);
voice.setDeaf(true);
}
});
});
}
undeafen(user) {
var [psc, client, ctx] = Holder;
psc.guild.channelF( (channels) => {
channels.forEach( (channel) => {
if (channel.members.has(user.id) && channel.type == 2) {
let vcUser = channel.members.get(user.id);
voice.setDeaf(false);
}
});
});
}
lockUser(user) {
var [psc, client, ctx] = Holder;
psc.guild.channelF( (channels) => {
channels.forEach( (channel) => {
if (channel.members.has(user.id) && channel.type == 2) {
let vcUser = channel.members.get(user.id);
voice.setMute(true);
voice.setDeaf(true);
}
});
});
}
unlockUser(user) {
var [psc, client, ctx] = Holder;
psc.guild.channelF( (channels) => {
channels.forEach( (channel) => {
if (channel.members.has(user.id) && channel.type == 2) {
let vcUser = channel.members.get(user.id);
voice.setMute(false);
voice.setDeaf(false);
}
});
});
}
lock(channel) {
var [psc, client, ctx] = Holder;
let vc = client.channels.cache.get(channel.id);
vc.members.forEach( (user) => {
user.voice.setMute(true);
user.voice.setDeaf(true);
});
}
unlock(channel) {
var [psc, client, ctx] = Holder;
let vc = client.channels.cache.get(channel.id);
vc.members.forEach( (user) => {
user.voice.setMute(false);
user.voice.setDeaf(false);
});
}
For a look at some examples check out the examples folder
If anything with the mod is updated you can look to the releases for info on it
For a look into the development check out the index.js file
This mod is not associated with the creators of Discord, Discord.JS, or Discord.PY this was created out of love for Discord bot development because I wanted to make things easier for people. I do not condone harassment of the original developers and or anyone else involved in the creation of them.
I am not responsible for anything made with this mod and be sure to follow Discord's terms of service and their community guildlines while developing.
Basics
wc.command()
wc.slashCommand()
wc.commandList
wc.slashCommandList
Basics
wc.event()
wc.eventList
wc.commandAction()
wc.buttonAction()
wc.selectionAction()
wc.rowAction()
wc.fetchMessage()
wc.fetchReply()
wc.fetchUser()
wc.fetchGuildUser()
wc.fetchChannel()
wc.fetchGuildChannel()
wc.fetchRole()
wc.fetchGuildRole()
wc.fetchGuild()
wc.parseEmoji()
wc.parseSticker()