{"action":"created","issue":{"url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/54","repository_url":"https://api.github.com/repos/DV8FromTheWorld/JDA","labels_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/54/comments","events_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/54/events","html_url":"https://github.com/DV8FromTheWorld/JDA/issues/54","id":154886369,"number":54,"title":"sendMessage in onPrivateMessageReceived causes message spamming.","user":{"login":"saltpowered","id":5483105,"avatar_url":"https://avatars.githubusercontent.com/u/5483105?v=3","gravatar_id":"","url":"https://api.github.com/users/saltpowered","html_url":"https://github.com/saltpowered","followers_url":"https://api.github.com/users/saltpowered/followers","following_url":"https://api.github.com/users/saltpowered/following{/other_user}","gists_url":"https://api.github.com/users/saltpowered/gists{/gist_id}","starred_url":"https://api.github.com/users/saltpowered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saltpowered/subscriptions","organizations_url":"https://api.github.com/users/saltpowered/orgs","repos_url":"https://api.github.com/users/saltpowered/repos","events_url":"https://api.github.com/users/saltpowered/events{/privacy}","received_events_url":"https://api.github.com/users/saltpowered/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-05-15T02:28:09Z","updated_at":"2016-11-28T23:03:23Z","closed_at":"2016-05-15T03:01:44Z","body":"First let me say i picked up this API around midnight last night and thanks to its ease of use i had a working bot in 5 hours. Thanks for making this.\n\nNow for the issue. It was rather random so therefore i have no idea what could be causing it, but essentially when sendMessage is called in onPrivateMessageReceived (as well as onMessageRecieved with isPrivate check), it causes the bot to spam the message infinitley until the 'TOO MUCH TOO FAST' exception is thrown.\n\nAt first i was thinking it was an error in my code, but after commenting literally everything that isnt just the main startup and the onPrivateMessageReceived event, ive come to the conclusion that it is something to do with JDA.\n\nThis is pretty much the program after all the commenting\n\nThe imports\n\nimport net.dv8tion.jda.JDABuilder;\nimport net.dv8tion.jda.entities._;\nimport net.dv8tion.jda.entities.Guild;\nimport net.dv8tion.jda.events.ReadyEvent;\nimport net.dv8tion.jda.events.audio._;\nimport net.dv8tion.jda.events.DisconnectEvent;\nimport net.dv8tion.jda.events.ReconnectedEvent;\nimport net.dv8tion.jda.events.message.priv.PrivateMessageReceivedEvent;\nimport net.dv8tion.jda.events.message.MessageReceivedEvent;\nimport net.dv8tion.jda.hooks.ListenerAdapter;\nimport net.dv8tion.jda.audio.player.FilePlayer;\nimport net.dv8tion.jda.audio.player.Player;\n\nimport javax.security.auth.login.LoginException;\nimport javax.sound.sampled.UnsupportedAudioFileException;\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.List;\nimport java.util.Random;\nimport java.util.concurrent.TimeUnit;\n\n```\npublic static void main(String[] args)\n{\n    try {\n        new JDABuilder().setBotToken(m_botToken).addListener(new highNoonBot()).buildBlocking();\n    }\n    catch (IllegalArgumentException e) {\n        System.out.println(\"ERROR: No token entered, fix it.\");\n    }\n    catch (LoginException e) {\n        System.out.println(\"ERROR: The token entered is invalid, fix it.\");\n    }\n    catch (InterruptedException e) {\n        e.printStackTrace();\n    }\n}\n\n@Override\npublic void onPrivateMessageReceived(PrivateMessageReceivedEvent event) {\n    event.getChannel().sendMessage(\"Test\");\n    return;\n}\n```\n\nThe main is pretty much pure copy and paste from your examples and the on onPrivateMessageReceived just does the sendMessage, but when you message the bot you get this.\n\nhttp://puu.sh/oSehN/dde45f3700.png\n\nHere is the console log up to the point of the exception\n\n`\n[21:25:13] [Info] [JDAAudioManager]: Audio System successfully setup!\n[21:25:13] [Info] [JDA]: JDA starting...\n[21:25:14] [Info] [JDA]: Login Successful!\n[21:25:14] [Info] [JDASocket]: Connected to WebSocket\n[21:25:15] [Info] [JDA]: Finished Loading!\n[21:25:20] [Fatal] [JDA]: One of the EventListeners had an uncaught exception\n[21:25:20] [Fatal] [JDA]: Encountered an exception:\nnet.dv8tion.jda.exceptions.RateLimitedException: The message got Rate-Limited. You are able to send messages again in 4589 ms\n    at net.dv8tion.jda.entities.impl.PrivateChannelImpl.sendMessage(PrivateChannelImpl.java:88)\n    at net.dv8tion.jda.entities.impl.PrivateChannelImpl.sendMessage(PrivateChannelImpl.java:70)\n    at its.high.noon.highNoonBot.onPrivateMessageReceived(highNoonBot.java:180)\n    at net.dv8tion.jda.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:167)\n    at net.dv8tion.jda.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:57)\n    at net.dv8tion.jda.handle.MessageReceivedHandler.handleInternally(MessageReceivedHandler.java:59)\n    at net.dv8tion.jda.handle.SocketHandler.handle(SocketHandler.java:36)\n    at net.dv8tion.jda.requests.WebSocketClient.handleEvent(WebSocketClient.java:545)\n    at net.dv8tion.jda.requests.WebSocketClient.onTextMessage(WebSocketClient.java:296)\n    at com.neovisionaries.ws.client.ListenerManager.callOnTextMessage(ListenerManager.java:352)\n    at com.neovisionaries.ws.client.ReadingThread.callOnTextMessage(ReadingThread.java:233)\n    at com.neovisionaries.ws.client.ReadingThread.callOnTextMessage(ReadingThread.java:211)\n    at com.neovisionaries.ws.client.ReadingThread.handleTextFrame(ReadingThread.java:910)\n    at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:693)\n    at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:102)\n    at com.neovisionaries.ws.client.ReadingThread.run(ReadingThread.java:61)\n`\n"},"comment":{"url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/comments/263423140","html_url":"https://github.com/DV8FromTheWorld/JDA/issues/54#issuecomment-263423140","issue_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/54","id":263423140,"user":{"login":"DV8FromTheWorld","id":1479909,"avatar_url":"https://avatars.githubusercontent.com/u/1479909?v=3","gravatar_id":"","url":"https://api.github.com/users/DV8FromTheWorld","html_url":"https://github.com/DV8FromTheWorld","followers_url":"https://api.github.com/users/DV8FromTheWorld/followers","following_url":"https://api.github.com/users/DV8FromTheWorld/following{/other_user}","gists_url":"https://api.github.com/users/DV8FromTheWorld/gists{/gist_id}","starred_url":"https://api.github.com/users/DV8FromTheWorld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DV8FromTheWorld/subscriptions","organizations_url":"https://api.github.com/users/DV8FromTheWorld/orgs","repos_url":"https://api.github.com/users/DV8FromTheWorld/repos","events_url":"https://api.github.com/users/DV8FromTheWorld/events{/privacy}","received_events_url":"https://api.github.com/users/DV8FromTheWorld/received_events","type":"User","site_admin":false},"created_at":"2016-11-28T23:03:23Z","updated_at":"2016-11-28T23:03:23Z","body":"So if you don't want the bot to respond to itself, you need to add a check for that."}}
{"actor":{"display_login":"DV8FromTheWorld"}}