ddiscord 0.2.0
UDA-first Discord bot library for D
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
ddiscord
ddiscord is a modular Discord bot engine for D with a UDA-first public API.
The refactored design in this repository treats UDAs as the primary way to declare:
- commands and command options
- hybrid or slash-only routing
- permission gates and rate limits
- stateful handler groups with service injection
- Lua plugin descriptors and host APIs exposed to Lua
Current Status
The library currently ships a working core aimed at real bot usage:
- real Discord REST calls over
requests - real Discord gateway sessions over
aurora-websocket+ TLS sockets - command sync, prefix handling, slash-command handling, non-command interaction events, modal replies, follow-up/edit interaction replies, rate limits, cache/state, and scheduled tasks
- file-based Lua plugin loading with sandboxed execution and capability-gated host APIs
- runnable example bots in
examples/
Example
import ddiscord;
import std.path : buildPath;
@Command("ping", description: "Check the bot latency", routes: CommandRoute.Prefix)
void handlePing(CommandContext ctx)
{
ctx.reply("Pong!").await();
}
void main()
{
auto env = loadEnv(buildPath("examples"));
auto client = new Client(ClientConfig(
token: env.get!string("DISCORD_TOKEN", env.require!string("TOKEN")),
intents: cast(uint) (GatewayIntent.Guilds | GatewayIntent.GuildMessages | GatewayIntent.MessageContent),
prefix: "!"
));
client.registerAllCommands!handlePing();
client.run();
client.wait();
}
Lua
Lua integrations are also attribute-driven:
@LuaPlugindeclares the host-side descriptor for a Lua bundle@LuaExposemarks D functions or methods that may be injected into Lua- sandbox profile and permission grants decide what is actually visible at runtime
- untrusted scripts only receive safe proxy tables and capability-gated functions
- file-based plugins can be loaded from
plugin.json+.luaentrypoints and executed during client startup
Docs
- docs/index.md for user-facing guides
- examples/README.md for runnable consoles
The client now ships with default console logging at Information level, so connection, sync, owner-configuration warnings, command failures, and plugin lifecycle problems are visible without extra setup. Successful command timing logs are available at Debug.
- 0.2.0 released 6 days ago
- soloverdrive/ddiscord
- MIT
- Authors:
- Dependencies:
- aurora-websocket, requests
- Versions:
-
Show all 5 versions0.3.3 2026-Apr-25 0.3.2 2026-Apr-23 0.3.0 2026-Apr-23 0.2.0 2026-Apr-19 ~main 2026-Apr-25 - Download Stats:
-
-
4 downloads today
-
25 downloads this week
-
25 downloads this month
-
25 downloads total
-
- Score:
- 0.6
- Short URL:
- ddiscord.dub.pm