Skip to content

Commit

Permalink
Use MessageChannel and GuildMessageChannel instead of TextChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
Blad3Mak3r committed May 2, 2022
1 parent 4ded39c commit 72bddf0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = "tv.blademaker"
val versionObj = Version(0, 7, 5)
val versionObj = Version(0, 7, 6)
version = versionObj.toString()

val jdaVersion = "5.0.0-alpha.11"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package tv.blademaker.slash.context

import net.dv8tion.jda.api.entities.Guild
import net.dv8tion.jda.api.entities.GuildMessageChannel
import net.dv8tion.jda.api.entities.Member
import net.dv8tion.jda.api.entities.MessageChannel
import net.dv8tion.jda.api.entities.TextChannel

interface GuildSlashCommandContext : SlashCommandContext {
override val guild: Guild
Expand All @@ -12,4 +15,7 @@ interface GuildSlashCommandContext : SlashCommandContext {

val selfMember: Member
get() = guild.selfMember

override val channel: GuildMessageChannel
get() = super.channel as GuildMessageChannel
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ interface SlashCommandContext : InteractionContext<SlashCommandInteractionEvent>
val options: List<OptionMapping>
get() = event.options

val channel: TextChannel
get() = event.channel as TextChannel
val channel: MessageChannel
get() = event.channel

val user: User
get() = event.user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.TimeoutCancellationException
import kotlinx.coroutines.launch
import net.dv8tion.jda.api.entities.Guild
import net.dv8tion.jda.api.entities.TextChannel
import net.dv8tion.jda.api.entities.User
import net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent
Expand Down

0 comments on commit 72bddf0

Please sign in to comment.