{"id":15688328,"url":"https://github.com/fuma-nama/jdak","last_synced_at":"2025-05-07T21:01:33.733Z","repository":{"id":63409619,"uuid":"567207924","full_name":"fuma-nama/jdak","owner":"fuma-nama","description":"A Light-Weight, Fast, Flexible Command framework for JDA written in Kotlin","archived":false,"fork":false,"pushed_at":"2023-01-08T09:46:15.000Z","size":99,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-04T21:10:52.621Z","etag":null,"topics":["discord","java","jda","jda-command","jda-command-handler","jda-discord","jda-framework","kotlin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fuma-nama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-17T09:56:00.000Z","updated_at":"2023-12-08T16:14:11.000Z","dependencies_parsed_at":"2023-02-08T05:25:26.814Z","dependency_job_id":null,"html_url":"https://github.com/fuma-nama/jdak","commit_stats":null,"previous_names":["fuma-nama/jdak"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fuma-nama%2Fjdak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fuma-nama%2Fjdak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fuma-nama%2Fjdak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fuma-nama%2Fjdak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fuma-nama","download_url":"https://codeload.github.com/fuma-nama/jdak/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954376,"owners_count":21830902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["discord","java","jda","jda-command","jda-command-handler","jda-discord","jda-framework","kotlin"],"created_at":"2024-10-03T17:57:59.374Z","updated_at":"2025-05-07T21:01:33.505Z","avatar_url":"https://github.com/fuma-nama.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JDAK - JDA Command Framework in Kotlin\nA Light-Weight, Fast, Flexible, Functional Programming Command framework for [JDA](https://github.com/DV8FromTheWorld/JDA) written in **Kotlin**\n\n- High performance\n- Support all Application Commands\n- Auto complete, Middlewares and more!\n- Functional Programming style\n\n## Installation\nMaven\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.sonmoosans\u003c/groupId\u003e\n    \u003cartifactId\u003ejdak\u003c/artifactId\u003e\n    \u003cversion\u003e1.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\nGradle\n```\nimplementation 'io.github.sonmoosans:jdak:1.2.0'\n```\n## Getting Started\n```kotlin\nval jda = JDABuilder.createDefault(System.getenv(\"TOKEN\"))\n    .build()\n    .awaitReady()\n\nJDAK.global(jda) {\n    //put your global commands here\n}\n\nJDAK.guilds(jda, guilds) { \n    //put your guild-only commands here\n}\n```\n\n### Creating a Slash command\n```kotlin\nslashcommand(\"hello\", \"Say hello\") {\n    //options\n    val text = string(\"text\", \"text to send\")\n    val size = int(\"size\", \"Size of text\").optional()\n    \n    //handle interaction events\n    onEvent {\n        event.reply(\"${text.value} in size of ${size.value}\").queue()\n    }\n}\n```\n### Creating a Context command\n```kotlin\nusercommand(\"Test\") {\n    it.reply(\"Hello World\").queue()\n}\n\nmessagecommand(\"Test\") {\n    it.reply(\"Hello World\").queue()\n}\n```\n### Nested Slash commands\nFor more information, read Discord's [documentation](https://discord.com/developers/docs/interactions/application-commands)\n```kotlin\n//root command\nslashcommand(\"test\", \"debug commands\") {\n    //subcommand group\n    group(\"beta\", \"Beta features\") {\n        //subcommand\n        subcommand(\"kill\", \"Kill someone\") {\n            val user = user(\"user\", \"The selected user\")\n            \n            onEvent {\n                event.reply(\"Killed ${user.value.asMention}\").queue()\n            }\n        }\n    }\n}\n```\n\n## Auto Complete\nWe have built-in support for auto-complete which allows you to setup auto-complete in few lines of code\n\n```kotlin\nslashcommand(\"hello\", \"Say hello\") {\n    val text = string(\"text\", \"text to send\")\n        .autoComplete {\n            mapOf(\n                \"Hello\" to \"World\",\n                \"Money\" to \"Shark\"\n            )\n        }\n\n    onEvent {\n        event.reply(text.value).queue()\n    }\n}\n```\n\n## Localizations\nWe support localizations for all Application commands\n```kotlin\nmessagecommand(\"Test\", mapOf(DiscordLocale.CHINESE_TAIWAN to \"測試\")) {\n    it.reply(\"Hello World\").queue()\n}\n\nslashcommand(\"test\", \"debug commands\") {\n    nameLocale = mapOf(\n        DiscordLocale.CHINESE_TAIWAN to \"測試\"\n    )\n\n    onEvent {\n        event.reply(\"Killed ${target.value.asMention}\").queue()\n    }\n}\n```\n\n## Middleware\nMiddleware can be used to check for permissions when the user uses specified commands \u003cbr\u003e\nIt allows you to control the event handler for each command\n\n```kotlin\n//Check if the bot has admin permissions\nmiddleware({ event, next -\u003e\n    val member = event.member\n\n    if (member == null) {\n        println(\"Outside of guild\")\n    } else if (member.permissions.contains(Permission.ADMINISTRATOR)) {\n        println(\"Are you admin!\")\n    } else {\n        println(\"Ignore event: Missing permissions\")\n\n        return@middleware\n    }\n\n    next() //call the next handler\n}) {\n    protectedCommands()\n}\n```\n\n## Permissions\nJDAK also supports to set `guildOnly` and `permissions` options\n```kotlin\nmessagecommand(\"Test\",\n    guildOnly = true,\n    permissions = DefaultMemberPermissions.enabledFor(Permission.ADMINISTRATOR)\n) {\n    it.reply(\"Hello World\").queue()\n}\n\nslashcommand(\"test\", \"debug commands\") {\n    guildOnly = true\n    permissions = DefaultMemberPermissions.enabledFor(Permission.ADMINISTRATOR)\n    \n    val target = user(\"target\", \"The target to kill\")\n    \n    onEvent {\n        event.reply(\"Killed ${target.value.asMention}\")\n            .queue()\n    }\n}\n```\n\n### Limit\nWe only support Application commands, text commands are not supported","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuma-nama%2Fjdak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuma-nama%2Fjdak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuma-nama%2Fjdak/lists"}