fix(automod): don't try to reply with an empty message

This commit is contained in:
Dragory 2021-11-27 11:52:26 +02:00
parent 3b98c3bdc1
commit ff160be1fa
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -17,6 +17,7 @@ import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { automodAction } from "../helpers";
import { AutomodContext } from "../types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
export const ReplyAction = automodAction({
configType: t.union([
@ -109,6 +110,10 @@ export const ReplyAction = automodAction({
};
}
if (messageIsEmpty(messageOpts)) {
return;
}
const replyMsg = await channel.send(messageOpts);
if (typeof actionConfig === "object" && actionConfig.auto_delete) {