Discord Bot API - JDA 3.0

A simple discord bot creation API.

  1. TJPlaysNow
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    Source Code:
    https://github.com/TJPlaysNow/Discord-Bot-API---JDA
    This is an API to use for making discord bots. You can run this alongside your Minecraft server to make making a discord bot super simple.

    If you are not a developer and weren't redirected here this is probably not for you.

    To start using this API you need to create a Bot.
    Code (Text):
    public Bot bot;
    public final String TOKEN = "[Insert Token Here]";
    public final String PREFIX = "!";

    @Override
    public void onEnable() {
        bot = new Bot(TOKEN, PREFIX);
        bot.setBotThread(new ThreadSpigot(plugin));
        bot.setConsoleCommandManager(new CommandSpigotManager());
    }
    There are several things to do with this. If you don't have a Discord Bot ready to use you need to go to this link and make one.
    In order to make one you must click New App, fill out the information for how you'd like it. Now that you have an app created we want to specify to Discord that it is a Bot, click the button that says "Create Bot User". Now click the reveal token button, copy that token into the final string named TOKEN.

    Now let's add it to your Discord server. Go back to the page you just had opened and copy the client id. Now add it to the end of this link and go there, you will want to select your server and give it the permissions.
    https://discordapp.com/oauth2/authorize?permissions=2146958579&scope=bot&client_id=

    Now lets create a command for the bot. You will need to go back to your main class and in the onEnable like before we will add a basic test command.
    Code (Text):
    bot.addCommand(new ProgramCommand() {
        @Override
        public boolean run(User user, MessageChannel channel, Guild guild, String label, List<String> args) {
            channel.sendMessage("Pong!").complete();
            return false;
        }
     
        @Override
        public Permission getPermissionNeeded() {
            return Permission.MESSAGE_WRITE;
        }
     
        @Override
        public String getLabel() {
            return "Ping";
        }
     
        @Override
        public String getDescription() {
            return "A ping pong command to test connection.";
        }
    });
    This command will send a message "pong" when the command "ping" is received.

    There are some basic commands already made for you. To enable them do this after registering your bot.
    Code (Text):
    bot.addCommand(new HelpCommand());
    bot.addCommand(new MuteCommand());
    bot.addCommand(new UnmuteCommand());
    For further information check out the JavaDocs:
    (Coming Soon)


    Join my discord!
    Give me a spare dollar to keep me making great plugins!

    Please don't rate it bad due to a bug, talk to me about it first!

Recent Updates

  1. JDA Update + Activity
  2. Minor patch
  3. Final bug fixes

Recent Reviews

  1. dxcf
    dxcf
    5/5,
    Version: 3.0
    it would be great if you have maven for it lol
    ------------------------------------------------
  2. mohmedXM
    mohmedXM
    5/5,
    Version: 3.0
    100% work, it's work in beerspigot and paperspigot taco spigot etc..
    just change
    bot.setBotThread(new ThreadSpigot(plugin));
    to
    bot.setBotThread(new ThreadHandle());
    and
    bot.setConsoleCommandManager(new CommandSpigotManager());
    to
    bot.setConsoleCommandManager(new CommandConsoleManager());
    good luck!
    1. TJPlaysNow
      Author's Response
  3. Cedric..01
    Cedric..01
    5/5,
    Version: 3.0
    very good api ==================================================================
  4. ala89
    ala89
    1/5,
    Version: 2.8
    Hosting a Discord bot on a server Minecraft by pretending that they must be bound is the silliest thing I've ever heard about and any developer would tell you the same thing. Moreover, the API is totally non-flexible bad designed.
    1. TJPlaysNow
      Author's Response
      The bot api is for making bots like this possible https://www.spigotmc.org/resources/discord-minecraft-hook.44095/. Also the API is pretty much 100% flexible, you can literally rewrite everything about it. Sorry you don't believe in the idea of hosting a discord bot on a Minecraft server. It makes for an easy setup discord bot for Minecraft Discord communication, and if you'd rather you can just use it as an api for non minecraft purposes, just make a main method and make sure you extract the jars into your build when you build.
  5. KingzlyHCF
    KingzlyHCF
    3/5,
    Version: 2.8
    I love love lovee this plugin, but there is no errors and it is not running on PaperSpigot 1.8.8 :(
    1. TJPlaysNow
      Author's Response
      Hmm, that is strange. I'm glad you love the plugin! Try and send errors to the discord server or on the discussion tab first.
  6. MrBaguette07
    MrBaguette07
    3/5,
    Version: 2.8
    Hello, I'm sorry for these stars, but I could not test your API, it does not work on my network in 1.12.2, maybe there is a compatible version in 1.12.2?
    1. TJPlaysNow
      Author's Response
      What about it does not work? Have you setup another plugin that uses the api?
  7. Andre_601
    Andre_601
    1/5,
    Version: 2.4
    No plugin.yml to even run the "plugin"?
    Code looks weird.
    And since that is for devs, it's basicly useless since devs could simply implement a own JDA-instance into their plugin.
    Also you should shade the JDA-lib into your code, to prevent any issues.
    But this is just not recommended for anyone to use.
    1. TJPlaysNow
      Author's Response
      Sorry you feel this way, but if you join my discord server, you will see many implementations of this being used, including my updated Minecraft Hook Bot that was just released for testing. I did make a noobish mistake while updating my packaging system from the intellij default to maven, but I am now all finished with that and nothing around these lines should change.
  8. LamerGamerYT
    LamerGamerYT
    4/5,
    Version: 2.3
    Good but keep on getting this: [16:27:08 WARN]: [JDA MainWS-ReadThread] ERROR WebSocketClient - There was an error in the WebSocket connection
    [16:27:08 WARN]: java.lang.NoClassDefFoundError: net/dv8tion/jda/core/handle/MessageUpdateHandler$1
    [16:27:08 WARN]: at net.dv8tion.jda.core.handle.MessageUpdateHandler.handleInternally(MessageUpdateHandler.java:52)
    [16:27:08 WARN]: at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
    [16:27:08 WARN]: at net.dv8tion.jda.core.requests.WebSocketClient.onDispatch(WebSocketClient.java:1051)
    [16:27:08 WARN]: at net.dv8tion.jda.core.requests.WebSocketClient.onEvent(WebSocketClient.java:911)
    [16:27:08 WARN]: at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:890)
    [16:27:08 WARN]: at net.dv8tion.jda.core.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:1089)
    [16:27:08 WARN]: at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368)
    [16:27:08 WARN]: at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:270)
    [16:27:08 WARN]: at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:990)
    [16:27:08 WARN]: at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:749)
    [16:27:08 WARN]: at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
    [16:27:08 WARN]: at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
    [16:27:08 WARN]: at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
    1. TJPlaysNow
      Author's Response
      Uhm, I've never seen that, if you join the discord server you can discuss it with some of the other devs that also use the api! Sorry about it, and really hope that we can get it fixed :D
  9. DrOreo002
    DrOreo002
    5/5,
    Version: 1.4
    Really good plugin!. Its perfect!

    10/10 Will give this another rating if you post update :3
    1. TJPlaysNow
      Author's Response
      Thanks for the support!
  10. Nintendonatorxp
    Nintendonatorxp
    3/5,
    Version: 1.4
    shit is working bad on java 9 .. not rly nice if the example code is incompatible to my owkr
    1. TJPlaysNow
      Author's Response