mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 20:55:01 +00:00
channel typings
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
c33a216857
commit
8347095fa0
15 changed files with 91 additions and 103 deletions
|
@ -1,6 +1,5 @@
|
|||
import { Snowflake, TextChannel } from "discord.js";
|
||||
import { ChannelType, Snowflake, TextChannel } from "discord.js";
|
||||
import * as t from "io-ts";
|
||||
import { ChannelTypeStrings } from "src/types";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { convertDelayStringToMS, isDiscordAPIError, tDelayString, tNullable } from "../../../utils";
|
||||
import { automodAction } from "../helpers";
|
||||
|
@ -23,15 +22,15 @@ export const SetSlowmodeAction = automodAction({
|
|||
const channel = pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
|
||||
// Only text channels and text channels within categories support slowmodes
|
||||
if (!channel || !(channel.type === ChannelTypeStrings.TEXT || ChannelTypeStrings.CATEGORY)) {
|
||||
if (!channel || !(channel.type === ChannelType.GuildText || ChannelType.GuildCategory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const channelsToSlowmode: TextChannel[] = [];
|
||||
if (channel.type === ChannelTypeStrings.CATEGORY) {
|
||||
if (channel.type === ChannelType.GuildCategory) {
|
||||
// Find all text channels within the category
|
||||
for (const ch of pluginData.guild.channels.cache.values()) {
|
||||
if (ch.parentId === channel.id && ch.type === ChannelTypeStrings.TEXT) {
|
||||
if (ch.parentId === channel.id && ch.type === ChannelType.GuildText) {
|
||||
channelsToSlowmode.push(ch as TextChannel);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue