@@ -23,15 +23,14 @@ import me.duncte123.botcommons.messaging.MessageUtils.sendSuccess
2323import me.duncte123.skybot.Variables
2424import me.duncte123.skybot.commands.guild.mod.ModBaseCommand
2525import me.duncte123.skybot.objects.command.CommandContext
26- import me.duncte123.skybot.objects.command.ISlashCommand
2726import net.dv8tion.jda.api.Permission
2827import net.dv8tion.jda.api.entities.channel.ChannelType
2928import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
3029import net.dv8tion.jda.api.interactions.commands.OptionType
3130import net.dv8tion.jda.api.interactions.commands.build.OptionData
3231import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData
3332
34- class VoiceKickCommand : ModBaseCommand (), ISlashCommand {
33+ class VoiceKickCommand : ModBaseCommand () {
3534 init {
3635 this .requiresArgs = true
3736 this .name = " voicekick"
@@ -76,27 +75,24 @@ class VoiceKickCommand : ModBaseCommand(), ISlashCommand {
7675 sendMsg(ctx, " I could not find any Voice Channel or member to kick from voice" )
7776 }
7877
79- override fun getDescription (): String = this .help
80-
81- override fun getSlashData (): SlashCommandData {
82- return super .getSlashData()
83- .addOptions(
84- OptionData (
85- OptionType .CHANNEL ,
86- " voice_channel" ,
87- " The voice channel to kick ALL users from." ,
88- false
89- ),
90- OptionData (
91- OptionType .USER ,
92- " user" ,
93- " The user to kick from the voice channel they are currently in." ,
94- false
95- ),
96- )
78+ override fun configureSlashSupport (baseData : SlashCommandData ) {
79+ baseData.addOptions(
80+ OptionData (
81+ OptionType .CHANNEL ,
82+ " voice_channel" ,
83+ " The voice channel to kick ALL users from." ,
84+ false
85+ ),
86+ OptionData (
87+ OptionType .USER ,
88+ " user" ,
89+ " The user to kick from the voice channel they are currently in." ,
90+ false
91+ ),
92+ )
9793 }
9894
99- override fun handleSlashEvent (event : SlashCommandInteractionEvent , variables : Variables ) {
95+ override fun handleEvent (event : SlashCommandInteractionEvent , variables : Variables ) {
10096 val vc = event.getOption(" voice_channel" )?.asChannel
10197
10298 if (vc != null ) {
@@ -122,8 +118,6 @@ class VoiceKickCommand : ModBaseCommand(), ISlashCommand {
122118 val member = event.getOption(" user" )?.asMember
123119
124120 if (member != null ) {
125- val memberChannel = member.voiceState?.channel
126-
127121 // We have to "== true" here because the return type is a nullable boolean
128122 if (member.voiceState?.inAudioChannel() == true ) {
129123 event.guild!! .kickVoiceMember(member).queue()
0 commit comments