commonMain.event.message.ReactionRemoveAllEvent.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kord-core-jvm Show documentation
Show all versions of kord-core-jvm Show documentation
Idiomatic Kotlin Wrapper for The Discord API
package dev.kord.core.event.message
import dev.kord.common.entity.Snowflake
import dev.kord.core.Kord
import dev.kord.core.behavior.GuildBehavior
import dev.kord.core.behavior.MessageBehavior
import dev.kord.core.behavior.channel.MessageChannelBehavior
import dev.kord.core.entity.Guild
import dev.kord.core.entity.Message
import dev.kord.core.entity.Strategizable
import dev.kord.core.entity.channel.MessageChannel
import dev.kord.core.event.Event
import dev.kord.core.supplier.EntitySupplier
import dev.kord.core.supplier.EntitySupplyStrategy
import dev.kord.core.supplier.getChannelOf
import dev.kord.core.supplier.getChannelOfOrNull
public class ReactionRemoveAllEvent(
public val channelId: Snowflake,
public val messageId: Snowflake,
public val guildId: Snowflake?,
override val kord: Kord,
override val shard: Int,
override val customContext: Any?,
override val supplier: EntitySupplier = kord.defaultSupplier,
) : Event, Strategizable {
public val channel: MessageChannelBehavior get() = MessageChannelBehavior(channelId, kord)
public val guild: GuildBehavior? get() = guildId?.let { GuildBehavior(it, kord) }
public val message: MessageBehavior get() = MessageBehavior(channelId, messageId, kord)
public suspend fun getChannel(): MessageChannel = supplier.getChannelOf(channelId)
public suspend fun getChannelOrNull(): MessageChannel? = supplier.getChannelOfOrNull(channelId)
@Deprecated(
"Deprecated in favour of getGuildOrNull() as it provides more clarity over the functionality",
ReplaceWith("getGuildOrNull()"),
DeprecationLevel.HIDDEN
)
public suspend fun getGuild(): Guild? = guildId?.let { supplier.getGuildOrNull(it) }
public suspend fun getGuildOrNull(): Guild? = guildId?.let { supplier.getGuildOrNull(it) }
public suspend fun getMessage(): Message = supplier.getMessage(channelId = channelId, messageId = messageId)
public suspend fun getMessageOrNull(): Message? = supplier.getMessageOrNull(channelId = channelId, messageId = messageId)
override fun withStrategy(strategy: EntitySupplyStrategy<*>): ReactionRemoveAllEvent =
ReactionRemoveAllEvent(channelId, messageId, guildId, kord, shard, customContext, strategy.supply(kord))
override fun toString(): String {
return "ReactionRemoveAllEvent(channelId=$channelId, messageId=$messageId, guildId=$guildId, kord=$kord, shard=$shard, supplier=$supplier)"
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy