1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-09-29 16:30:59 -04:00

finally fix the admin check

This commit is contained in:
AnxietyisReal 2022-11-24 00:56:20 +11:00
parent da28dc9a89
commit 77421d4d2b

View File

@ -3,21 +3,18 @@ import { TClient } from 'src/client';
export default { export default {
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
//if (!client.isStaff(interaction.member) && interaction.channelId == '468835415093411863') return interaction.reply('This command is restricted to staff only in this channel due to high usage.') //if (!client.isStaff(interaction.member) && interaction.channelId == '468835415093411863') return interaction.reply('This command is restricted to staff only in this channel due to high usage.')
const member = interaction.options.getUser('member'); const member = interaction.options.getMember('member');
const reason = interaction.options.getString('reason'); const reason = interaction.options.getString('reason');
const adminPerm = interaction.member.permissions.has('Administrator') const adminPerm = member.permissions.has('Administrator');
if (!member) {
return interaction.reply('You can\'t bonk the ghost.') if (adminPerm) return interaction.reply('You cannot bonk an admin!')
} else { if (member) {
//if (member && adminPerm) return interaction.reply('You cannot bonk an admin!') | i need halp with this const embed = new client.embed().setColor(client.config.embedColor)
if (member) { .setDescription(`> <@${member.id}> has been bonked!\n${reason?.length == null ? '' : `> Reason: **${reason}**`}`)
const embed = new client.embed().setColor(client.config.embedColor) .setImage('https://media.tenor.com/7tRddlNUNNcAAAAd/hammer-on-head-minions.gif')
.setDescription(`> <@${member.id}> has been bonked!\n${reason?.length == null ? '' : `> Reason: **${reason}**`}`) .setFooter({text: `Bonk count for ${member.user.tag}: ${await client.bonkCount.getUser(member.id).toLocaleString('en-US')}`})
.setImage('https://media.tenor.com/7tRddlNUNNcAAAAd/hammer-on-head-minions.gif') interaction.reply({embeds: [embed]})
.setFooter({text: `Bonk count for ${member.tag}: ${await client.bonkCount.getUser(member.id).toLocaleString('en-US')}`}) client.bonkCount._incrementUser(member.id).forceSave();
interaction.reply({embeds: [embed]})
client.bonkCount._incrementUser(member.id).forceSave();
}
} }
}, },
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@ -25,7 +22,8 @@ export default {
.setDescription('Bonk a member') .setDescription('Bonk a member')
.addUserOption((opt)=>opt .addUserOption((opt)=>opt
.setName('member') .setName('member')
.setDescription('Which member to bonk?')) .setDescription('Which member to bonk?')
.setRequired(true))
.addStringOption((opt)=>opt .addStringOption((opt)=>opt
.setName('reason') .setName('reason')
.setDescription('Reason for the bonk')) .setDescription('Reason for the bonk'))