3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-20 16:25:03 +00:00

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:
Dark 2021-02-13 19:53:07 +01:00
parent f0a60fd385
commit 1aea3b5f40
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
3 changed files with 6 additions and 4 deletions

View file

@ -23,6 +23,7 @@ const defaultOptions = {
config: { config: {
mute_role: null, mute_role: null,
move_to_voice_channel: null, move_to_voice_channel: null,
kick_from_voice_channel: false,
dm_on_mute: false, dm_on_mute: false,
dm_on_update: false, dm_on_update: false,

View file

@ -89,12 +89,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) // If enabled, move the user to the mute voice channel (e.g. afk - just to apply the voice perms from the mute role)
let moveToVoiceChannelId = pluginData.config.get().move_to_voice_channel; const cfg = pluginData.config.get();
if (moveToVoiceChannelId) { 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 // TODO: Add back the voiceState check once we figure out how to get voice state for guild members that are loaded on-demand
if (moveToVoiceChannelId.match(".*[^0-9].*")) moveToVoiceChannelId = null;
try { try {
await member.edit({ channelID: moveToVoiceChannelId }); await member.edit({ channelID: moveToVoiceChannel });
} catch (e) {} // tslint:disable-line } catch (e) {} // tslint:disable-line
} }
} }

View file

@ -14,6 +14,7 @@ import Timeout = NodeJS.Timeout;
export const ConfigSchema = t.type({ export const ConfigSchema = t.type({
mute_role: tNullable(t.string), mute_role: tNullable(t.string),
move_to_voice_channel: tNullable(t.string), move_to_voice_channel: tNullable(t.string),
kick_from_voice_channel: t.boolean,
dm_on_mute: t.boolean, dm_on_mute: t.boolean,
dm_on_update: t.boolean, dm_on_update: t.boolean,