#Discord Bot Help

1 messages · Page 1 of 1 (latest)

south mantle
#

Can someone help me fix this issue?


import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;

import javax.security.auth.login.LoginException;

public class PingPongBot extends ListenerAdapter {
    public static void main(String[] args) throws LoginException {
        String token =“ My bot Token ";
        JDABuilder.createDefault(token)
                .addEventListeners(new PingPongBot())
                .build();
    }

    @Override
     public void onMessageReceived(MessageReceivedEvent event) {
        if (event.getMessage().getContentRaw().equalsIgnoreCase("ping")) {
            TextChannel channel = event.getTextChannel();
            channel.sendMessage("pong").queue();
        }
    }
}

wispy sundialBOT
#

This post has been reserved for your question.

Hey @south mantle! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

south mantle
south mantle
#

can someone help?

ruby yoke
#

Not sure if you pasted in the code wrong, but you do have a wrong kind of quotation mark when defining token

#

Otherwise looks like you imported the package incorrectly and it is missing

#

You may want to check your build path to make sure you include the library you want to use properly