fix(bot-discord): fix again

wont be the last time thanks to exile prefixed cmd and unexile not working properly for some fucking reason
This commit is contained in:
GramingFoxTeam
2023-08-13 20:47:10 +03:00
parent 8b9392d97a
commit 8991d979b9
6 changed files with 14 additions and 27 deletions

View File

@@ -22,7 +22,9 @@ export default {
await interaction.deferReply();
const member = interaction.options.getUser('user');
const user = interaction.options.getUser('user');
const member = await interaction.guild.members.fetch(user);
const isExiled = await unmuteMember(config, member, true);
if (!isExiled) {
@@ -35,7 +37,7 @@ export default {
reportToLogs(config, interaction.client, 'unmuted', null, {
reason: null,
actionTo: member,
actionTo: user,
actionBy: interaction.member,
channel: interaction.channel,
}, interaction);

View File

@@ -25,7 +25,7 @@ export default {
const user = interaction.options.getUser('user');
const member = await interaction.guild.members.fetch(user);
const isMuted = await unmuteMember(config, member);
const isMuted = await unmuteMember(config, member, false);
if (!isMuted) {
await interaction.editReply({
@@ -37,7 +37,7 @@ export default {
reportToLogs(config, interaction.client, 'unmuted', null, {
reason: null,
actionTo: member,
actionTo: user,
actionBy: interaction.member,
channel: interaction.channel,
}, interaction);

View File

@@ -13,9 +13,9 @@ export default {
if (args && args[0]) {
if (isNaN(args[0])) return msg.reply('The argument you entered is not a number!');
const msgsByAuthor = (await msg.channels.fetch({ limit: 50 })).filter(
const msgsByAuthor = (await msg.channel.messages.fetch({ limit: 50 })).filter(
m => m.author.id === referencedMsg.author.id
);
).map(m => m.content);
message = msgsByAuthor.slice(Number(`-${args[0]}`));
}

View File

@@ -1,10 +1,10 @@
export default async function exileMemberToChannel(member, channel, message, config, isSlash) {
export default async function exileMemberToChannel(member, channel, message, config, ) {
const redirectChannel = await channel.client.channels.fetch(config.discord.supportChannel);
let messageContent = '';
if (Array.isArray(message)) {
for (const msg of message) {
messageContent += `${msg.content}\n`;
messageContent += `${msg}\n`;
}
} else if (!message) message = 'No message provided';
else messageContent = message;
@@ -23,18 +23,4 @@ export default async function exileMemberToChannel(member, channel, message, con
}
]
});
const messageParams = {
content: `<@${member.id}>`,
embeds: [
{
title: '❗ You have been exiled!',
description: 'This is due to you asking support in non-support channels. Please use the support channel next time.'
}
]
};
if (isSlash) channel.editReply(messageParams);
else channel.send(messageParams);
}

View File

@@ -7,7 +7,7 @@ export default async function muteMember(config, member, { duration, reason, sup
let expires;
if (supportMute) {
expires = Math.floor((Date.now() + config.mute.supportMuteDuration) / 1000);
expires = Math.floor((Date.now() + config.discord.mute.supportMuteDuration) / 1000);
} else {
const parsedDuration = parse(duration);
expires = Math.floor((Date.now() + parsedDuration) / 1000);

View File

@@ -10,14 +10,13 @@ export default async function unmuteMember(config, member, supportMute) {
}
member.roles.remove(mute.support_mute ?
config.mute.supportGiveRoles :
config.mute.giveRoles
config.discord.mute.supportGiveRoles :
config.discord.mute.giveRoles
);
member.roles.add(mute.taken_roles);
await member.client.db.collection('muted').remove({
guild_id: member.guild.id,
await member.client.db.collection('muted').deleteOne({
user_id: member.id
});