mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
fix(bot-discord): embed consistency for exilation (#21)
This commit is contained in:
@@ -39,9 +39,9 @@ export default {
|
||||
guild: interaction.guild
|
||||
});
|
||||
|
||||
exileMemberToChannel(member, interaction.channel, null, config, true);
|
||||
exileMemberToChannel(member, interaction.channel, null, reason, config);
|
||||
|
||||
reportToLogs(config, interaction.client, 'muted', null, {
|
||||
reportToLogs(config, interaction.client, 'exiled', null, {
|
||||
reason,
|
||||
actionTo: user,
|
||||
actionBy: interaction.member,
|
||||
|
||||
@@ -26,6 +26,6 @@ export default {
|
||||
guild: interaction.guild
|
||||
});
|
||||
|
||||
exileMemberToChannel(targetMsg.author, interaction.channel, targetMsg.content, config, true);
|
||||
exileMemberToChannel(targetMsg.author, interaction.channel, targetMsg.content, null, config);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
reportToLogs(config, interaction.client, 'unmuted', null, {
|
||||
reportToLogs(config, interaction.client, 'unexiled', null, {
|
||||
reason: null,
|
||||
actionTo: user,
|
||||
actionBy: interaction.member,
|
||||
|
||||
@@ -24,6 +24,6 @@ export default {
|
||||
guild: msg.guild
|
||||
});
|
||||
|
||||
exileMemberToChannel(referencedMsg.author, msg.channel, message, config, false);
|
||||
exileMemberToChannel(referencedMsg.author, msg.channel, message, null, config, false);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,45 @@
|
||||
export default async function exileMemberToChannel(member, channel, message, config, ) {
|
||||
export default async function exileMemberToChannel(member, channel, message, reason, config) {
|
||||
const redirectChannel = await channel.client.channels.fetch(config.discord.supportChannel);
|
||||
|
||||
let messageContent = '';
|
||||
if (Array.isArray(message)) {
|
||||
for (const msg of message) {
|
||||
messageContent += `${msg}\n`;
|
||||
}
|
||||
} else if (!message) message = 'No message provided';
|
||||
else messageContent = message;
|
||||
}
|
||||
} else if (!message) {
|
||||
message = 'No message provided'
|
||||
} else messageContent = message;
|
||||
|
||||
const embedFields = [
|
||||
{
|
||||
name: 'Orginal message',
|
||||
value: messageContent
|
||||
}
|
||||
];
|
||||
|
||||
if (reason) {
|
||||
embedFields.push(
|
||||
{
|
||||
name: 'Reason',
|
||||
value: reason
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
await redirectChannel.send({
|
||||
content: `<@${member.id}>`,
|
||||
embeds: [
|
||||
{
|
||||
title: '❗ An exiled member appears!',
|
||||
fields: [
|
||||
{
|
||||
name: 'Their message',
|
||||
value: messageContent
|
||||
}
|
||||
]
|
||||
title: `Restricted to <#${redirectChannel.id}>`,
|
||||
fields: embedFields,
|
||||
thumbnail: {
|
||||
url: member.avatarURL()
|
||||
},
|
||||
footer: {
|
||||
text: 'ReVanced',
|
||||
icon_url: channel.client.user.avatarURL()
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ export default async function reportToLogs(config, client, action, message, { re
|
||||
{ name: 'Action', value: `${actionTo.toString()} was ${action} by ${actionBy.toString()}` }
|
||||
];
|
||||
|
||||
if (action === 'banned' || action === 'muted') fields.push({
|
||||
if (action === 'banned' || action === 'muted' || action === 'exiled') fields.push({
|
||||
name: 'Reason',
|
||||
value: reason ? reason : 'No reason provided',
|
||||
inline: true
|
||||
|
||||
Reference in New Issue
Block a user