Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Not able to start discord bot api with dreambot script


    treezz

    Recommended Posts

    Hello, first time poster here, I'm trying to add discord integration to my osrs bot. I want to be able to control them via discord. But when I add either the Discord JDA package from here https://github.com/DV8FromTheWorld/JDA or the discord api package from here https://discord4j.com/ and set the discord bot to start inside the onStart() method the script fails to run. 

    This is how I'm calling the discord bot to connect.

    @Override
        public void onStart() {
            log("Starting my lil bot");
            initializeDiscord();
            log("Discord bot started");
            stopWatch.startTiming();
            MouseSettings.setSpeed(4);
            SkillTracker.start();
        }

    This is how I'm starting the discord bot:

    package com.company.discord;
    
    import discord4j.core.DiscordClient;
    import discord4j.core.GatewayDiscordClient;
    import reactor.core.publisher.Mono;
    
    public class DiscBot {
    
        public DiscBot() {
            DiscordClient client = DiscordClient.create("token here");
    
            Mono<Void> login = client.withGateway((GatewayDiscordClient gateway) -> Mono.empty());
    
            login.block();
        }
    
    }

    but when I run this I get this error output:

    8:01:59 PM: [ERROR] The script had a problem starting:
    	java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
    	at com.company.Main.initializeDiscord(Main.java:71)
    	at com.company.Main.onStart(Main.java:81)
    	at org.dreambot.api.script.AbstractScript.run(AbstractScript.java)
    	at java.base/java.lang.Thread.run(Thread.java:833)
    Caused by: java.lang.ClassNotFoundException: org.reactivestreams.Publisher
    	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    	... 4 more

     

    Has anyone been able to connect a dreambot script to discord? Could anyone help with this or have any code snippits I can look at?

    PS. when I remove the discord line the bot works fine. 

    Thanks!!!!

     

    Link to comment
    Share on other sites

    Hey there, it looks like you aren't including the dependencies into your final script jar. You mostly likely need to set up your IDE to include those dependencies, or use a build system like Maven/gradle to do that for you :)

    Link to comment
    Share on other sites

    Hey thanks for the reply! So I thought I was adding the dependencies to the jar file when I move them under the bot.jar side like I have them here:

    image.png.5adfe8a136c39b05325db9bbf3cdbf4b.png

    This looks like the discord package will be added to the jar. But I'm not sure what else I need to do. Does this look correct? I'm not using Maven but I did create a maven project to see if that would work but I was having some other issues with that one. 

    PS. sorry for the late reply, I got COVID on tuesday and was super sick all week.

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.