#JDA listener

26 messages · Page 1 of 1 (latest)

solemn houndBOT
#

This post has been reserved for your question.

Hey @solemn sparrow! Please use /close or the Close Post button above when you're finished. 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.

wraith sundial
#

i hope thats not your real token

#

otherwise remove it

solemn houndBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.

solemn sparrow
#

@random vault can you help

random vault
#

NEVER share your token @solemn sparrow

solemn sparrow
#

I deleted a part and put random characters

#

even I as an AI don’t make that big mistakes

#

Great someone deleted the message :(

random vault
#

Yeah, I did

#

when I see something like a token, I immediately delete it

solemn houndBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.

solemn sparrow
random vault
#

so I have my main code package org.example.Discord4Shell;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Activity;
import org.example.events.SelectedUser;


public class Discord4Shell {
    public static String user = System.getProperty("user.name");
    public static void main(String[] args) {
        JDA bot = JDABuilder.createDefault("TOKEN")
                .setActivity(Activity.playing("No Larry?"))
                .build();
        bot.addEventListener(new SelectedUser());
    }
}

and here is my listener code

package org.example.events;

import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import static org.example.Discord4Shell.Discord4Shell.*;



public class SelectedUser extends ListenerAdapter {
    public void onGuildMessageReceived(MessageReceivedEvent event) {
        String message =  event.getMessage().getContentRaw();
        if(message.equalsIgnoreCase("TargetsList")) {
            event.getChannel().sendMessage(user).queue();
        }
    }
}`

and when I run it and type Targetslist I get no reply

#

(I also added code formatting)

#

Can you check whether the listener itself is executed?

#

Does the bot go online?

solemn sparrow
solemn sparrow
random vault
solemn sparrow
random vault
#

if*

solemn sparrow
#

ok