Skip to content

Using DiscordBM

DDBKit is built on top of DiscordBM, a library that provides a high-level API for Discord bots. You may need to use DiscordBM directly for most functionality not covered by DDBKit.

You can use the bot instance which is of type GatewayManager to interact with Discord directly. You can access the client property on bot to get the underlying DiscordClient instance to make HTTP requests.

Command("disappearing") { i in
let msgres = try await bot.client.createMessage(channelId: i.interaction.channel_id!, payload: .init(content: "I will disappear in 3 seconds"))
.decode()
try await Task.sleep(for: .seconds(3))
try await bot.client.deleteMessage(channelId: msgres.channel_id, messageId: msgres.id)
.guardSuccess()
}

The above example demonstrates using the Discord API directly to create and delete a message.

Refer to DiscordBM’s documentation for more information on how to use the library.