2022-11-17 12:58:19 -05:00
import Discord , { SlashCommandBuilder } from 'discord.js' ;
2023-01-27 21:33:55 -05:00
import TClient from 'src/client' ;
2022-11-17 12:58:19 -05:00
export default {
async run ( client : TClient , interaction : Discord.ChatInputCommandInteraction < 'cached' > ) {
2022-11-22 06:00:04 -05:00
//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.')
2023-01-18 14:28:11 -05:00
const member = interaction . options . getMember ( 'member' ) as Discord . GuildMember ;
2022-11-17 12:58:19 -05:00
const reason = interaction . options . getString ( 'reason' ) ;
2022-11-23 08:56:20 -05:00
const adminPerm = member . permissions . has ( 'Administrator' ) ;
2023-01-18 14:28:11 -05:00
if ( adminPerm ) return interaction . reply ( 'You cannot bonk an admin!' ) ;
2023-02-13 00:31:24 -05:00
client . bonkCount . _incrementUser ( member . id ) . forceSave ( ) ;
interaction . reply ( { embeds : [ new client . embed ( ) . setColor ( client . config . embedColor )
2022-11-23 08:56:20 -05:00
. setDescription ( ` > <@ ${ member . id } > has been bonked! \ n ${ reason ? . length == null ? '' : ` > Reason: ** ${ reason } ** ` } ` )
. setImage ( 'https://media.tenor.com/7tRddlNUNNcAAAAd/hammer-on-head-minions.gif' )
2023-02-13 00:31:24 -05:00
. setFooter ( { text : ` Bonk count for ${ member . user . tag } : ${ client . bonkCount . getUser ( member . id ) . toLocaleString ( 'en-US' ) } ` } )
] } )
2022-11-17 12:58:19 -05:00
} ,
data : new SlashCommandBuilder ( )
. setName ( 'bonk' )
. setDescription ( 'Bonk a member' )
. addUserOption ( ( opt ) = > opt
. setName ( 'member' )
2022-11-23 08:56:20 -05:00
. setDescription ( 'Which member to bonk?' )
. setRequired ( true ) )
2022-11-17 12:58:19 -05:00
. addStringOption ( ( opt ) = > opt
. setName ( 'reason' )
. setDescription ( 'Reason for the bonk' ) )
2023-01-18 14:28:11 -05:00
}