discord-jda / JDA

Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Apache License 2.0
4.33k stars 736 forks source link

No messages coming through ListenerAdapter axcept private messages #1525

Closed jakebreen closed 3 years ago

jakebreen commented 3 years ago

I'm using version 3.8.3_464

The only message events I can get are private messages, there are no messages being received from any of the channels of the single discord server I am in. The code:

Setup JDA instance.

val jda = JDABuilder(AccountType.CLIENT)
        .setToken(token)
        .addEventListener(MessageListener())
        .build()

    jda.awaitReady()

Attempt to listen to any type of message... onReady does not trigger either.

class MessageListener: ListenerAdapter() {

override fun onReady(event: ReadyEvent?) {
    super.onReady(event)
    println("onReady event=$event")
}

override fun onGenericMessage(event: GenericMessageEvent?) {
    super.onGenericMessage(event)
    println("onGenericMessage event=$event")
}

override fun onGenericEvent(event: Event?) {
    super.onGenericEvent(event)
    println("onGenericEvent event=$event")
}

override fun onGuildMessageReceived(event: GuildMessageReceivedEvent?) {
    println("onGuildMessageReceived event=$event")
}

override fun onMessageReceived(event: MessageReceivedEvent) {
    println("onMessageReceived event=$event")
}

}

the only logs i get are at startup:

onGenericEvent event=StatusUpdate(INITIALIZING->INITIALIZED) onGenericEvent event=net.dv8tion.jda.core.events.http.HttpRequestEvent@dacdfc5 onGenericEvent event=StatusUpdate(INITIALIZED->LOGGING_IN) onGenericEvent event=net.dv8tion.jda.core.events.http.HttpRequestEvent@18c4fb2 onGenericEvent event=StatusUpdate(LOGGING_IN->CONNECTING_TO_WEBSOCKET) onGenericEvent event=StatusUpdate(CONNECTING_TO_WEBSOCKET->IDENTIFYING_SESSION) onGenericEvent event=StatusUpdate(IDENTIFYING_SESSION->AWAITING_LOGIN_CONFIRMATION) onGenericEvent event=StatusUpdate(AWAITING_LOGIN_CONFIRMATION->LOADING_SUBSYSTEMS)

RedDaedalus commented 3 years ago

JDA3 has been deprecated for over a year, you need to update to the latest version.

jakebreen commented 3 years ago

I'm aware of that however the latest version will not support client accounts. What is the last stable version where client accounts are usable?

RedDaedalus commented 3 years ago

There is none, discord made breaking changes and you'll get bugs like the one you're experiencing. Just don't self bot.

Andre601 commented 3 years ago

I'm aware of that however the latest version will not support client accounts.

For obvious reasons. Automated client accounts are not allowed by the Discord Developer ToS and JDA has removed support since they no longer work anyway.

Also, please read the readme the next time as it clearly states JDAs current position about automated clients:

UserBots and SelfBots

Discord is currently prohibiting creation and usage of automated client accounts (AccountType.CLIENT). We have officially dropped support for client login as of version 4.2.0! Note that JDA is not a good tool to build a custom discord client as it loads all servers/guilds on startup unlike a client which does this via lazy loading instead. If you need a bot, use a bot account from the Application Dashboard.

Read More