MessageRecievedEvent running 2 times
See original GitHub issueGeneral Troubleshooting
- I have checked for similar issues on the Issue-tracker.
- I have updated to the latest JDA version
- I have checked the branches or the maintainers’ PRs for upcoming bug fixes.
Expected Behaviour
Should delete a message if the bot sends it, and send one message whenever a user sends a message.
Code Example for Reproduction Steps
if (AUTHOR.isBot()) return;
MessageCreateAction action = event.getChannel().asTextChannel().sendMessage(AUTHOR.getAsTag() + " SENT A MESSAGE IN " + event.getGuild().getName() + pingst);
Message msg = action.complete();
msg.delete().queue();
MY ENTIRE DMPing.java class: https://pastebin.com/96uxUzbG
Code for JDABuilder or DefaultShardManagerBuilder used
builder = DefaultShardManagerBuilder.createLight(TOKEN);
// Set Custom Status
builder.setStatus(OnlineStatus.ONLINE); builder.setActivity(Activity.listening("To your DMs"));
// Build the Bot
builder.setMemberCachePolicy(MemberCachePolicy.ALL);
builder.setChunkingFilter(ChunkingFilter.ALL);
builder.enableIntents(GatewayIntent.getIntents(GatewayIntent.ALL_INTENTS));
shardManager = builder.build();
// Register Listeners
shardManager.addEventListener(new dmPing());
shardManager.addEventListener(new CommandManager());
Exception or Error
There is no error, it just runs 2 times for some reason.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
window message Event firing more than one time sometime
But the message event fires in the parent page more than one times. If it fires more than one time the counter will...
Read more >Same event is received multiple times
I am using this code to receive NewEventIndication: MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.
Read more >Message received twice when rocket chat server restarts #141
It does not send the message twice (if it is a command that triggers something), but it is received twice.
Read more >Web worker on message gets called twice : r/learnjavascript
This log message was printed only once. I conclude that the postMessage is indeed run only once, but it goes into some event...
Read more >Javascript Event Handler is firing twice - Elixir Forum
Have you checked if you run the code more than once? Maybe you have added two event listeners. yreuvekamp ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, really sorry, my bad. My database callback calls two times then the message sends two times. I’ve been looking for the root of the problem in literally everything and came here hoping to see something looks like my issue.
Closing this due to inactivity. Generally, I would recommend registering the event listener on the builder instead of after building.