Allow kicking the user from VC on mute (#156)
* Allow kicking the user from VC on mute If any non-id string is entered in `move_to_voice_channel`, the user is kicked from the VC instead of being moved. We do not automatically kick if the option is set to null in order to not make this a breaking change for old, intended behavior * Add explicit config option for kicking instead of kicking on any non-id Kicking takes precedent in this case and will take effect instead of moving to voice id
This commit is contained in:
parent
fb4979ff00
commit
2fc8cffd80
3 changed files with 6 additions and 3 deletions
|
@ -120,11 +120,12 @@ export async function muteUser(
|
|||
}
|
||||
|
||||
// If enabled, move the user to the mute voice channel (e.g. afk - just to apply the voice perms from the mute role)
|
||||
const moveToVoiceChannelId = pluginData.config.get().move_to_voice_channel;
|
||||
if (moveToVoiceChannelId) {
|
||||
const cfg = pluginData.config.get();
|
||||
const moveToVoiceChannel = cfg.kick_from_voice_channel ? null : cfg.move_to_voice_channel;
|
||||
if (moveToVoiceChannel || cfg.kick_from_voice_channel) {
|
||||
// TODO: Add back the voiceState check once we figure out how to get voice state for guild members that are loaded on-demand
|
||||
try {
|
||||
await member.edit({ channelID: moveToVoiceChannelId });
|
||||
await member.edit({ channelID: moveToVoiceChannel });
|
||||
} catch (e) {} // tslint:disable-line
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue