mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
feat(bot-discord): report to logs for other cmds
This commit is contained in:
@@ -2,6 +2,7 @@ import { ContextMenuCommandBuilder, ApplicationCommandType } from 'discord.js';
|
||||
import { checkForPerms } from '../utils/checkSupporterPerms.js'
|
||||
import muteMember from '../utils/muteMember.js';
|
||||
import exileMemberToChannel from '../utils/exileMemberToChannel.js';
|
||||
import reportToLogs from '../utils/reportToLogs.js';
|
||||
|
||||
export default {
|
||||
data: new ContextMenuCommandBuilder()
|
||||
@@ -28,6 +29,14 @@ export default {
|
||||
|
||||
exileMemberToChannel(targetMsg.author, interaction.channel, targetMsg.content, null, config);
|
||||
|
||||
reportToLogs(config, interaction.client, 'exiled', null, {
|
||||
reason,
|
||||
actionTo: targetMsg.author,
|
||||
actionBy: interaction.member,
|
||||
channel: interaction.channel,
|
||||
expire: parsedDuration
|
||||
}, interaction);
|
||||
|
||||
await targetMsg.delete();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import exileMemberToChannel from '../utils/exileMemberToChannel.js';
|
||||
import { checkForPerms } from '../utils/checkSupporterPerms.js'
|
||||
import muteMember from '../utils/muteMember.js';
|
||||
import reportToLogs from '../utils/reportToLogs.js';
|
||||
|
||||
export default {
|
||||
name: 'exile',
|
||||
@@ -19,13 +20,21 @@ export default {
|
||||
message = msgsByAuthor.slice(Number(`-${args[0]}`));
|
||||
}
|
||||
|
||||
await muteMember(config, referencedMsg.member, {
|
||||
const parsedDuration = await muteMember(config, referencedMsg.member, {
|
||||
supportMute: true,
|
||||
guild: msg.guild
|
||||
});
|
||||
|
||||
exileMemberToChannel(referencedMsg.author, msg.channel, message, null, config, false);
|
||||
|
||||
reportToLogs(config, interaction.client, 'exiled', null, {
|
||||
reason,
|
||||
actionTo: referencedMsg.author,
|
||||
actionBy: msg.member,
|
||||
channel: msg.channel,
|
||||
expire: parsedDuration
|
||||
}, null, msg);
|
||||
|
||||
await referencedMsg.delete();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user