question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Message sends twice

See original GitHub issue

Hey,

Whenever I use something like

if (event.isFromType(ChannelType.PRIVATE)) //If this message was sent to a PrivateChannel
        {
            //The message was sent in a PrivateChannel.
            //In this example we don't directly use the privateChannel, however, be sure, there are uses for it!
            PrivateChannel privateChannel = event.getPrivateChannel();

            System.out.printf("[PRIV]<%s>: %s\n", author.getName(), msg);
            privateChannel.sendMessage("This message should only be sent once").queue();
}

And then I send the bot a message, it sends back mutliple times. Let me demonstrate: https://gyazo.com/3cf013f9330b9f1a4190a85ed86e46e0

Any idea why this might be happening? Using your exact example 💯

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
jagroshcommented, Mar 17, 2017

The bot gets an event for its own message.

1reaction
MinnDevelopmentcommented, Mar 17, 2017

You should check whether the message author is the currently logged in account. event.getMessage().getAuthor().equals(event.getJDA().getSelfUser()) It is also good practice to ignore messages from Users that are bot accounts User#isBot()

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do some messages I send show twice, like I sent the ...
Try restarting the phone (turn it off and back on) sometimes that will help resolve it. Otherwise, if it continues for more than...
Read more >
Why are my messages sending twice when texting? - Quora
You are located somewhere with a poor internet connection · Your phone is running out of juice and the message is stored locally...
Read more >
Why did the person I sent a message to get duplicate ...
If you find duplicate messages sent within a few seconds of each other. This means that Twilio sent multiple messages to the carrier,...
Read more >
How to Stop Sending Duplicate Text Messages on Android
How to Fix Duplicate Text Messages on Android · Turn Wi-Fi off and back on again. · Turn mobile data off and back...
Read more >
Android sending double or duplicate text messages? You're ...
According to a report on Google's Issue Tracker, an individual shared logs of a bug that's causing GIFs to show up twice in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found