mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
feat(bot-discord): use user option in / cmds
This commit is contained in:
@@ -7,7 +7,7 @@ export default {
|
||||
.setName('ban')
|
||||
.setDescription('Ban a member.')
|
||||
.setDMPermission(false)
|
||||
.addStringOption(option =>
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName('user')
|
||||
.setDescription('The member to ban')
|
||||
@@ -29,7 +29,7 @@ export default {
|
||||
content: 'You don\'t have the required permissions.'
|
||||
});
|
||||
|
||||
interaction.guild.members.ban(interaction.options.getString('user'), {
|
||||
interaction.guild.members.ban(interaction.options.getUser('user'), {
|
||||
reason: interaction.options.getString('reason'),
|
||||
deleteMessageSeconds: interaction.options.getString('dmd') ?
|
||||
interaction.options.getString('dmd') * 86_400 : 0
|
||||
@@ -37,7 +37,7 @@ export default {
|
||||
|
||||
reportToLogs(config, interaction.client, 'banned', null, {
|
||||
reason: interaction.options.getString('reason'),
|
||||
actionTo: await client.users.fetch(interaction.options.getString('user')),
|
||||
actionTo: await client.users.fetch(interaction.options.getUser('user')),
|
||||
actionBy: interaction.member,
|
||||
channel: interaction.channel
|
||||
}, interaction);
|
||||
|
||||
@@ -8,7 +8,7 @@ export default {
|
||||
.setName('exile')
|
||||
.setDescription('Exile a member to support.')
|
||||
.setDMPermission(false)
|
||||
.addStringOption(option =>
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName('user')
|
||||
.setDescription('The member to exile')
|
||||
@@ -28,16 +28,7 @@ export default {
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
let member;
|
||||
try {
|
||||
member = await interaction.guild.members.fetch(interaction.options.getString('user'));
|
||||
} catch (_) {
|
||||
await interaction.editReply({
|
||||
content: 'Could not find member.'
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
const member = interaction.options.getUser('user');
|
||||
|
||||
const reason = interaction.options.getString('reason');
|
||||
const parsedDuration = await muteMember(config, member, {
|
||||
|
||||
@@ -8,7 +8,7 @@ export default {
|
||||
.setName('mute')
|
||||
.setDescription('Mute a member.')
|
||||
.setDMPermission(false)
|
||||
.addStringOption(option =>
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName('user')
|
||||
.setDescription('The member to mute')
|
||||
@@ -34,16 +34,7 @@ export default {
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
let member;
|
||||
try {
|
||||
member = await interaction.guild.members.fetch(interaction.options.getString('user'));
|
||||
} catch (_) {
|
||||
await interaction.editReply({
|
||||
content: 'Could not find member.'
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
const member = interaction.options.getUser('user');
|
||||
|
||||
const reason = interaction.options.getString('reason');
|
||||
const parsedDuration = await muteMember(config, member, {
|
||||
@@ -54,7 +45,7 @@ export default {
|
||||
|
||||
reportToLogs(config, interaction.client, 'muted', null, {
|
||||
reason,
|
||||
actionTo: await member.client.users.fetch(interaction.options.getString('user')),
|
||||
actionTo: member,
|
||||
actionBy: interaction.member,
|
||||
channel: interaction.channel,
|
||||
expire: parsedDuration
|
||||
|
||||
@@ -7,7 +7,7 @@ export default {
|
||||
.setName('unban')
|
||||
.setDescription('Unban a member.')
|
||||
.setDMPermission(false)
|
||||
.addStringOption(option =>
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName('user')
|
||||
.setDescription('The member to ban')
|
||||
@@ -19,11 +19,10 @@ export default {
|
||||
content: 'You don\'t have the required permissions.'
|
||||
});
|
||||
|
||||
interaction.guild.members.unban(interaction.options.getString('user'),
|
||||
interaction.options.getString('reason'));
|
||||
interaction.guild.members.unban(interaction.options.getUser('user'));
|
||||
|
||||
reportToLogs(config, interaction.client, 'unbanned', null, {
|
||||
reason: interaction.options.getString('reason'),
|
||||
reason: null,
|
||||
actionTo: await client.users.fetch(interaction.options.getString('user')),
|
||||
actionBy: interaction.member,
|
||||
channel: interaction.channel
|
||||
|
||||
@@ -8,7 +8,7 @@ export default {
|
||||
.setName('unexile')
|
||||
.setDescription('Get the member back from an exilation.')
|
||||
.setDMPermission(false)
|
||||
.addStringOption(option =>
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName('user')
|
||||
.setDescription('The member to unexile')
|
||||
@@ -22,19 +22,9 @@ export default {
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
let member;
|
||||
try {
|
||||
member = await interaction.guild.members.fetch(interaction.options.getString('user'));
|
||||
} catch (_) {
|
||||
await interaction.editReply({
|
||||
content: 'Could not find member.'
|
||||
});
|
||||
const member = interaction.options.getUser('user');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const reason = interaction.options.getString('reason');
|
||||
const isExiled = await unmuteMember(config, member);
|
||||
const isExiled = await unmuteMember(config, member, true);
|
||||
|
||||
if (!isExiled) {
|
||||
await interaction.editReply({
|
||||
@@ -45,7 +35,7 @@ export default {
|
||||
}
|
||||
|
||||
reportToLogs(config, interaction.client, 'unmuted', null, {
|
||||
reason,
|
||||
reason: null,
|
||||
actionTo: await client.users.fetch(interaction.options.getString('user')),
|
||||
actionBy: interaction.member,
|
||||
channel: interaction.channel,
|
||||
|
||||
@@ -8,7 +8,7 @@ export default {
|
||||
.setName('unmute')
|
||||
.setDescription('Unmute a member.')
|
||||
.setDMPermission(false)
|
||||
.addStringOption(option =>
|
||||
.addUserOption(option =>
|
||||
option
|
||||
.setName('user')
|
||||
.setDescription('The member to unmute')
|
||||
@@ -22,19 +22,9 @@ export default {
|
||||
|
||||
await interaction.deferReply();
|
||||
|
||||
let member;
|
||||
try {
|
||||
member = await interaction.guild.members.fetch(interaction.options.getString('user'));
|
||||
} catch (_) {
|
||||
await interaction.editReply({
|
||||
content: 'Could not find member.'
|
||||
});
|
||||
const member = interaction.options.getUser('user');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const reason = interaction.options.getString('reason');
|
||||
const isMuted = await unmuteMember(config, member);
|
||||
const isMuted = await unmuteMember(config, member, false);
|
||||
|
||||
if (!isMuted) {
|
||||
await interaction.editReply({
|
||||
@@ -45,7 +35,7 @@ export default {
|
||||
}
|
||||
|
||||
reportToLogs(config, interaction.client, 'unmuted', null, {
|
||||
reason,
|
||||
reason: null,
|
||||
actionTo: await client.users.fetch(interaction.options.getString('user')),
|
||||
actionBy: interaction.member,
|
||||
channel: interaction.channel,
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
export default async function unmuteMember(config, member) {
|
||||
export default async function unmuteMember(config, member, supportMute) {
|
||||
const mute = await member.client.db.collection('muted').findOne({
|
||||
guild_id: member.guild.id,
|
||||
user_id: member.id
|
||||
});
|
||||
|
||||
if (!mute) return false;
|
||||
if (!mute.support_mute) return false;
|
||||
if (supportMute) {
|
||||
if (!mute.support_mute) return false;
|
||||
}
|
||||
|
||||
member.roles.remove(mute.support_mute ?
|
||||
config.mute.supportGiveRoles :
|
||||
|
||||
Reference in New Issue
Block a user