commonMain.event.guild.IntegrationCreateEvent.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.guild
import dev.kord.common.entity.Snowflake
import dev.kord.core.Kord
import dev.kord.core.behavior.GuildBehavior
import dev.kord.core.entity.Guild
import dev.kord.core.entity.Integration
import dev.kord.core.entity.Strategizable
import dev.kord.core.event.Event
import dev.kord.core.supplier.EntitySupplier
import dev.kord.core.supplier.EntitySupplyStrategy
public class IntegrationCreateEvent(
public val integration: Integration,
override val kord: Kord,
override val shard: Int,
override val customContext: Any?,
override val supplier: EntitySupplier = kord.defaultSupplier,
) : Event, Strategizable {
public val guildId: Snowflake get() = integration.guildId
public val guild: GuildBehavior get() = integration.guild
public suspend fun getGuild(): Guild = supplier.getGuild(guildId)
public suspend fun getGuildOrNull(): Guild? = supplier.getGuildOrNull(guildId)
override fun withStrategy(strategy: EntitySupplyStrategy<*>): IntegrationCreateEvent =
IntegrationCreateEvent(integration, kord, shard, customContext, strategy.supply(kord))
override fun toString(): String = "IntegrationCreateEvent(integration=$integration, kord=$kord, shard=$shard, " +
"customContext=$customContext, supplier=$supplier)"
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy