{"id":50745063,"url":"https://github.com/DDBKit/DDBKit","last_synced_at":"2026-06-27T23:00:49.984Z","repository":{"id":328483217,"uuid":"776105739","full_name":"DDBKit/DDBKit","owner":"DDBKit","description":"A declarative Discord bot framework","archived":false,"fork":false,"pushed_at":"2026-02-11T00:32:51.000Z","size":712,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-11T02:27:10.610Z","etag":null,"topics":["declarative-programming","discord-bots","swift"],"latest_commit_sha":null,"homepage":"https://ddbkit.llsc12.me","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DDBKit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["llsc12"],"patreon":"llsc12","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-03-22T17:35:39.000Z","updated_at":"2026-02-11T00:32:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/DDBKit/DDBKit","commit_stats":null,"previous_names":["ddbkit/ddbkit"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/DDBKit/DDBKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDBKit%2FDDBKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDBKit%2FDDBKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDBKit%2FDDBKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDBKit%2FDDBKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DDBKit","download_url":"https://codeload.github.com/DDBKit/DDBKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DDBKit%2FDDBKit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34870654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["declarative-programming","discord-bots","swift"],"created_at":"2026-06-10T20:00:38.587Z","updated_at":"2026-06-27T23:00:49.977Z","avatar_url":"https://github.com/DDBKit.png","language":"Swift","funding_links":["https://github.com/sponsors/llsc12","https://patreon.com/llsc12"],"categories":["Swift"],"sub_categories":[],"readme":"\u003cimg src=\".github/image.png\" alt=\"Logo\" align=\"right\" width=\"150\"/\u003e\n\n\u003cdiv id=\"user-content-toc\"\u003e\n  \u003cul style=\"list-style: none;\"\u003e\n    \u003csummary\u003e\n      \u003ch1\u003eDDBKit\u003c/h1\u003e\n    \u003c/summary\u003e\n  \u003c/ul\u003e\n\u003c/div\u003e\n\u003ca href=\"https://github.com/sponsors/llsc12\"\u003e\n\u003cimg src=\"https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86\" alt=\"Logo\" align=\"right\" height=\"20\"/\u003e\n\u003c/a\u003e\n\n## What is it?\nDDBKit stands for Declarative Discord Bot Kit, name proposed by [Tobias](https://github.com/tobiasdickinson). DDBKit is designed to abstract away the complexities of Discord’s API into something that feels right at home. Similar to SwiftUI, DDBKit lets you declare commands and add modifiers to create functionality in your bot. It’s kinda like [Commando](https://github.com/discordjs/commando). DDBKit relies on [DiscordBM](https://github.com/DiscordBM/DiscordBM) under the hood.\n\n## Quick Start\nAlready know what you're doing? Get started faster by using the [DDBKit Template](https://github.com/DDBKit/DDBKit-Template).\n\n## Getting started\nBegin by making a new project directory with\n```sh\nmkdir MyNewBot \u0026\u0026 cd MyNewBot\n```\nThen make a new executable package in the directory with\n```sh\nswift package init --type executable\n```\nOpen `Package.swift` in your preferred editor, and copy this configuration.\n```swift\nlet package = Package(\n  name: \"MyNewBot\",\n  platforms: [\n    .macOS(.v13)\n  ],\n  dependencies: [\n    .package(url: \"https://github.com/llsc12/DDBKit\", exact: \"0.1.4\"), // change this to latest ver\n  ],\n  targets: [\n    // Targets are the basic building blocks of a package, defining a module or a test suite.\n    // Targets can depend on other targets in this package and products from dependencies.\n    .executableTarget(\n      name: \"MyNewBot\",\n      dependencies: [\n        .product(name: \"DDBKit\", package: \"DDBKit\"),\n        .product(name: \"DDBKitUtilities\", package: \"DDBKit\"),\n        .product(name: \"DDBKitFoundation\", package: \"DDBKit\"),\n      ]\n    ),\n  ]\n)\n```\n\nYou’ve now configured the package to use DDBKit! Next, rename the file at `./Sources/main.swift` to anything that isn’t `main.swift`, such as `Bot.swift`.\n\u003cdetails\u003e\n\u003csummary\u003eWhy do this?\u003c/summary\u003e\nHaving a file named \u003ccode\u003emain.swift\u003c/code\u003e makes it the entrypoint, and code is executed at the top level. DDBKit uses a protocol that declares it’s own entrypoint, you’ll declare a struct conforming to the protocol and you’ll prefix the struct with \u003ccode\u003e@main\u003c/code\u003e. This is the simplest setup for a discord bot with DDBKit. You can run multiple clients by executing the \u003ccode\u003erun() async throws\u003c/code\u003e method on each \u003ccode\u003eDiscordBotApp\u003c/code\u003e struct you've defined.\n\u003c/details\u003e\n\nYou can now replace any existing code in your Swift file with\n```swift\nimport DDBKit\n\n@main\n\nstruct MyNewBot: DiscordBotApp {\n  init() async {\n    let httpClient = HTTPClient()\n    // Edit this as needed.\n    bot = await BotGatewayManager(\n      eventLoopGroup: httpClient.eventLoopGroup,\n      httpClient: httpClient,\n      token: \"Token Here\", // Do not store your token in your code in production.\n      largeThreshold: 250,\n      presence: .init(activities: [], status: .online, afk: false),\n      intents: [.messageContent, .guildMessages]\n    )\n    // Will be useful\n    cache = await .init(\n      gatewayManager: bot,\n      intents: .all, // it's better to minimise cached data to your needs\n      requestAllMembers: .enabledWithPresences,\n      messageCachingPolicy: .saveEditHistoryAndDeleted\n    )\n  }\n  \n  var body: [any BotScene] {\n    ReadyEvent { ready in\n      print(\"hi mom\")\n    }\n    \n    MessageCreateEvent { msg in\n      print(\"[\\(msg.author?.username ?? \"unknown\")] \\(msg.content)\")\n    }\n  }\n  \n  var bot: Bot\n  var cache: Cache\n}\n```\nCongratulations! You’ve connected to Discord as your bot and reacted to an event!\n\u003e Wanna learn the good stuff and make commands? Check out the [docs](https://ddbkit.llsc12.me/start-here/getting-started/#first-command)!\n\n\u003e [!NOTE]\n\u003e **Using Linux**? Run \u003ccode\u003eswift run\u003c/code\u003e in the project directory.\n\u003e \n\u003e **If you need another entrypoint (iOS, etc.)**; you can run a `DiscordBotApp` instance with the \u003ccode\u003erun() async throws\u003c/code\u003e function available on your Bot struct. You can use this to run multiple clients at once if needed. If deploying to an iOS device or similar, it's easier to use [DiscordBotShell](https://github.com/DDBKit/DiscordBotShell).\n\u003e\n\u003e **Don't have a bot yet?** You can create one at https://discord.com/developers/applications. Make sure your bot has the correct permissions and intents.\n\n\u003e [!WARNING]\n\u003e You cannot use logic in the `body` property; The property is only read once on startup.\n\u003e Commands are registered in batch globally or per groups with [guild targets](https://ddbkit.llsc12.me/start-here/getting-started/#first-command).\n\u003e Logic is only evaluated in defined events and commands, and their respective modifiers that accept code.\n\nYou've now got a solid place to start with your bot. Check out the [docs](https://ddbkit.llsc12.me/) for more information!\n\n## Contributing\nFeel free to work on providing more abstractions and adding general utilities.\nMy code isn't exactly amazing so if you'd like to improve it for everyone else, be sure to make a PR!\nI have a silly database thing going on. I think it might be useful but it also might be dumb and bad at large scale. If someone rewrites it to use a real database behind the scenes whilst also providing more utilities, it would be much appreciated.\n\nContributors should clone this repository and open `DDBKit.xcworkspace` as it loads the example bot alongside the DDBKit package. This way, you can test your work live whilst making changes. You can also create your own tests if you'd like.\n\nI only ask that contributions are somewhat commented in cases of dense code or wherever fit. \nUse `self` explicitly whenever it's used.\n\n## Goals\n- [x] Using builders for composable objects (main bot logic, messages etc.)\n- [x] Abstraction over common objects (eg. extending objects like Interaction with useful methods)\n- [ ] Feature parity with Discord, though this could mean anything\n- [ ] Make database good\n- [x] Linting\n\n## Sponsoring\nIf you really love this project, you should first support [DiscordBM's development](https://github.com/DiscordBM/DiscordBM) above all, considering it lies as the foundation of DDBKit.\nAfterwards, feel free to sponsor the development of DDBKit and my other projects!\n\n[![](https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86)](https://github.com/sponsors/llsc12)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDDBKit%2FDDBKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDDBKit%2FDDBKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDDBKit%2FDDBKit/lists"}