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

channel typings

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
metal 2023-03-11 12:43:04 +00:00 committed by GitHub
parent c33a216857
commit 8347095fa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 91 additions and 103 deletions

View file

@ -1,5 +1,4 @@
import { Util } from "discord.js";
import { ChannelTypeStrings } from "src/types";
import { ChannelType, escapeInlineCode } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { asSingleLine } from "../../../utils";
@ -39,7 +38,7 @@ export const SlowmodeClearCmd = slowmodeCmd({
}
try {
if (args.channel.type === ChannelTypeStrings.TEXT) {
if (args.channel.type === ChannelType.GuildText) {
await clearBotSlowmodeFromUserId(pluginData, args.channel, args.user.id, args.force);
} else {
sendErrorMessage(
@ -58,7 +57,7 @@ export const SlowmodeClearCmd = slowmodeCmd({
msg.channel,
asSingleLine(`
Failed to clear slowmode from **${args.user.tag}** in <#${args.channel.id}>:
\`${Util.escapeInlineCode(e.message)}\`
\`${escapeInlineCode(e.message)}\`
`),
);
return;

View file

@ -1,6 +1,5 @@
import { Permissions, TextChannel, ThreadChannel, Util } from "discord.js";
import { ChannelType, GuildTextBasedChannel, Permissions, TextChannel, ThreadChannel, Util } from "discord.js";
import humanizeDuration from "humanize-duration";
import { ChannelTypeStrings } from "src/types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { asSingleLine, DAYS, HOURS, MINUTES } from "../../../utils";
@ -39,7 +38,7 @@ export const SlowmodeSetCmd = slowmodeCmd({
],
async run({ message: msg, args, pluginData }) {
const channel: TextChannel | ThreadChannel = args.channel || msg.channel;
const channel: GuildTextBasedChannel = args.channel || msg.channel;
if (args.time === 0) {
// Workaround until we can call SlowmodeDisableCmd from here
@ -123,7 +122,7 @@ export const SlowmodeSetCmd = slowmodeCmd({
if (mode === "native") {
// If there is an existing bot-maintained slowmode, disable that first
const existingBotSlowmode = await pluginData.state.slowmodes.getChannelSlowmode(channel.id);
if (existingBotSlowmode && channel.type === ChannelTypeStrings.TEXT) {
if (existingBotSlowmode && channel.isTextBased()) {
await disableBotSlowmodeForChannel(pluginData, channel);
}