feat(bot-discord): report to logs for other cmds

This commit is contained in:
GramingFoxTeam
2023-08-19 19:14:17 +03:00
parent 1e8533067b
commit 93b021c010
3 changed files with 23 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
import { EmbedBuilder, messageLink } from 'discord.js';
export default async function reportToLogs(config, client, action, message, { reason, expire, actionTo, actionBy }, interaction) {
export default async function reportToLogs(config, client, action, message, { reason, expire, actionTo, actionBy }, interaction, commandMsg) {
const actionUpper = action.charAt(0).toUpperCase() + action.slice(1);
const actionTitle = `${actionUpper} ${actionTo.tag}`;
const actionEmbed = new EmbedBuilder()
@@ -34,6 +34,9 @@ export default async function reportToLogs(config, client, action, message, { re
await interaction.editReply({ embeds: [actionEmbed] });
const msg = await interaction.fetchReply();
reportToLogs(config, client, action, msg, { reason, expire, actionTo, actionBy });
} else if (commandMsg) {
const msg = await commandMsg.reply({ embeds: [actionEmbed] });
reportToLogs(config, client, action, msg, { reason, expire, actionTo, actionBy });
} else {
const channel = await client.channels.fetch(config.logs.channelId);
const thread = await channel.threads.fetch(config.logs.threadId);