Skip to content

Releases: DiscordKt/DiscordKt

Checkpoint

28 Jan 23:45
07e524f
Compare
Choose a tag to compare

DiscordKt 0.24.0
A safe resting point for those trapped on the eternal snapshot

Breaking
me.jakejmattson.discordkt.extensions -> me.jakejmattson.discordkt.util
Remove deprecated: command, dmCommand, globalCommand, Data.save()
Change behavior of TimeArg to return Int
Merge actionButton into editButton

Misc
Add Spanish (Language.ES) locale pack
Add User.defaultPfpUrl
Add kord configuration builder
Add mention function for slash commands
Add check for missing package in project
Conditional discriminators in username functions

Fixes
Fix CPU spike when no prefix is provided
Fix disabling menu buttons
Remove auto-register MessageCreateEvent

Style and QoL

28 Aug 04:59
ed61a7c
Compare
Choose a tag to compare

Style
Replace mutable properties with function arguments

//Old
slash("name") {
    description = "description"
    requiredPermissions = Perms.Staff
}

//New
slash("name", "description", Perms.Staff)

Replace the edit+save design for Data with an edit function

//Old
config.property = value
config.save()

//New
config.edit { property = value }

Misc
Add conversation support for slash commands
Modal prompts now return an interaction and all input
Allow full customization of conversation select menus
Add Turkish (Language.TR) locale pack
Add Message.replySilently
Add DiscordRegex constants
Register mentionEmbed as a slash command

Fixes
Give context commands a requiredPermissions property
Fix NPE in EveryArg when input was empty
Fix NPE in MessageArg when creating examples
List subcommands in the help menu

Bot Properties

10 Aug 23:45
1339986
Compare
Choose a tag to compare

Properties
Automatically read a bot.properties resource on startup
Properties can be accessed via discord.properties.bot
Rename discord.versions -> discord.properties.library
Add a startup property to check uptime

Logging
Provide a default mentionEmbed with bot properties
Add bot property name and version to startup log
Report if bot.properties file is missing
Log commands by version (text/slash/sub)

Properties Creation
The following Gradle entry will write properties on build

import java.util.Properties

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"

    Properties().apply {
        setProperty("name", project.name)
        setProperty("description", project.description)
        setProperty("version", version.toString())
        setProperty("url", "https://github.com/DiscordKt/DiscordKt")

        store(file("src/main/resources/bot.properties").outputStream(), null)
    }
}

New feature fixes

04 Aug 22:03
e4f809f
Compare
Choose a tag to compare

Initialize args value when using a ContextCommand.
Support subcommands in the automatic documentation.
Add autocomplete support to subcommands.

Subcommands

04 Aug 06:09
12346fe
Compare
Choose a tag to compare

Renamed Builders
command -> text
globalCommand -> globalText
dmCommand -> dmText

New Builders
Add message and user builders for context commands

message(displayText = "Get Message Link", slashName = "Link", description = "Get a message's jump link") {
    respond(arg.jumpLink() ?: "<Unknown Link>")
}

user(displayText = "Show User Info", slashName = "Info", description = "Get information for the target user") {
    respond(arg.descriptor())
}

Sub-commands
Added subcommand builder and sub for commands

fun mathSubcommand() = subcommand("math") {
    sub("Add") {
        description = "Add two numbers together"
        execute(IntegerArg("First"), IntegerArg("Second")) {
            respond(args.first + args.second)
        }
    }

    sub("Sub") {
        description = "Subtract two numbers"
        execute(IntegerArg("First"), IntegerArg("Second")) {
            respond(args.first - args.second)
        }
    }

    sub("Mult") {
        description = "Multiply two numbers together"
        execute(IntegerArg("First"), IntegerArg("Second")) {
            respond(args.first * args.second)
        }
    }
}

Slash and permissions v2

27 Jul 23:40
9e68f4b
Compare
Choose a tag to compare

This release adds more support for the newest discord features.

Name Changes
ArgumentType -> Argument
Create command package
Remove api package

Configuration
allowMentionPrefix -> mentionAsPrefix
generateCommandDocs -> documentCommands
showStartupLog -> logStartup
enableSearch -> searchCommands
Added deleteInvocation flag for deleting text commands
Added dualRegistry flag to enroll a slash command as text
Added onException block for handling exceptions
Added defaultPermissions for permission integration

Slash Commands
Support all slash datatypes
Support optional input
Support choice arguments
Support autocomplete
Support contextual user/message

Permissions
Remove existing permissions handling
Implement slash permissions v2

Data
Drop GSON in favor of kxser
Register and load in the bot block with data function

Utilities
The search functionality will now flag partial matches
Add TimeStamp and TimeStyle for generating timestamps

Discord API upgrade

11 Aug 23:24
cd7b9cd
Compare
Choose a tag to compare

Discord 0.22.0
This release brings a new API backend and support for its new features - slash commands, button components, and more.

Major breaking changes
com.gitlab.kordlib -> dev.kord
com.gitlab.kordlib.kordx -> dev.kord.x
discord.api -> discord.kord

Arguments
Add description to ArgumentType (breaks ChoiceArg)
MultipleArg(IntegerArg) -> IntegerArg.multiple()
IntegerArg.makeOptional(0) -> IntegerArg.optional(0)

Commands
Add support for slash commands.
Add support for overloaded commands.

Conversations
Split conversation logic into its own package.
Merge promptMessage and promptEmbed into prompt.
Replace promptReaction with promptButton<T>.
Add timeout as an argument to the conversation builder.
Upon timeout, ConversationResult.TIMED_OUT is returned.

Menus
Replace reaction logic with buttons.
Add button builder for page navigation.
Add editButton to edit the current page.
Add actionbutton for access to the interaction.
Add linkButton to support link buttons.

Intents
Replace intents block with a single value in the configure block.

configure {
  intents = Intents.nonPrivileged
}

Permissions
Add native permission support via an enum extending PermissionSet

enum class Permissions : PermissionSet {
    EVERYONE {
        override suspend fun hasPermission(context: PermissionContext) = true
    }
}

The enum is then registered in the configure block

configure {
  permissions(commandDefault = Permissions.EVERYONE)
}

This sets the default permission required for all commands as EVERYONE

Locale
Many internal strings can now be customized.

localeOf(Language.EN) {
    helpName = "Help"
    helpCategory = "Utility"
}

Misc
New search functionality for servers with multiple DiscordKt bots.
Remove notation for required args; use [] for optional.

Fix Coroutines

02 Nov 06:15
73d34bf
Compare
Choose a tag to compare

Avoid bug that caused a fatal coroutine error in listeners.

Gateway Intents

29 Oct 04:39
5cf9b07
Compare
Choose a tag to compare

Add support for configuring Discord gateway intents.

Fix Flexible Commands

26 Oct 05:05
58d73e0
Compare
Choose a tag to compare

Fixes
Fix bug in flexible commands when an error occurs.
Convert arg examples to mentions where applicable.
Document or suppress all remaining members.
Upgrade dokka; downgrade coroutines.