Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for InteractionCreateEvent in LiveMessage #485

Merged
merged 2 commits into from
Jan 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/src/main/kotlin/live/LiveMessage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import dev.kord.core.entity.ReactionEmoji
import dev.kord.core.event.Event
import dev.kord.core.event.channel.ChannelDeleteEvent
import dev.kord.core.event.guild.GuildDeleteEvent
import dev.kord.core.event.interaction.InteractionCreateEvent
import dev.kord.core.event.interaction.MessageCommandInteractionCreateEvent
import dev.kord.core.event.message.*
import dev.kord.core.live.exception.LiveCancellationException
import dev.kord.core.supplier.EntitySupplyStrategy
Expand Down Expand Up @@ -162,6 +164,9 @@ public class LiveMessage(
is ChannelDeleteEvent -> event.channel.id == message.channelId

is GuildDeleteEvent -> event.guildId == guildId

is MessageCommandInteractionCreateEvent -> event.interaction.messages.keys.contains(message.id)
is InteractionCreateEvent -> event.interaction.data.message.value?.id == message.id
else -> false
}

Expand All @@ -181,6 +186,9 @@ public class LiveMessage(
is ChannelDeleteEvent -> shutDown(LiveCancellationException(event, "The channel is deleted"))

is GuildDeleteEvent -> shutDown(LiveCancellationException(event, "The guild is deleted"))

is MessageCommandInteractionCreateEvent -> Unit
is InteractionCreateEvent -> Unit
else -> Unit
}

Expand Down