3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-23 09:35:02 +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 * as t from "io-ts";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects"; import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { LogType } from "../../../data/LogType";
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter"; import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
import { import {
convertDelayStringToMS, convertDelayStringToMS,
@ -95,7 +94,6 @@ export const ReplyAction = automodAction({
} }
const messageContent = validateAndParseMessageContent(formatted); const messageContent = validateAndParseMessageContent(formatted);
let replyMsg: Message;
const messageOpts: MessageOptions = { const messageOpts: MessageOptions = {
...messageContent, ...messageContent,
@ -105,12 +103,14 @@ export const ReplyAction = automodAction({
}; };
if (typeof actionConfig !== "string" && actionConfig.use_inline_reply) { if (typeof actionConfig !== "string" && actionConfig.use_inline_reply) {
const originalMsg = await channel.messages.fetch(_contexts[0].message!.id); messageOpts.reply = {
replyMsg = await originalMsg.reply(messageOpts); failIfNotExists: false,
} else { messageReference: _contexts[0].message!.id,
replyMsg = await channel.send(messageOpts); };
} }
const replyMsg = await channel.send(messageOpts);
if (typeof actionConfig === "object" && actionConfig.auto_delete) { if (typeof actionConfig === "object" && actionConfig.auto_delete) {
const delay = convertDelayStringToMS(String(actionConfig.auto_delete))!; const delay = convertDelayStringToMS(String(actionConfig.auto_delete))!;
setTimeout(() => !replyMsg.deleted && replyMsg.delete().catch(noop), delay); setTimeout(() => !replyMsg.deleted && replyMsg.delete().catch(noop), delay);