-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To get the GuildOnboarding object for a Guild just call guild.getOnboarding(). see discord/discord-api-docs#5915 --------- Co-authored-by: Lukellmann <[email protected]>
- Loading branch information
1 parent
2937cbb
commit f54fdab
Showing
12 changed files
with
655 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
common/build/generated/ksp/main/kotlin/dev/kord/common/entity/OnboardingPromptType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// THIS FILE IS AUTO-GENERATED BY KordEnumProcessor.kt, DO NOT EDIT! | ||
@file:Suppress(names = arrayOf("RedundantVisibilityModifier", "IncorrectFormatting", | ||
"ReplaceArrayOfWithLiteral", "SpellCheckingInspection", "GrazieInspection")) | ||
|
||
package dev.kord.common.entity | ||
|
||
import kotlin.Any | ||
import kotlin.Boolean | ||
import kotlin.Int | ||
import kotlin.LazyThreadSafetyMode.PUBLICATION | ||
import kotlin.String | ||
import kotlin.Suppress | ||
import kotlin.collections.List | ||
import kotlinx.serialization.KSerializer | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.descriptors.PrimitiveKind | ||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor | ||
import kotlinx.serialization.descriptors.SerialDescriptor | ||
import kotlinx.serialization.encoding.Decoder | ||
import kotlinx.serialization.encoding.Encoder | ||
|
||
/** | ||
* See [OnboardingPromptType]s in the | ||
* [Discord Developer Documentation](https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types). | ||
*/ | ||
@Serializable(with = OnboardingPromptType.Serializer::class) | ||
public sealed class OnboardingPromptType( | ||
/** | ||
* The raw value used by Discord. | ||
*/ | ||
public val `value`: Int, | ||
) { | ||
public final override fun equals(other: Any?): Boolean = this === other || | ||
(other is OnboardingPromptType && this.value == other.value) | ||
|
||
public final override fun hashCode(): Int = value.hashCode() | ||
|
||
public final override fun toString(): String = | ||
"OnboardingPromptType.${this::class.simpleName}(value=$value)" | ||
|
||
/** | ||
* An unknown [OnboardingPromptType]. | ||
* | ||
* This is used as a fallback for [OnboardingPromptType]s that haven't been added to Kord yet. | ||
*/ | ||
public class Unknown( | ||
`value`: Int, | ||
) : OnboardingPromptType(value) | ||
|
||
public object MultipleChoice : OnboardingPromptType(0) | ||
|
||
public object Dropdown : OnboardingPromptType(1) | ||
|
||
internal object Serializer : KSerializer<OnboardingPromptType> { | ||
public override val descriptor: SerialDescriptor = | ||
PrimitiveSerialDescriptor("dev.kord.common.entity.OnboardingPromptType", | ||
PrimitiveKind.INT) | ||
|
||
public override fun serialize(encoder: Encoder, `value`: OnboardingPromptType) = | ||
encoder.encodeInt(value.value) | ||
|
||
public override fun deserialize(decoder: Decoder) = when (val value = decoder.decodeInt()) { | ||
0 -> MultipleChoice | ||
1 -> Dropdown | ||
else -> Unknown(value) | ||
} | ||
} | ||
|
||
public companion object { | ||
/** | ||
* A [List] of all known [OnboardingPromptType]s. | ||
*/ | ||
public val entries: List<OnboardingPromptType> by lazy(mode = PUBLICATION) { | ||
listOf( | ||
MultipleChoice, | ||
Dropdown, | ||
) | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@file:GenerateKordEnum( | ||
name = "OnboardingPromptType", valueType = INT, | ||
docUrl = "https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types", | ||
entries = [ | ||
Entry("MultipleChoice", intValue = 0), | ||
Entry("Dropdown", intValue = 1), | ||
], | ||
) | ||
|
||
package dev.kord.common.entity | ||
|
||
import dev.kord.ksp.GenerateKordEnum | ||
import dev.kord.ksp.GenerateKordEnum.Entry | ||
import dev.kord.ksp.GenerateKordEnum.ValueType.INT | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
public data class DiscordGuildOnboarding( | ||
@SerialName("guild_id") val guildId: Snowflake, | ||
val prompts: List<DiscordOnboardingPrompt>, | ||
@SerialName("default_channel_ids") val defaultChannelIds: List<Snowflake>, | ||
val enabled: Boolean, | ||
) | ||
|
||
@Serializable | ||
public data class DiscordOnboardingPrompt( | ||
val id: Snowflake, | ||
val type: OnboardingPromptType, | ||
val options: List<DiscordOnboardingPromptOption>, | ||
val title: String, | ||
@SerialName("single_select") val singleSelect: Boolean, | ||
val required: Boolean, | ||
@SerialName("in_onboarding") val inOnboarding: Boolean, | ||
) | ||
|
||
@Serializable | ||
public data class DiscordOnboardingPromptOption( | ||
val id: Snowflake, | ||
@SerialName("channel_ids") val channelIds: List<Snowflake>, | ||
@SerialName("role_ids") val roleIds: List<Snowflake>, | ||
val emoji: DiscordEmoji, | ||
val title: String, | ||
val description: String?, | ||
) |
Oops, something went wrong.