mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-06 10:37:19 +00:00
Merge remote-tracking branch 'origin/master' into iots_to_zod
This commit is contained in:
commit
59c5176cbd
39 changed files with 1420 additions and 2208 deletions
|
@ -10,14 +10,17 @@ export const SetSlowmodeAction = automodAction({
|
|||
duration: zDelayString.nullable().default("10s"),
|
||||
}),
|
||||
|
||||
async apply({ pluginData, actionConfig }) {
|
||||
async apply({ pluginData, actionConfig, contexts }) {
|
||||
const slowmodeMs = Math.max(actionConfig.duration ? convertDelayStringToMS(actionConfig.duration)! : 0, 0);
|
||||
|
||||
for (const channelId of actionConfig.channels) {
|
||||
const channels: Snowflake[] = actionConfig.channels ?? [];
|
||||
if (channels.length === 0) {
|
||||
channels.push(...contexts.filter((c) => c.message?.channel_id).map((c) => c.message!.channel_id));
|
||||
}
|
||||
for (const channelId of channels) {
|
||||
const channel = pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
|
||||
// Only text channels and text channels within categories support slowmodes
|
||||
if (!channel || (!channel.isTextBased() && channel.type !== ChannelType.GuildCategory)) {
|
||||
|
||||
if (!channel?.isTextBased() && channel?.type !== ChannelType.GuildCategory) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue