Package-level declarations

Types

Link copied to clipboard
object Colors

A collection of convenience methods and predefined colors for working with the color field in embeds.

Link copied to clipboard
annotation class DiskordInternals

Denotes an internal Diskord API.

Link copied to clipboard

Properties

Link copied to clipboard

Shortcut to get the User.id of the Message.author.

Link copied to clipboard
const val discordCdn: String

The host of the discord content delivery network.

Link copied to clipboard

Convenience method to check if a user has a custom avatar.

Link copied to clipboard

Convenience method to check if an emoji is a custom emoji.

Link copied to clipboard

Shortcut to check if a message is from a bot.

Link copied to clipboard

Shortcut to check if a message is from a user.

Link copied to clipboard

Shortcut to check if a message is from a webhook.

Link copied to clipboard

Determine if the channel type represents a thread.

Link copied to clipboard

Convenience method to check if an emoji is a Unicode emoji.

Link copied to clipboard

Convenience method to turn a channel into a formatted mention for chat.

Convenience method to turn a role into a formatted mention for chat.

Convenience method to turn a user into a formatted mention for chat.

Link copied to clipboard

Convenience method to convert an emoji object into a chat formatted emoji.

Link copied to clipboard

Shortcut to get the Message.content split into words.

Functions

Link copied to clipboard
suspend fun ChannelClient.addMessageReaction(messageId: String, emojiId: String, emojiName: String)

Adds a reaction to the specified message.

Link copied to clipboard

Add a user to the current thread.

Link copied to clipboard
suspend fun GuildClient.changeNickname(nickname: String)

Changes the user's nickname in this client's guild.

suspend fun GuildClient.changeNickname(userId: String, nickname: String)

Changes a user's nickname in this client's guild.

Link copied to clipboard

Compute the permissions for the given guild member in the channel in the guild. Takes into account the permission overwrites and whether or not the user is an administrator.

suspend fun computePermissions(user: User, channel: GuildChannel, restClient: RestClient): Permissions

Compute the permissions for the given user in the channel. Takes into account the permission overwrites and whether the user is an administrator.

Link copied to clipboard

Create a thread from an existing message.

Link copied to clipboard

Fetches all guilds from the GuildClient over potentially multiple API calls

Link copied to clipboard
fun Emoji.gif(size: Int? = null): String?

Gets the url of the emoji in GIF format, null if the emoji is a unicode character.

Link copied to clipboard
fun User.gifAvatar(size: Int? = null): String?

Gets the url of the user's avatar in GIF format.

Link copied to clipboard
fun User.jpgAvatar(size: Int? = null): String?

Gets the url of the user's avatar in JPG format.

Link copied to clipboard
fun Guild.jpgIcon(size: Int? = null): String?

Gets the url of the guild icon in JPG format. Null if there is no custom icon.

fun PartialGuild.jpgIcon(size: Int? = null): String?

Gets the url of the guild icon in PNG format. Null if there is no custom icon.

Link copied to clipboard
fun Guild.jpgSplash(size: Int? = null): String?

Gets the url of the guild splash in JPG format. Null if there is no splash.

Link copied to clipboard
suspend fun InteractionClient.messageResponse(interactionId: String, message: String, ephemeral: Boolean)

Convenience method for responding to an interaction with a message

Link copied to clipboard
fun Emoji.png(size: Int? = null): String?

Gets the url of the emoji in PNG format, null if the emoji is a unicode character.

Link copied to clipboard
fun User.pngAvatar(size: Int? = null): String

Gets the url of the user's avatar in PNG format.

Link copied to clipboard
fun User.pngDefaultAvatar(size: Int? = null): String

Gets the url of the user's default avatar in PNG format.

Link copied to clipboard
fun Guild.pngIcon(size: Int? = null): String?
fun PartialGuild.pngIcon(size: Int? = null): String?

Gets the url of the guild icon in PNG format. Null if there is no custom icon.

Link copied to clipboard
fun Guild.pngSplash(size: Int? = null): String?

Gets the url of the guild splash in PNG format. Null if there is no splash.

Link copied to clipboard

Remove a user from the current thread.

Link copied to clipboard
suspend fun ChannelClient.sendEmbed(message: String = "", components: List<ActionRow>? = null, block: Embed.() -> Unit): Message

