mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-06 18:47:20 +00:00
fixes
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
2907f5c079
commit
d278663af6
1 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
import { ChannelType, GuildTextBasedChannel, Snowflake, TextChannel, ThreadChannel } from "discord.js";
|
||||
import { ChannelType, GuildTextBasedChannel, Snowflake } from "discord.js";
|
||||
import * as t from "io-ts";
|
||||
import { convertDelayStringToMS, isDiscordAPIError, tDelayString, tNullable } from "../../../utils";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
|
@ -16,15 +16,15 @@ export const SetSlowmodeAction = automodAction({
|
|||
|
||||
async apply({ pluginData, actionConfig, contexts }) {
|
||||
const slowmodeMs = Math.max(actionConfig.duration ? convertDelayStringToMS(actionConfig.duration)! : 0, 0);
|
||||
const channels = actionConfig.channels ?? new Array();
|
||||
const channels: Snowflake[] = actionConfig.channels ?? [];
|
||||
if (channels.length === 0) {
|
||||
channels.push(...contexts.filter(c => c.message?.channel_id).map(c => c.message!.channel_id));
|
||||
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