Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve slash command API and add support for components (#310)
* Make slash command creation eager createGuildApplicationCommands and createGlobalApplicationCommands should eagerly create new commands to be more in line with the rest of the API * Fix typo in InteractionBehavior ackowledgePublic -> acknowledgePublic * Don't compute supplier in InteractionBehavior It's a waste of resources, and might result in unexpected behavior for non-Kord suppliers. * Specify withStrategy for Interactions Return types are important! * Introduce type to command options Also add Mentionable. Seems like Discord consistently tells us what kind of option an object is via the type field, this allows us to more clearly represent the json data in the lower level APIs. I ended up deleting DiscordOptionValue and replacing it with a more fleshed out CommandArgument. * Add KordDsl to builders * Add allowedMentions builder functions * Add permission edits to guild commands * Make full member available for guild contexts * Support buttons/components (#303) * Add new API models and properties * Add new InteractionCallbackType * Add ability to send components * Update core entities * Update tests * Add @KordPreview annotations * Convert don't trust doc comments to normal comments * Fix compilation issue * Optimize interaction serializing * Add builder * Fix tests * Apply some requested changes * Hopefully fix formatting * Make builders enforce Discord restrictions * Improve builders again * Remove LinkButtonBuilder.style * Improve builders - Add components to more supported builders - Make required fields parameters - Make builders appending * Update deprecated message (#280) * Expose the creation of application commands behavior (#281) * Fix GuildUpdate core handling (#284) * Expose the creation of application commands behavior * Fix type of emitted event * Sealed message types (#282) * Expose the creation of application commands behavior * Make message types sealed * make Unknown a class * Add missing message types * make MessageTypeSerializer internal * Add buttons to Activity (#287) * Add buttons to Activity * Also pass buttons in constructor * Add missing fields to Guild (#288) * Add missing fields to Guild - Add welcome_screen - Add nsfw * Fix failing tests * Fix another failing tests * Add Message.applicationId (#289) * Message interaction (#283) * Expose the creation of application commands behavior * Add interaction message * Apply suggestions * reference the MessageInteraction in docs * Implement Strategizable for MessageInteraction * cache user from interaction message * Fix compilation errors * Fix withStrategy return type Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> * Implement Stage instances (#291) * Add low-level implementation of stage instances * Add helper functions * Add core entities and api representations * Expose creation of StageInstanceBehavior to unsafe - Revert outdated change * Final additions - Add StageInstanceBehavior.asStageInstance - Fix compiler issue - Add StageChannelBehavior.getStageInstance() * Add StageInstances to EntitySupplier.kt * Add StageInstances to EntitySupplier.kt * Fix typo * Apply requested changes * Fix return type of channel in VoiceState (#295) * Fix return type of channel in VoiceState * Fix GuildService#modifyVoiceState endpoint * Fix MessageInteraction#user id * Add missing session start limit field (#306) - Adds the max_concurrency field to the session start limit data class * Update to Kotlin 1.5 (#299) * Update to 1.5.0-RC * trigger on branch pushes * Port to Kotlin 1.5 (#268) * Port dependencies to Kotlin 1.5 - Convert AbstractRateLimiter.AbstractRequestToken to a static rather than an inner class due to a compiler bug - Downgrade kx.ser-json to 1.0.0 to avoid a compiler bug - Bump other Kotlin dependencies to latest fixup! Port dependencies to Kotlin 1.5 - Convert AbstractRateLimiter.AbstractRequestToken to a static rather than an inner class due to a compiler bug - Downgrade kx.ser-json to 1.0.0 to avoid a compiler bug - Bump other Kotlin dependencies to latest * Replace deprecated kotlin.time APIs * Replace more deprecated APIs & inline classes * Replace deprecated usage of time API in tests * Possibly fix test Co-authored-by: Hope <34831095+HopeBaron@users.noreply.github.com> * Port to Kotlin 1.5 - Bump dependencies to 1.5 recommended versions - Remove inline classes in favor of value classes - Add required opt-ins - Migrate some more deprecated apis * Fix some gradle issues * Fix Gradle compilation issue * Remove documentationFileName as the new dokka version doesn't support it anymore and there is no replacement yet * Port kotlinx.serialization to 1.2.0 (#279) * Port kotlinx.serialization to 1.2.0 - Convert local classes to top level classes (See Kotlin/kotlinx.serialization#1472) - Improve handling of empty JSON bodies (See Kotlin/kotlinx.serialization#678) - Fix Failing Command test * Fix failing test * Properly decode null in gateway events (#286) * Properly decode null in gateway events * Update gateway/src/main/kotlin/Event.kt Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> * Update Kotlinx.serialization (#290) * Update Kotlin 1.5 branch to upstream (#292) * Implement voice stage channel (#239) * compute All * implement rest endpoints * JSON representation * implement core representation * handle stage channels * Apply suggestions Co-authored-by: BartArys <mysterybtdn@gmail.com> * Remove duplicated factory function Co-authored-by: BartArys <mysterybtdn@gmail.com> * add documentation * Document the requestToSpeak variable Co-authored-by: BartArys <mysterybtdn@gmail.com> * Fix CI triggers * Add "Competing" activity type (Fix #270) (#272) * Make Updatestatus activities not-null (#274) As per Discord's documentation: discord/discord-api-docs#2789 * Fix memory issues related to Permission combining (#277) * Do not octuple bitset size on copy the pure plus and minus function create a new array to work with, this incorrectly created an array of a size equal to the amount of bits that were allocated, instead the amount of longs. Thus, octupling the internal size. * Optimize Permission All The All Permission folded each DiscordBitSet of each value into eachother, resulting in n + 1 bitsets being created. This commit changes that to use the internal `add` which instead, which only mutates the single bitset created. * Add Stream permission It was missing * Add Permission All regression tests * Update deprecated message (#280) * Expose the creation of application commands behavior (#281) * Fix GuildUpdate core handling (#284) * Expose the creation of application commands behavior * Fix type of emitted event * Sealed message types (#282) * Expose the creation of application commands behavior * Make message types sealed * make Unknown a class * Add missing message types * make MessageTypeSerializer internal * Add buttons to Activity (#287) * Add buttons to Activity * Also pass buttons in constructor * Add missing fields to Guild (#288) * Add missing fields to Guild - Add welcome_screen - Add nsfw * Fix failing tests * Fix another failing tests * Add Message.applicationId (#289) Co-authored-by: Hope <34831095+HopeBaron@users.noreply.github.com> Co-authored-by: BartArys <mysterybtdn@gmail.com> Co-authored-by: HopeBaron <truehope9000@gmail.com> Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> Co-authored-by: Noah Hendrickson <noah@noahhendrickson.com> * Fix broken CI (#293) * Migrate to kotlinx-datetime (#297) * Migrate API code to kotlinx-datetime * Update tests * Remove dead code * Replace iso serializing with kx.dt * Bump dependencies to Kotlin 1.5.10 (#305) * Bump dependencies to Kotlin 1.5.10 - Fix sample code * Update remaining dependencies * Update ktor to 1.6.0 Co-authored-by: HopeBaron <truehope9000@gmail.com> Co-authored-by: Michael Rittmeister <michael@rittmeister.in> Co-authored-by: Hope <34831095+HopeBaron@users.noreply.github.com> Co-authored-by: Noah Hendrickson <noah@noahhendrickson.com> * Filter out non-guilds when fetching rest guilds (#301) This is a side-effect from the system we currently employ when it comes to creating channels. Unknown channels are instantiated as an anonymous channel without hierarchy. While we could assume it is a guild channel, it's not in actuality. So the solution, as we did with cache, is to filter out channels that don't inherit the hierarchy. * Improve builders again - Merge in upstream * Fix builder requirements - Fix error when sending a emoji button * Fix merge related syntax errors * Restore default sample * Fix formatting isssue in documentation Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> * Max component list a val Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> * Apply requested changes * No longer make DiscordInteraction a sealed class * Fix DiscordInteraction serialization * Add some documentation for components * Remove unused imports from builder Co-authored-by: Noah Hendrickson <noah@noahhendrickson.com> Co-authored-by: Hope <34831095+HopeBaron@users.noreply.github.com> Co-authored-by: Bart Arys <BartArys@users.noreply.github.com> Co-authored-by: 2D <gino@dimensional.fun> Co-authored-by: HopeBaron <truehope9000@gmail.com> * Add core versions of components * Restructure and document ButtonBuilder * Remove ActionRowContainerBuilder * Make ComponentInteraction message nullable ephemeral messages in the interaction contain a id, which is not a message id, and the flags. We can't construct a behaviour from this (since the id isn't real), so I decided to drop the data if the message is ephemeral. * Add missing components to interaction builders * Add missing ComponentInteraction behavior * Fix withStrategy for ComponentInteractionBehavior * Implement ComponentInteractionBehavior * Move component builders directory We use singular for package names * Fix interaction embeds optionality * Make CommandInteraction#guildId optional * Make MessageModifyBuilder components vals Co-authored-by: Michael Rittmeister <michael@rittmeister.in> Co-authored-by: Noah Hendrickson <noah@noahhendrickson.com> Co-authored-by: Hope <34831095+HopeBaron@users.noreply.github.com> Co-authored-by: 2D <gino@dimensional.fun> Co-authored-by: HopeBaron <truehope9000@gmail.com>
- Loading branch information