mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Proper button validation, bugfix for voice move spam
This commit is contained in:
parent
1ad70ffe1a
commit
bb9b8cfe06
2 changed files with 12 additions and 1 deletions
|
@ -63,6 +63,11 @@ const configPreprocessor: ConfigPreprocessorFn<ReactionRolesPluginType> = option
|
|||
`Invalid value for default_buttons/${defaultButtonNames[i]}/role_or_menu: ${defBtn.role_or_menu} is neither an existing menu nor a valid snowflake.`,
|
||||
]);
|
||||
}
|
||||
if (!defBtn.label && !defBtn.emoji) {
|
||||
throw new StrictValidationError([
|
||||
`Invalid values for default_buttons/${defaultButtonNames[i]}/(label|emoji): Must have label, emoji or both set for the button to be valid.`,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
for (const [menuName, menuButtonEntries] of Object.entries(group.button_menus ?? [])) {
|
||||
|
@ -83,6 +88,11 @@ const configPreprocessor: ConfigPreprocessorFn<ReactionRolesPluginType> = option
|
|||
`Invalid value for button_menus/${menuButtonNames[i]}/role_or_menu: ${menuBtn.role_or_menu} is neither an existing menu nor a valid snowflake.`,
|
||||
]);
|
||||
}
|
||||
if (!menuBtn.label && !menuBtn.emoji) {
|
||||
throw new StrictValidationError([
|
||||
`Invalid values for default_buttons/${defaultButtonNames[i]}/(label|emoji): Must have label, emoji or both set for the button to be valid.`,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ export const SpamVoiceStateUpdateEvt = spamEvt({
|
|||
async listener(meta) {
|
||||
const member = meta.args.newState.member;
|
||||
if (!member) return;
|
||||
const channel = meta.args.newState.channel!;
|
||||
const channel = meta.args.newState.channel;
|
||||
if (!channel) return;
|
||||
|
||||
const config = await meta.pluginData.config.getMatchingConfig({ member, channelId: channel.id });
|
||||
const maxVoiceMoves = config.max_voice_moves;
|
||||
|
|
Loading…
Add table
Reference in a new issue