3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-11 12:55:01 +00:00

More fixes, change rest of stripObjectToScalars to configAccessibleObj

This commit is contained in:
Dark 2021-07-21 22:14:09 +02:00
parent 4ad99975de
commit acb4913495
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
66 changed files with 623 additions and 192 deletions

View file

@ -1,3 +1,4 @@
import { ChannelTypeStrings } from "src/types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { asSingleLine, disableInlineCode } from "../../../utils";
@ -37,7 +38,19 @@ export const SlowmodeClearCmd = slowmodeCmd({
}
try {
await clearBotSlowmodeFromUserId(pluginData, args.channel, args.user.id, args.force);
if (args.channel.type === ChannelTypeStrings.TEXT) {
await clearBotSlowmodeFromUserId(pluginData, args.channel, args.user.id, args.force);
} else {
sendErrorMessage(
pluginData,
msg.channel,
asSingleLine(`
Failed to clear slowmode from **${args.user.username}#${args.user.discriminator}** in <#${args.channel.id}>:
Threads cannot have Bot Slowmode
`),
);
return;
}
} catch (e) {
sendErrorMessage(
pluginData,

View file

@ -1,5 +1,6 @@
import { Permissions, TextChannel } from "discord.js";
import { Permissions, TextChannel, ThreadChannel } 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, disableInlineCode, HOURS, MINUTES } from "../../../utils";
@ -38,7 +39,7 @@ export const SlowmodeSetCmd = slowmodeCmd({
],
async run({ message: msg, args, pluginData }) {
const channel: TextChannel = args.channel || msg.channel;
const channel: TextChannel | ThreadChannel = args.channel || msg.channel;
if (args.time === 0) {
// Workaround until we can call SlowmodeDisableCmd from here
@ -122,7 +123,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) {
if (existingBotSlowmode && channel.type === ChannelTypeStrings.TEXT) {
await disableBotSlowmodeForChannel(pluginData, channel);
}