3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-21 16:55:03 +00:00
This commit is contained in:
almeidx 2021-08-29 11:46:26 +01:00
parent a343ceb3aa
commit 48089d1831
No known key found for this signature in database
GPG key ID: 8558FBFF849BD664

View file

@ -1,7 +1,6 @@
import { Message, MessageOptions, Permissions, Snowflake, TextChannel, ThreadChannel, User } from "discord.js";
import { MessageOptions, Permissions, Snowflake, TextChannel, ThreadChannel, User } from "discord.js";
import * as t from "io-ts";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { LogType } from "../../../data/LogType";
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
import {
convertDelayStringToMS,
@ -95,7 +94,6 @@ export const ReplyAction = automodAction({
}
const messageContent = validateAndParseMessageContent(formatted);
let replyMsg: Message;
const messageOpts: MessageOptions = {
...messageContent,
@ -105,12 +103,14 @@ export const ReplyAction = automodAction({
};
if (typeof actionConfig !== "string" && actionConfig.use_inline_reply) {
const originalMsg = await channel.messages.fetch(_contexts[0].message!.id);
replyMsg = await originalMsg.reply(messageOpts);
} else {
replyMsg = await channel.send(messageOpts);
messageOpts.reply = {
failIfNotExists: false,
messageReference: _contexts[0].message!.id,
};
}
const replyMsg = await channel.send(messageOpts);
if (typeof actionConfig === "object" && actionConfig.auto_delete) {
const delay = convertDelayStringToMS(String(actionConfig.auto_delete))!;
setTimeout(() => !replyMsg.deleted && replyMsg.delete().catch(noop), delay);