Calls ChannelClient.createMessage for embedded messages without needing to create a CreateMessage object first. Also accepts a lambda that can be used to configure an Embed object.

Link copied to clipboard
suspend fun ChannelClient.sendEmbeddedImage(message: String = "", image: FileData, block: Embed.() -> Unit): Message

Calls ChannelClient.createMessage for embedded messages and images without needing to create a CreateMessage object first. Also accepts a lambda that can be used to configure an Embed object.

Link copied to clipboard
suspend fun ChannelClient.sendEmbeddedImageReply(message: Message, reply: String = "", image: FileData, block: Embed.() -> Unit): Message

Calls ChannelClient.createMessage to reply to a specific text message with an embedded message and image without needing to create a CreateMessage object first. Also accepts a lambda that can be used to configure an Embed object.

Link copied to clipboard
suspend fun ChannelClient.sendEmbeddedReply(message: Message, reply: String = "", components: List<ActionRow>? = null, block: Embed.() -> Unit): Message

Calls ChannelClient.createMessage to reply to a specific text message with an embedded message without needing to create a CreateMessage object first. Also accepts a lambda that can be used to configure an Embed object.

Link copied to clipboard
suspend fun ChannelClient.sendFile(data: FileData, comment: String = ""): Message

Calls ChannelClient.createMessage for to attach a file without needing to create a CreateMessage object first.

suspend fun ChannelClient.sendFile(file: File, comment: String = ""): Message
suspend fun ChannelClient.sendFile(path: Path, comment: String = ""): Message

Calls ChannelClient.createMessage for text messages without needing to create a CreateMessage object first.

Link copied to clipboard
suspend fun ChannelClient.sendMessage(message: String = "", vararg embeds: Embed, components: List<ActionRow>? = null): Message

Calls ChannelClient.createMessage for text messages without needing to create a CreateMessage object first.

Link copied to clipboard
suspend fun ChannelClient.sendReply(message: Message, reply: String = "", embed: Embed? = null, components: List<ActionRow>? = null): Message

Calls ChannelClient.createMessage to reply to a specific text message without needing to create a CreateMessage object first.

Link copied to clipboard
fun timestamp(time: Instant, format: TimestampFormat): String

Creates a Discord compatible timestamp, which shows dates and times adjusted for each user's timezone.

Link copied to clipboard

Converts a File to a base64 encoded String.

Link copied to clipboard

Converts a File to a ByteArray.

Link copied to clipboard
fun ByteArray.toFileData(filename: String, offset: Int = 0, length: Int = size - offset): FileData

fun ByteArray.toFileData(filename: String, contentType: String?, offset: Int = 0, length: Int = size - offset): FileData

Converts a ByteArray to a FileData object.

fun File.toFileData(contentType: String? = null): FileData

Converts a File to a FileData object.

fun Path.toFileData(contentType: String? = null): FileData

Converts a Path to a FileData object.

Link copied to clipboard

Convenience method to turn a role id into a formatted mention for chat.

Link copied to clipboard
fun Instant.toTimestamp(format: TimestampFormat = TimestampFormat.RELATIVE): String

Creates a Discord compatible timestamp, which shows dates and times adjusted for each user's timezone.

Link copied to clipboard

Convenience method to turn a user id into a formatted mention for chat.

Link copied to clipboard
fun User.webpAvatar(size: Int? = null): String?

Gets the url of the user's avatar in WEBP format.

Link copied to clipboard
fun Guild.webpIcon(size: Int? = null): String?

Gets the url of the guild icon in WEBP format. Null if there is no custom icon.

fun PartialGuild.webpIcon(size: Int? = null): String?

Gets the url of the guild icon in PNG format. Null if there is no custom icon.

Link copied to clipboard
fun Guild.webpSplash(size: Int? = null): String?

Gets the url of the guild splash in WEBP format. Null if there is no splash.

Link copied to clipboard

Shortcut to bold text.

Link copied to clipboard

Shortcut to add a italics to text.

Link copied to clipboard

Shortcut to put the code in a multi line code block.

Shortcut to put the code in a multi line code block with a language style.

Link copied to clipboard

Shortcut to put the code in a single line code block.

Link copied to clipboard

Shortcut to add a spoiler to text.

Link copied to clipboard

Shortcut to add a strikethrough to text.

Link copied to clipboard

Shortcut to add an underline to text.