{"id":19149156,"url":"https://github.com/flytegg/neptune","last_synced_at":"2025-05-07T04:41:04.884Z","repository":{"id":63435052,"uuid":"567898536","full_name":"flytegg/neptune","owner":"flytegg","description":"An annotation-based slash command framework for JDA.","archived":false,"fork":false,"pushed_at":"2024-08-17T13:09:04.000Z","size":74,"stargazers_count":24,"open_issues_count":12,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T06:24:29.969Z","etag":null,"topics":["bot","command-framework","discord","discord-bot","java","jda","kotlin"],"latest_commit_sha":null,"homepage":"https://flyte.gg","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flytegg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2022-11-18T21:10:40.000Z","updated_at":"2025-02-28T23:49:13.000Z","dependencies_parsed_at":"2023-01-28T03:31:20.366Z","dependency_job_id":"a0d7a8cc-56e3-46e0-b4d5-fabd4c326170","html_url":"https://github.com/flytegg/neptune","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flytegg%2Fneptune","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flytegg%2Fneptune/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flytegg%2Fneptune/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flytegg%2Fneptune/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flytegg","download_url":"https://codeload.github.com/flytegg/neptune/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249727371,"owners_count":21316639,"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":["bot","command-framework","discord","discord-bot","java","jda","kotlin"],"created_at":"2024-11-09T08:06:55.366Z","updated_at":"2025-04-19T15:32:22.939Z","avatar_url":"https://github.com/flytegg.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Neptune\n\nAn annotation-based slash command framework for JDA.\n\nFor questions, support or to chat with the team, come join the Discord:\n\n[![Discord Banner](https://discordapp.com/api/guilds/835561528299880518/widget.png?style=banner2)](https://discord.gg/flyte)\n\n## How to Use\n\nYou can create an instance of Neptune using the Builder, this allows you to control some of Neptune's functionality. Below is an example of how you can use the Builder:\n```java\nnew Neptune.Builder(jda, this)\n        .addGuilds(guild1, guild2)\n        .clearCommands(true),\n        .registerAllListeners(true)\n        .create();\n```\n\n*Note: If you do not specify any guilds, commands will be registered/unregistered globally (this can take up to 2 hours due to a Discord limitation).*\n\n## Commands\nBelow is a working example of how to register a slash command. Use the `@Command` annotation and specify the command name, description and the required permissions.\n\nAnnotate a method with `@Command` (the method can be called anything). The first parameter must be the SlashCommandInteractionEvent, from there you can list your arguments/options as parameters like shown below.\n\n\u003e This example will register \"/ban \u0026lt;user\u003e [reason]\".\n\n```java\n@Command(\n        name = \"ban\",\n        description = \"Ban a member\",\n        permissions = {Permission.MANAGE_CHANNEL, Permission.ADMINISTRATOR}\n)\npublic void onBan(SlashCommandInteractionEvent event, @Description(\"The user you wish to mute\") User user, @Optional String reason) {\n\n}\n```\nParameters can be annotated with the following:\n* `@Optional` - Makes the argument not required\n* `@Description` - Allows you to specify a description for the argument/option (if not specified will be name of argument)\n\nOnce a command is run, the method will return all values. As default slash command behaviour dictates, you will have 3 seconds to respond to the command through SlashCommandInteractionEvent. See the JDA wiki for [more info](https://github.com/DV8FromTheWorld/JDA/wiki/Interactions).\n\nIf you want to unregister commands, add the `clearCommands` to the Builder as `true`, and remove the `@Command` annotation from your command.\n\n## Listeners\n\nIf you choose it in the builder as shown above, then Neptune will register all of your listener classes (those which extend ListenerAdapter).\n\n\n## Injection/Instantiation\nDue to limitations beyond our control, you **cannot create your own instance of a class which Neptune has**. Neptune will manage instances of all classes which contain its @Command annotation, its @Inject annotation and all ListenerAdapter subclasses (if you have enabled this on startup, otherwise just those that use the aforementioned annotations).\n\nThat begs the question: how do you use variables from within a command/listener without being able to pass them through a constructor? Well, Neptune offers a similar system to Spring Boot.\n\nIn your main class (the one you started Neptune in) you can setup a variable to be accessible across your project by annotating either a method or field, as shown below:\n\n```java\n@Instantiate\npublic TestClass testClass() {\n    return new TestClass();\n}\n// or\n@Instantiate\nprivate final TestClass testClass = new TestClass();\n```\nThat object will then be accessible across your whole project. To use it elsewhere, create a variable with an identical name to the method and Neptune will beam the value through, as seen below:\n```java\n@Inject\nprivate TestClass testClass;\n```\n\n## Terminating\n\nTerminating Neptune will prevent all registered commands from running. To do this, you can run:\n```java\nNeptune#terminate();\n```\n\nIf you struggle with anything, there is a working example in the test folder.\n\n## Installation\n\n**The latest version can be found in the releases tab on the right.**\n\nMaven\n```xml\n\u003crepository\u003e\n    \u003cid\u003eflyte-repository-releases\u003c/id\u003e\n    \u003cname\u003eFlyte Repository\u003c/name\u003e\n    \u003curl\u003ehttps://repo.flyte.gg/releases\u003c/url\u003e\n\u003c/repository\u003e\n```  \n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003egg.flyte\u003c/groupId\u003e\n    \u003cartifactId\u003eneptune\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGradle (Kotlin DSL)\n```kt\nmaven {\n    name = \"flyteRepositoryReleases\"\n    url = uri(\"https://repo.flyte.gg/releases\")\n}\n        \nimplementation(\"gg.flyte:neptune:VERSION\")\n```  \n\n## Contributing\n\nContributions are always welcome. Please open a pull request and try to maintain a similar code quality and style.\n\n\n## Authors\n\nThis framework was made for the team at [Flyte](https://flyte.gg), but we decided to release it in case anyone found any use from it.\n\n\n\n- Created by [Stephen (sttephen)](https://github.com/sttephen) \u0026 [Josh (joshbker)](https://github.com/joshbker)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflytegg%2Fneptune","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflytegg%2Fneptune","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflytegg%2Fneptune/lists"}