GithubHelp home page GithubHelp logo

javacord / javacord Goto Github PK

View Code? Open in Web Editor NEW
746.0 23.0 180.0 7.12 MB

An easy to use multithreaded library for creating Discord bots in Java.

Home Page: https://discord.gg/javacord

License: Apache License 2.0

Java 97.19% Groovy 2.81%
discord discord-library javacord java discord-bot bot java-discord-bot java-discord-api discord-api api

javacord's Introduction

Javacord Latest version Latest JavaDocs Javacord Wiki Javacord Discord server

An easy to use multithreaded library for creating Discord bots in Java.

Javacord is a modern library that focuses on simplicity and speed ๐Ÿš€. By reducing itself to standard Java classes and features like Optionals and CompletableFutures, it is extremely easy to use for every Java developer, as it does not require you to learn any new frameworks or complex abstractions. It has rich documentation and an awesome community on Discord that loves to help with any specific problems and questions.

Starting in early 2023, support for Java 8 will be discontinued and Java 11 will be the new minimum requirement for using Javacord. If you are not yet running Java 11+, we strongly recommend that you upgrade before the end of 2022.

๐ŸŽ‰ Basic Usage

The following example logs the bot in and replies to every "!ping" message with "Pong!". Note that message content is a privileged Intent and needs to specifically be enabled.

public class MyFirstBot {

    public static void main(String[] args) {
        // Insert your bot's token here
        String token = "your token";

        DiscordApi api = new DiscordApiBuilder().setToken(token).addIntent(Intent.MESSAGE_CONTENT).login().join();

        // Add a listener which answers with "Pong!" if someone writes "!ping"
        api.addMessageCreateListener(event -> {
            if (event.getMessageContent().equalsIgnoreCase("!ping")) {
                event.getChannel().sendMessage("Pong!");
            }
        });

        // Print the invite url of your bot
        System.out.println("You can invite the bot by using the following url: " + api.createBotInvite());
    }

}

More sophisticated examples can be found at the end of the README. You can also check out the example bot for a fully functional bot.

/ Slash commands

First, you need to create the ping pong slash command. Run this code one single time to create the command:

public class MyFirstBot {

    public static void main(String[] args) {
        // Insert your bot's token here
        String token = "your token";

        DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();

        SlashCommand.with("ping", "A simple ping pong command!").createGlobal(api).join();
    }
}

Discord now knows about your command and will offer it in your text channels if you type /.

Next, let's see how we can let the bot send answers to this simple slash command:

public class MyFirstBot {

    public static void main(String[] args) {
        // Insert your bot's token here
        String token = "your token";

        DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();

        api.addSlashCommandCreateListener(event -> {
            SlashCommandInteraction slashCommandInteraction = event.getSlashCommandInteraction();
            if (slashCommandInteraction.getCommandName().equals("ping")) {
                slashCommandInteraction.createImmediateResponder()
                    .setContent("Pong!")
                    .setFlags(MessageFlag.EPHEMERAL) // Only visible for the user which invoked the command
                    .respond();
            }
        });
    }
}

A more detailed version of how to use slash commands can be found in the wiki

๐Ÿ“ฆ Download / Installation

The recommended way to get Javacord is to use a build manager, like Gradle or Maven.
If you are not familiar with build managers, you can follow this setup guide or download Javacord directly from GitHub.

Javacord Dependency

Gradle

repositories { mavenCentral() }
dependencies { implementation 'org.javacord:javacord:3.8.0' }

Maven

<dependency>
    <groupId>org.javacord</groupId>
    <artifactId>javacord</artifactId>
    <version>3.8.0</version>
    <type>pom</type>
</dependency>

Sbt

libraryDependencies ++= Seq("org.javacord" % "javacord" % "3.8.0")

Optional Logger Dependency

Any Log4j-2-compatible logging framework can be used to provide a more sophisticated logging experience with being able to configure log format, log targets (console, file, database, Discord direct message, ...), log levels per class, and much more.

For example, Log4j Core in Gradle

dependencies { runtimeOnly 'org.apache.logging.log4j:log4j-core:2.19.0' }

Take a look at the logger configuration wiki article for further information.

๐Ÿ”ง IDE Setup

If you have never used Gradle or Maven before, you should take a look at one of the setup tutorials:

๐Ÿค Support

Javacord's Discord community is an excellent resource if you have questions about the library.

๐Ÿ“’ Documentation

  • The Javacord wiki is a great place to get started.
  • Additional documentation can be found in the JavaDoc.

๐Ÿ’ก How to Create a Bot User and Get Its Token

๐Ÿ“‹ Version Numbers

The version number has a 3-digit format: major.minor.trivial

  • major: Increased extremely rarely to mark a major release (usually a rewrite affecting very huge parts of the library).
  • minor: Any backward incompatible change to the api.
  • trivial: A backward compatible change to the api. This is usually an important bugfix (or a bunch of smaller ones) or a backwards compatible feature addition.

๐Ÿ”จ Deprecation Policy

A method or class that is marked as deprecated can be removed with the next minor release (but it will usually stay for several minor releases). A minor release might remove a class or method without having it deprecated, but we will do our best to deprecate it before removing it. We are unable to guarantee this though, because we might have to remove / replace something due to changes made by Discord, which we are unable to control. Usually you can expect a deprecated method or class to stay for at least 6 months before it finally gets removed, but this is not guaranteed.

โœจ Contributing

Contributions of any kind are welcome. You can start contributing to this library by creating issues, submitting pull requests or improving the Javacord Wiki.

If you want to submit pull requests you can find a list of good first issues here. You are not restricted to only these issues, so you can start with any other issue that you would like to do. Be sure to read the Contributing Guidelines before you start.

The awesome people that contributed to Javacord in the past can be found โœจhereโœจ

๐Ÿฅ‡ Large Bots Using Javacord

Javacord is used by many large bots. Here are just a few of them:

If you own a large bot that uses Javacord, feel free to add it to the list in a pull request!

๐Ÿ™Œ More Examples

Using the MessageBuilder ๐Ÿ› 

The following example uses the built-in MessageBuilder. It is very useful to construct complex messages with images, code-blocks, embeds, or attachments.

new MessageBuilder()
  .append("Look at these ")
  .append("awesome", MessageDecoration.BOLD, MessageDecoration.UNDERLINE)
  .append(" animal pictures! ๐Ÿ˜ƒ")
  .appendCode("java", "System.out.println(\"Sweet!\");")
  .addAttachment(new File("C:/Users/JohnDoe/Pictures/kitten.jpg"))
  .addAttachment(new File("C:/Users/JohnDoe/Pictures/puppy.jpg"))
  .setEmbed(new EmbedBuilder()
        .setTitle("WOW")
        .setDescription("Really cool pictures!")
        .setColor(Color.ORANGE))
  .send(channel);

Listeners in Their Own Class ๐Ÿ—ƒ

All the examples use inline listeners for simplicity. For better readability it is also possible to have listeners in their own class:

public class MyListener implements MessageCreateListener {

    @Override
    public void onMessageCreate(MessageCreateEvent event) {
        Message message = event.getMessage();
        if (message.getContent().equalsIgnoreCase("!ping")) {
            event.getChannel().sendMessage("Pong!");
        }
    }

}
api.addListener(new MyListener());

Libraries compatible with Javacord ๐Ÿ“š

This is a not exhaustive list of libraries that are compatible with Javacord. If you want to add your own library to this list, feel free to open a pull request! They are sorted alphabetically that means that the order does not reflect the usage or quality of the library.

Attach Listeners to Objects ๐Ÿ“Œ

You can even attach listeners to objects. Let's say you have a very sensitive bot. As soon as someone reacts with a ๐Ÿ‘Ž within the first 30 minutes of message creation, it deletes its own message.

api.addMessageCreateListener(event -> {
    if (event.getMessageContent().equalsIgnoreCase("!ping")) {
        event.getChannel().sendMessage("Pong!").thenAccept(message -> {
            // Attach a listener directly to the message
            message.addReactionAddListener(reactionEvent -> {
                if (reactionEvent.getEmoji().equalsEmoji("๐Ÿ‘Ž")) {
                    reactionEvent.deleteMessage();
                }
            }).removeAfter(30, TimeUnit.MINUTES);
        });
    }
}

The result then looks like this:

Creating a Temporary Voice Channel ๐Ÿ’ฃ๐ŸŽง

This example creates a temporary voice channel that gets deleted when the last user leaves it or if nobody joins it within the first 30 seconds after creation.

Server server = ...;
ServerVoiceChannel channel = new ServerVoiceChannelBuilder(server)
        .setName("tmp-channel")
        .setUserlimit(10)
        .create()
        .join();

// Delete the channel if the last user leaves
channel.addServerVoiceChannelMemberLeaveListener(event -> {
    if (event.getChannel().getConnectedUserIds().isEmpty()) {
        event.getChannel().delete();
    }
});

// Delete the channel if no user joined in the first 30 seconds 
api.getThreadPool().getScheduler().schedule(() -> {
    if (channel.getConnectedUserIds().isEmpty()) {
        channel.delete();
    }
}, 30, TimeUnit.SECONDS);

Note: You should also make sure to remove the channels on bot shutdown (or startup)

๐Ÿ“ƒ License

Javacord is distributed under the Apache license version 2.0.

javacord's People

Contributors

ahmeda1559 avatar allcontributors[bot] avatar ayubun avatar bassner avatar bastian avatar boneyisspooky avatar bourne-id avatar burdoto avatar feddevanderlist avatar felldo avatar gamingandstuffs avatar github-actions[bot] avatar ilgo0413 avatar javacord-ci avatar joshix-1 avatar kenwiel avatar kezc avatar l0stillusion avatar mysterypotatoguy avatar nguyenquyhy avatar realyusufismail avatar ruiner189 avatar saladoc avatar shawishi avatar shindoumihou avatar shubhwip avatar vampire avatar vyfor avatar wasdennnoch avatar yrsegal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javacord's Issues

[REQUEST] Creation & Join Dates

Hi, it's me again.

I found something that I needed, yet couldn't find in Javacord.
Creation dates for Servers & Users,
Join dates for Users.

Maven outdated

The last build on Maven seems to be from Jan 13, can it be updated?

Couldn't handle packet of type GUILD_CREATE

I keep getting this error with just one of the discord servers the bot is in, it still works fine everywhere else. The code has not been changed in any way before the problem started.

Sep 25, 2017 8:35:59 PM de.btobastian.javacord.utils.JavacordLogger warn WARNING: Couldn't handle packet of type GUILD_CREATE. Please contact the developer! (packet: {"default_message_notifications":0,"unavailable":false,"owner_id":"221202188200837120","roles":[{"color":0,"permissions":67111936,"managed":false,"name":"@everyone","mentionable":false,"position":0,"id":"300752710549110784","hoist":false},{"color":0,"permissions":104324160,"managed":false,"name":"Scourge","mentionable":false,"position":11,"id":"300753265367187456","hoist":true},{"color":0,"permissions":1073741824,"managed":false,"name":"emoji","mentionable":false,"position":4,"id":"300964768502644738","hoist":false},{"color":0,"permissions":104324160,"managed":false,"name":"ally","mentionable":false,"position":3,"id":"300964771589783552","hoist":true},{"color":0,"permissions":37215296,"managed":false,"name":"strike-bot","mentionable":false,"position":1,"id":"311738863070478347","hoist":true},{"color":0,"permissions":335552518,"managed":false,"name":"OP","mentionable":false,"position":13,"id":"318886661293342722","hoist":false},{"color":0,"permissions":104320064,"managed":false,"name":"minecraft","mentionable":false,"position":10,"id":"328382915123871754","hoist":true},{"color":0,"permissions":133692480,"managed":false,"name":"MC mod","mentionable":false,"position":7,"id":"328882946285240331","hoist":false},{"color":0,"permissions":67226624,"managed":false,"name":"profile-bot","mentionable":true,"position":2,"id":"332072090591035393","hoist":true},{"color":0,"permissions":67111944,"managed":false,"name":"admin","mentionable":false,"position":14,"id":"342910372539269130","hoist":false},{"color":0,"permissions":70769728,"managed":false,"name":"IT","mentionable":false,"position":5,"id":"348487805309157379","hoist":false},{"color":0,"permissions":67624000,"managed":false,"name":"other","mentionable":false,"position":6,"id":"348492288646971394","hoist":false},{"color":0,"permissions":67619904,"managed":false,"name":"babah","mentionable":true,"position":8,"id":"350611286247342081","hoist":true},{"color":0,"permissions":515136,"managed":false,"name":"bots","mentionable":false,"position":12,"id":"350638794933927937","hoist":true},{"color":0,"permissions":104320064,"managed":false,"name":"eve","mentionable":false,"position":9,"id":"361818653798170635","hoist":false}],"icon":"7c15e1efa12169083f1ac063d80edaaa","system_channel_id":null,"afk_timeout":300,"features":[],"presences":[{"game":{"name":"Nexus Clash","type":0},"user":{"id":"160891867880226816"},"status":"online"},{"game":null,"user":{"id":"188027195812216832"},"status":"online"},{"game":null,"user":{"id":"199285545648652289"},"status":"online"},{"game":null,"user":{"id":"221202188200837120"},"status":"idle"},{"game":{"name":"xorg","type":0},"user":{"id":"245740941648855042"},"status":"online"},{"game":null,"user":{"id":"280537626904231946"},"status":"online"},{"game":{"name":"EVE Online","type":0},"user":{"id":"281052811687493633"},"status":"online"},{"game":null,"user":{"id":"283767953072062482"},"status":"dnd"},{"game":{"name":"EVE Online","type":0},"user":{"id":"313960010252025857"},"status":"online"},{"game":null,"user":{"id":"332037664968671233"},"status":"online"},{"game":null,"user":{"id":"332394259833552897"},"status":"online"},{"game":null,"user":{"id":"336496946627739661"},"status":"online"},{"game":null,"user":{"id":"339117013207351299"},"status":"online"}],"afk_channel_id":null,"members":[{"nick":"Zombie Williums","joined_at":"2017-08-29T04:16:43.055730+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"274843157294743552","avatar":"789cdfd2a7bda7ec85780cb8b4770f23","username":"tofury","discriminator":"2082"}},{"nick":null,"joined_at":"2017-05-12T16:21:51.387652+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"312625370677379072","avatar":"71aae7edf7b46a9f5f258593c5c0b7b3","username":"Zombie Rolo Tony","discriminator":"8421"}},{"nick":null,"joined_at":"2017-05-29T19:39:44.148977+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"318835536083025930","avatar":null,"username":"Krakonus","discriminator":"6716"}},{"nick":"grapes","joined_at":"2017-06-11T23:55:06.836973+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"224994363376140288","avatar":"0fd0b5957506c855f930e856a91326e0","username":"howaboutGrap3s","discriminator":"2564"}},{"nick":"CaptainFowl","joined_at":"2017-06-02T01:25:21.715690+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"188027195812216832","avatar":"1065e0d5a426a095fc070258ee991177","username":"HK-50","discriminator":"9144"}},{"nick":"Elaine Summers","joined_at":"2017-05-05T13:15:06.640081+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"283197405170630663","avatar":"cba1194d824319dc1427afad92c5dd1e","username":"Lady Selancourte","discriminator":"0252"}},{"nick":null,"joined_at":"2017-06-10T02:15:33.113443+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"322921680265805834","avatar":null,"username":"omagar","discriminator":"2641"}},{"nick":"Grau","joined_at":"2017-09-09T18:38:26.039133+00:00","roles":["300753265367187456","328382915123871754"],"deaf":false,"mute":false,"user":{"id":"154518951261503488","avatar":"d07ceefd13b30293816299ad39737e19","username":"Billy Bones","discriminator":"8506"}},{"nick":null,"joined_at":"2017-06-11T06:59:56.663559+00:00","roles":["300753265367187456","328382915123871754","361818653798170635"],"deaf":false,"mute":false,"user":{"id":"283767953072062482","avatar":"a056f25f29bd9f2b832394f3c94dcff4","username":"DoX","discriminator":"0070"}},{"joined_at":"2017-09-07T21:13:07.863276+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"306870305526382592","avatar":null,"username":"BorneLegaCy","discriminator":"4623"}},{"nick":"Blake Foley","joined_at":"2017-05-01T01:39:05.397539+00:00","roles":["300753265367187456","328382915123871754","361818653798170635"],"deaf":false,"mute":false,"user":{"id":"281052811687493633","avatar":"0dbb6a888e0cdc5d63bdbd059cc8347a","username":"VragNaroda","discriminator":"7810"}},{"nick":null,"joined_at":"2017-05-26T06:52:55.075590+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"268487199316508674","avatar":"9053b654d10f29e9d79065cbd6bd48ed","username":"Zebe","discriminator":"8193"}},{"joined_at":"2017-06-30T04:37:39.989394+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"281541249046020096","avatar":null,"username":"Rango","discriminator":"0903"}},{"joined_at":"2017-08-01T14:34:27.977271+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"302090471453491200","avatar":null,"username":"thepoorman","discriminator":"4516"}},{"nick":"DirtyDuke (Feral Clowder)","joined_at":"2017-05-17T13:34:02.315505+00:00","roles":["300964771589783552"],"deaf":false,"mute":false,"user":{"id":"298454258917834753","avatar":"e4d267034ecba86c28aa9add1559e530","username":"DirtyDuke","discriminator":"4948"}},{"nick":"Rita","joined_at":"2017-04-09T22:03:53.915000+00:00","roles":["300753265367187456","350611286247342081","328382915123871754"],"deaf":false,"mute":false,"user":{"id":"221202188200837120","avatar":"88f8ace827c654993cd03e1b8a6bd42f","username":"stelar","discriminator":"8437"}},{"joined_at":"2017-09-21T02:00:50.713136+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"360243922422857728","avatar":null,"username":"Jerry","discriminator":"0135"}},{"nick":"rich c","joined_at":"2017-07-27T13:46:00.511464+00:00","roles":["300753265367187456","328382915123871754"],"deaf":false,"mute":false,"user":{"id":"339117013207351299","avatar":"db25b32a54ff9d6d67547673d6e8d3f6","username":"Richard Skull","discriminator":"5988"}},{"joined_at":"2017-04-16T09:31:27.744000+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"282871755029348362","avatar":"8be16824e485f4d0a9cfbdb79f244bdd","username":"Wark","discriminator":"6009"}},{"joined_at":"2017-08-15T10:37:11.011839+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"271364080588029973","avatar":"7ca36e3d4a2ddfe4ee3ae61e1db5e6e8","username":"dnf","discriminator":"1044"}},{"joined_at":"2017-07-20T11:33:53.745755+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"324583873117814794","avatar":null,"username":"Zeonitely","discriminator":"0329"}},{"nick":null,"joined_at":"2017-07-06T05:42:56.280728+00:00","roles":["350638794933927937"],"deaf":false,"mute":false,"user":{"bot":true,"id":"332394259833552897","avatar":"9b20d767c2f56aeda075fb203621e9d2","username":"Barhah9000","discriminator":"8988"}},{"nick":null,"joined_at":"2017-08-13T12:17:23.555246+00:00","roles":["300753265367187456","350611286247342081"],"deaf":false,"mute":false,"user":{"id":"346265688370839552","avatar":null,"username":"nadiydanial","discriminator":"4640"}},{"nick":"tovag","joined_at":"2017-09-18T02:43:20.534550+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"324196255809142795","avatar":null,"username":"ScottieofArabia","discriminator":"0252"}},{"joined_at":"2017-06-10T05:55:42.461688+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"322976032422625280","avatar":null,"username":"H0tSh0t","discriminator":"8272"}},{"nick":null,"joined_at":"2017-05-26T14:24:05.495268+00:00","roles":["300964771589783552"],"deaf":false,"mute":false,"user":{"id":"243475946357653504","avatar":"7627300daab778873ae4eb11a75e7790","username":"Assassin","discriminator":"3253"}},{"nick":null,"joined_at":"2017-05-10T05:38:02.674814+00:00","roles":[],"deaf":false,"mute":false,"user":{"bot":true,"id":"280537626904231946","avatar":"015ee530bae8ca3f4e43e6755408719b","username":"strike-bot","discriminator":"6645"}},{"joined_at":"2017-09-21T02:02:54.879141+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"360244233376104448","avatar":null,"username":"Lars31252","discriminator":"8075"}},{"nick":null,"joined_at":"2017-06-10T08:00:16.358315+00:00","roles":["300753265367187456","328882946285240331","328382915123871754","361818653798170635"],"deaf":false,"mute":false,"user":{"id":"300867550630248449","avatar":"545d87973176dd28991481a1106724ff","username":"EasyDinner","discriminator":"4830"}},{"joined_at":"2017-08-09T00:02:35.637704+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"205097363293863936","avatar":"1338bd4f37e22b70b6d59dbff4c46f27","username":"ShadownetZero","discriminator":"9456"}},{"joined_at":"2017-06-12T07:46:56.767259+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"323729724255895553","avatar":null,"username":"yeti","discriminator":"3278"}},{"nick":"Ted Cruz: Zodiac Killer","joined_at":"2017-04-24T23:43:24.912641+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"191957613980680192","avatar":"08b7d3d96f72a6d327cb08653ace4a3a","username":"Jasten","discriminator":"4905"}},{"joined_at":"2017-08-09T10:26:33.546965+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"344788510550786048","avatar":null,"username":"Bosch","discriminator":"9235"}},{"joined_at":"2017-06-28T16:27:09.175658+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"329657234659213323","avatar":null,"username":"Keyser Suze","discriminator":"7189"}},{"nick":"Kryan(OhDandyDay)","joined_at":"2017-07-30T16:23:32.715195+00:00","roles":["300753265367187456","328382915123871754"],"deaf":false,"mute":false,"user":{"id":"341103561758867457","avatar":"8f8fbddbe67925c22991cc69f5788a92","username":"Kryan","discriminator":"0129"}},{"nick":"ledicious (Feral Clowder / RRF)","joined_at":"2017-05-10T05:26:06.669327+00:00","roles":["300964771589783552"],"deaf":false,"mute":false,"user":{"id":"245740941648855042","avatar":"a94dccc910765bc74edccd90f85603a1","username":"ledicious","discriminator":"2770"}},{"joined_at":"2017-05-27T20:06:25.278647+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"168885420371738624","avatar":null,"username":"coznowski","discriminator":"2412"}},{"nick":null,"joined_at":"2017-07-05T08:14:34.429760+00:00","roles":["350638794933927937","361818653798170635"],"deaf":false,"mute":false,"user":{"bot":true,"id":"332037664968671233","avatar":"39e43229fb19fbbc4eb8dd9b0e1a87fb","username":"ElectricEye","discriminator":"3984"}},{"nick":null,"joined_at":"2017-05-24T05:03:17.741970+00:00","roles":["300964771589783552"],"deaf":false,"mute":false,"user":{"id":"287007461712330752","avatar":null,"username":"Zuma","discriminator":"8460"}},{"nick":null,"joined_at":"2017-09-17T17:54:47.761960+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"359033608771600393","avatar":null,"username":"Exreen","discriminator":"4880"}},{"nick":null,"joined_at":"2017-08-05T01:51:46.963318+00:00","roles":["300753265367187456","328382915123871754"],"deaf":false,"mute":false,"user":{"id":"340942388908523541","avatar":"1dc502c9626b1b804cdae78e5a09476d","username":"bellzub","discriminator":"4810"}},{"nick":"Danger Doug","joined_at":"2017-08-23T12:15:37.825971+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"336496946627739661","avatar":"d593216657e2a5d09879a6d0438e2ddb","username":"Talisyne","discriminator":"1607"}},{"joined_at":"2017-06-13T00:00:34.740217+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"274808743479345152","avatar":"0db27f4f3cc0633930cd2b9e73f5b6f2","username":"Shauna","discriminator":"5589"}},{"nick":"Xeyseir (Feral Clowder)","joined_at":"2017-05-02T00:23:21.026034+00:00","roles":["300964771589783552"],"deaf":false,"mute":false,"user":{"id":"160891867880226816","avatar":"4c0f313f373ca52bb01b87a9d1e45a3d","username":"xzre","discriminator":"1278"}},{"nick":null,"joined_at":"2017-06-16T15:46:26.038895+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"124532238908915712","avatar":null,"username":"Fireheart","discriminator":"6419"}},{"nick":null,"joined_at":"2017-08-02T05:12:54.107660+00:00","roles":["300753265367187456","328382915123871754"],"deaf":false,"mute":false,"user":{"id":"341813246111645696","avatar":"5c73bd154071473d90406c8735eb118b","username":"Animefan666","discriminator":"6025"}},{"joined_at":"2017-09-25T08:19:11.241262+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"336086097170006017","avatar":"138c56480439c476858ed8fb90612521","username":"Balor","discriminator":"7790"}},{"nick":"ZennyO","joined_at":"2017-04-18T16:13:31.963000+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"303925658793541642","avatar":null,"username":"0208887531","discriminator":"5050"}},{"nick":"HarmanBargar","joined_at":"2017-04-10T11:20:46.801000+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"300547194392543233","avatar":"58ff0cc42b5ef22a76bc835741880c05","username":"rifter","discriminator":"3640"}},{"joined_at":"2017-06-19T13:19:32.060368+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"322516578484617216","avatar":null,"username":"slim","discriminator":"2808"}},{"joined_at":"2017-08-08T15:47:48.381254+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"344506779285061633","avatar":"3d0d581b8e970aa4365ce11a1dd5aa2a","username":"sdcyeahyouknowme","discriminator":"0530"}},{"nick":"Baraga","joined_at":"2017-05-16T08:46:07.219790+00:00","roles":["300753265367187456","328382915123871754","361818653798170635"],"deaf":false,"mute":false,"user":{"id":"313960010252025857","avatar":"fe4a95587d87d77fe99dfc507b4fab18","username":"Johnny P. Baraga","discriminator":"2443"}},{"nick":null,"joined_at":"2017-05-09T15:14:54.592617+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"309420124006252556","avatar":"36441b5a29bbc684e345e2747143ae66","username":"Bone Snapper","discriminator":"4908"}},{"joined_at":"2017-07-27T20:13:36.454921+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"340225100458622976","avatar":null,"username":"gryndryno","discriminator":"9347"}},{"joined_at":"2017-09-02T01:57:11.608409+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"310316353519353858","avatar":null,"username":"dopeboy33","discriminator":"5164"}},{"joined_at":"2017-06-17T11:19:21.265263+00:00","roles":[],"deaf":false,"mute":false,"user":{"id":"325595197406838784","avatar":"1d9b063a3d32b2d3d493038d8669b408","username":"legionarie88","discriminator":"5385"}},{"nick":"penguinpyro","joined_at":"2017-08-19T23:04:43.466033+00:00","roles":["300753265367187456"],"deaf":false,"mute":false,"user":{"id":"231242641801478145","avatar":"e52e35933c7712d9aaa16a859d534d01","username":"Penguinpyromaniac","discriminator":"5984"}},{"nick":"Bree Kong","joined_at":"2017-04-10T00:04:32.805000+00:00","roles":["300753265367187456","342910372539269130","328382915123871754"],"deaf":false,"mute":false,"user":{"id":"199285545648652289","avatar":"d0a25f283c5ff7ff822b348d0e22d931","username":"drones_need","discriminator":"6916"}}],"voice_states":[],"id":"300752710549110784","member_count":58,"emojis":[{"managed":false,"roles":[],"name":"zombie","id":"300965233231396865","require_colons":true},{"managed":false,"roles":[],"name":"dualnature","id":"300965304169922560","require_colons":true},{"managed":false,"roles":[],"name":"survivor","id":"300965378576875521","require_colons":true},{"managed":false,"roles":[],"name":"pker","id":"300965450299342848","require_colons":true},{"managed":false,"roles":[],"name":"guillotine","id":"322998465871478784","require_colons":true},{"managed":false,"roles":[],"name":"creeper","id":"331715960987844610","require_colons":true},{"managed":false,"roles":[],"name":"llama","id":"331716619632115712","require_colons":true},{"managed":false,"roles":[],"name":"diamond","id":"331717078946021376","require_colons":true},{"managed":false,"roles":[],"name":"zombie","id":"331717112286674955","require_colons":true},{"managed":false,"roles":[],"name":"creeper2","id":"331717135548153869","require_colons":true},{"managed":false,"roles":[],"name":"coal","id":"331766301162733570","require_colons":true},{"managed":false,"roles":[],"name":"emerald","id":"331766301930291212","require_colons":true},{"managed":false,"roles":[],"name":"gold_ingot","id":"331766303012552704","require_colons":true},{"managed":false,"roles":[],"name":"golden_apple","id":"331766303536971792","require_colons":true},{"managed":false,"roles":[],"name":"iron_ingot","id":"331766304342278144","require_colons":true},{"managed":false,"roles":[],"name":"Raw_Beef","id":"331766304698793984","require_colons":true},{"managed":false,"roles":[],"name":"ghast","id":"331766545518690305","require_colons":true},{"managed":false,"roles":[],"name":"tnt","id":"332051555920642062","require_colons":true},{"managed":false,"roles":[],"name":"chicken","id":"334294166236561428","require_colons":true},{"managed":false,"roles":[],"name":"potato","id":"335424938829938691","require_colons":true},{"managed":false,"roles":[],"name":"flakjacket","id":"345050258062966784","require_colons":true},{"managed":false,"roles":[],"name":"babah","id":"350414389918040065","require_colons":true},{"managed":false,"roles":[],"name":"babahspy","id":"350607510446800897","require_colons":true}],"large":false,"application_id":null,"joined_at":"2017-07-06T05:42:56.280728+00:00","verification_level":1,"explicit_content_filter":0,"channels":[{"permission_overwrites":[],"last_message_id":"359092425609969684","name":"welcome","topic":"Wanting to eat brainz? You're in the right place!","position":0,"id":"300752710549110784","type":0},{"permission_overwrites":[],"name":"General","bitrate":64000,"position":0,"id":"300752710549110785","user_limit":0,"type":2},{"permission_overwrites":[{"allow":0,"deny":805829713,"id":"300752710549110784","type":"role"},{"allow":515136,"deny":805314577,"id":"300753265367187456","type":"role"},{"allow":515136,"deny":805314577,"id":"350638794933927937","type":"role"},{"allow":523328,"deny":805306385,"id":"350611286247342081","type":"role"}],"last_message_id":"362016452896882700","last_pin_timestamp":"2017-09-23T00:26:09.989000+00:00","nsfw":false,"parent_id":"361453368876597259","name":"strike","topic":"Strike times: 0400 UTC | 1200 UTC","position":5,"id":"300752841851666434","type":0},{"permission_overwrites":[{"allow":0,"deny":805829713,"id":"300752710549110784","type":"role"},{"allow":515136,"deny":805314577,"id":"300753265367187456","type":"role"},{"allow":515136,"deny":805314577,"id":"350638794933927937","type":"role"},{"allow":121856,"deny":805707857,"id":"332072090591035393","type":"role"}],"last_message_id":"362017325169377280","last_pin_timestamp":"2017-08-25T23:35:22.181000+00:00","nsfw":false,"parent_id":null,"name":"general","topic":"Chatter about anything! (Plus details on strikes)","position":1,"id":"300752899024224256","type":0},{"permission_overwrites":[{"allow":0,"deny":805829713,"id":"300752710549110784","type":"role"},{"allow":515136,"deny":805314577,"id":"300753265367187456","type":"role"},{"allow":515136,"deny":805314577,"id":"311738863070478347","type":"role"},{"allow":515136,"deny":805314577,"id":"300964771589783552","type":"role"}],"last_message_id":"352207741194076170","nsfw":false,"parent_id":null,"name":"allies","topic":"For all those not Scourge Members to chat to the Scourge","position":3,"id":"304220820492910592","type":0},{"permission_overwrites":[{"allow":0,"deny":1024,"id":"300752710549110784","type":"role"},{"allow":1024,"deny":0,"id":"300753265367187456","type":"role"}],"last_message_id":"344583879342030858","nsfw":false,"parent_id":"361453368876597259","name":"availability","topic":null,"position":6,"id":"325861567373508608","type":0},{"permission_overwrites":[{"allow":0,"deny":1024,"id":"300752710549110784","type":"role"},{"allow":1024,"deny":0,"id":"300753265367187456","type":"role"},{"allow":515136,"deny":805314577,"id":"348492288646971394","type":"role"}],"last_message_id":"361793442726150145","last_pin_timestamp":null,"nsfw":false,"parent_id":"361454113499906048","name":"other_games","topic":"Got a game we should play? Tell us about it :)","position":8,"id":"326722815942459393","type":0},{"permission_overwrites":[{"allow":0,"deny":805829713,"id":"300752710549110784","type":"role"},{"allow":252928,"deny":805576785,"id":"332072090591035393","type":"role"},{"allow":511040,"deny":1,"id":"328382915123871754","type":"role"},{"allow":523328,"deny":805306385,"id":"328882946285240331","type":"role"},{"allow":515136,"deny":805314577,"id":"350638794933927937","type":"role"}],"last_message_id":"361487672319016981","last_pin_timestamp":"2017-09-18T12:37:03.177010+00:00","nsfw":false,"parent_id":"361817023954550785","name":"minecraft","topic":null,"position":7,"id":"328382876158787586","type":0},{"permission_overwrites":[{"allow":0,"deny":871366673,"id":"300752710549110784","type":"role"},{"allow":49283072,"deny":822083601,"id":"300753265367187456","type":"role"},{"allow":49283072,"deny":822083601,"id":"328382915123871754","type":"role"}],"nsfw":false,"parent_id":"361817023954550785","name":"Minecraft voice","bitrate":30000,"position":1,"id":"328494554225573888","user_limit":0,"type":2},{"permission_overwrites":[{"allow":0,"deny":871366673,"id":"300752710549110784","type":"role"},{"allow":3145728,"deny":822083601,"id":"300753265367187456","type":"role"}],"nsfw":false,"parent_id":"361454113499906048","name":"game_room_2","bitrate":30000,"position":2,"id":"328494590233673739","user_limit":0,"type":2},{"permission_overwrites":[{"allow":0,"deny":1024,"id":"300752710549110784","type":"role"},{"allow":1024,"deny":0,"id":"300753265367187456","type":"role"},{"allow":515136,"deny":805314577,"id":"348492288646971394","type":"role"}],"last_message_id":"350376382754324480","last_pin_timestamp":"2017-07-06T14:45:29.117537+00:00","nsfw":false,"parent_id":"361453804413255681","name":"ts_it_help_desk","topic":null,"position":2,"id":"332300683535450113","type":0},{"permission_overwrites":[{"allow":0,"deny":1024,"id":"300752710549110784","type":"role"}],"nsfw":false,"parent_id":null,"name":"Urban Dead","position":0,"id":"361453368876597259","type":4},{"permission_overwrites":[{"allow":0,"deny":1024,"id":"300752710549110784","type":"role"}],"nsfw":false,"parent_id":null,"name":"Helpdesk","position":1,"id":"361453804413255681","type":4},{"permission_overwrites":[{"allow":0,"deny":1024,"id":"300752710549110784","type":"role"}],"nsfw":false,"parent_id":null,"name":"Other games","position":2,"id":"361454113499906048","type":4},{"permission_overwrites":[{"allow":0,"deny":1024,"id":"300752710549110784","type":"role"}],"nsfw":false,"parent_id":null,"name":"Games","position":3,"id":"361817023954550785","type":4},{"permission_overwrites":[{"allow":0,"deny":1024,"id":"300752710549110784","type":"role"},{"allow":523328,"deny":805306385,"id":"361818653798170635","type":"role"}],"last_message_id":"362006117766791168","nsfw":false,"parent_id":"361817023954550785","name":"eve","topic":null,"position":4,"id":"361817686147072000","type":0}],"name":"Scourge","mfa_level":0,"region":"eu-central","splash":null}) org.json.JSONException: JSONObject["parent_id"] not a string. at org.json.JSONObject.getString(JSONObject.java:658) at de.btobastian.javacord.entities.impl.ImplChannel.<init>(ImplChannel.java:106) at de.btobastian.javacord.entities.impl.ImplServer.<init>(ImplServer.java:140) at de.btobastian.javacord.utils.handler.server.GuildCreateHandler.handle(GuildCreateHandler.java:59) at de.btobastian.javacord.utils.PacketHandler$1.run(PacketHandler.java:71) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)

Unfinished Permission List

The permission list isn't completed yet, but here is the fix for the list for you:

// general
CREATE_INSTANT_INVITE(0),
KICK_MEMBERS(1),
BAN_MEMBERS(2),
ADMINISTATOR(3),
MANAGE_CHANNELS(4),
MANAGE_SERVER(5),
ADD_REACTIONS(6),

// chat
READ_MESSAGES(10),
SEND_MESSAGES(11),
SEND_TTS_MESSAGES(12),
MANAGE_MESSAGES(13),
EMBED_LINKS(14),
ATTACH_FILE(15),
READ_MESSAGE_HISTORY(16),
MENTION_EVERYONE(17),
USE_EXTERNAL_EMOJIS(18),

// voice
VOICE_CONNECT(20),
VOICE_SPEAK(21),
VOICE_MUTE_MEMBERS(22),
VOICE_DEAFEN_MEMBERS(23),
VOICE_MOVE_MEMBERS(24),
VOICE_USE_VAD(25),

// misc
CHANGE_NICKNAME(26),
MANAGE_NICKNAMES(27),
MANAGE_ROLES(28),
MANAGE_WEBHOOKS(29),
MANAGE_EMOJIS(30);

Those are the enums for the PermissionType class, hope that helps :P

Can't login to 'real' account

I'm attempting to log into a real account using the API. But it's throwing an error and an exception saying this:

java.lang.IllegalArgumentException: 400 Bad request! Maybe wrong email or password?
at de.btobastian.javacord.ImplDiscordAPI.requestTokenBlocking(ImplDiscordAPI.java:1014)
at de.btobastian.javacord.ImplDiscordAPI.connectBlocking(ImplDiscordAPI.java:160)
at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:147)
at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:144)

I made sure the email and password are right. I even went to the discord program, logged out. Copied the email I put. Put it in the email box, copied the password from the program and hit login on discord, and it logged me in. So I do not know what the problem is :/ . I Do not have 2-FA enabled. I only require an email and password to login.

not work with multiple bot / NullPointerException

if define multiple bot
Can't send msg to channels.

api.getChannelById(channelID).sendMessage(RESTART_MSG);

api is NOT NULL
channelID is NOT NULL
RESTART_MSG is NOT NULL

api.getChannelById(channelID) is NULL

api.getChannels().isEmpty() is TRUE

com.google.common.util.concurrent.AbstractFuture executeListener
Fatal: RuntimeException while executing runnable com.google.common.util.concurrent.Futures$4@6f4e08e0 with executor MoreExecutors.directExecutor()
java.lang.NullPointerException
at org.crawler.bot.DiscordBot$1.onSuccess(DiscordBot.java:67)
at org.
.crawler.bot.DiscordBot$1.onSuccess(DiscordBot.java:1)
at com.google.common.util.concurrent.Futures$4.run(Futures.java:1132)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:653)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Updating permissions doesnt always update completely

I have a collection

Collection<Role> p = user.getRoles(svr);
if(p.contains(svr.getRoleById("237877860306649089")) && !p.contains(svr.getRoleById("235400239132049418"))){
                        p.remove(svr.getRoleById("237877860306649089"));
                        p.add(svr.getRoleById("235400239132049418"));
                    }
                    Role[] r = new Role[p.size()];
                    for(int i = 0; i < p.size(); i++) {
                        r[i] = Iterables.get(p, i);
                    }
                    Future<Exception> exceptionFuture = svr.updateRoles(user, r);

I am iterating through to update and remove/add what i want, however it doesnt always update both perms, one or the other updates.

Like it removes but doesnt add or it adds but doesnt remove

Can't login to 'real' account

java.lang.IllegalArgumentException: 400 Bad request! Maybe wrong email or password? StatusText: BAD REQUEST; Body: {"captcha_key":["captcha-required"]}
at de.btobastian.javacord.ImplDiscordAPI.requestTokenBlocking(ImplDiscordAPI.java:804)
at de.btobastian.javacord.ImplDiscordAPI.connectBlocking(ImplDiscordAPI.java:157)
at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:145)
at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:142)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

[Suggestion] Add API for getting all guild members including offline ones

Have not tested

@Override
public Future<Collection<User>> getAllMembers() {
    return api.getThreadPool().getExecutorService().submit(new Callable<Collection<User>>() {
        @Override
        public Collection<User> call() throws Exception {
            logger.debug("Requesting members (server id: {}", id);
            List<User> users = new ArrayList<>();
            int limit = 1000;
            String after = "0";
            while (true) {
                String link = "https://discordapp.com/api/guilds/" + id + "/members?&limit=" + limit + "&after=" + after;
                HttpResponse<JsonNode> response = Unirest.get(link).header("authorization", api.getToken()).asJson();
                api.checkResponse(response);
                api.checkRateLimit(response, RateLimitType.UNKNOWN, null, null);
                JSONArray array = response.getBody().getArray();
                for (int i = 0; i < array.length(); i++) {
                    User user = new ImplUser(array.getJSONObject(i), api);
                    users.add(user);
                    after = user.getId();
                }
                if (array.length() < limit) {
                    break;
                }
            }
            return users;
        }
    });
}

accepting invites does not work

doing acceptInvite does not join the guild all it does is print this in console

[pool-61-thread-2] DEBUG d.btobastian.javacord.ImplDiscordAPI - Trying to accept invite (code: [REMOVED])
[pool-61-thread-2] INFO  d.btobastian.javacord.ImplDiscordAPI - Accepted invite and waiting for listener to be called (code: [REMOVED], server id: [REMOVED])

'Timestamp' attribute on messages ignores the timezone.

Currently the timestamp attribute on messages completely ignores the timezone, which causes major issues when comparing the time. As no TZ is supplied, Java assumes it wants to use the system time, which means unless the system is set to use UTC, the time will be wrong.

This can be remedied in one of two ways:

  • Just set the calendar instance to UTC
  • Or better, implement proper timestamp handling that includes the timezone.

java.lang.IllegalStateException when connecting

Roughly 2/3rds of the times that I attempt to connect to my bot, I get the following error:

java.lang.IllegalStateException: Socket closed before ready packet was received!
	at de.btobastian.javacord.ImplDiscordAPI.connectBlocking(ImplDiscordAPI.java:162)
	at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:144)
	at de.btobastian.javacord.ImplDiscordAPI$2.call(ImplDiscordAPI.java:141)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Can't Be Executed

Followed the tutorials exactly, downloading all the files, setting up the packages, etc. Have two errors:

1: When trying to run the shaded.jar from command line, I get a no main manifest attribute error.

screenshot 3

2: When trying to run the "ping" example, using my token, I get a can't be executed error.

eclipse_error

Any help on either?

No timeout/delay when reconnecting?

Disclaimer:

This occurred with Javacord 2.0.14 (latest version as of May 19), and I would try again on 2.0.15 if I could, but I am unable to replicate the exact circumstances that caused this to happen in either 2.0.14 or 2.0.15. I deeply apologize for being unable to do this and therefore submitting an issue for an older version. I am submitting this in the hopes that a fix can be made, but feel free to close it if you feel that it's an invalid issue for that reason. I can't find any changes in the commits following the affected build that would indicate a fix has been made. If it is fixed then you can of course close this issue, but due to the potential severity regarding rate limits, I've chosen to submit it anyway.


I got an email this morning from Discord saying that they had changed the token of my bot after it had "connected to Discord more than 1000 times within a short time period." I connected to my server box to read the Javacord output and realized that Javacord doesn't seem to have a timeout when reconnecting to Discord. The connection failed repeatedly with error code 4004 (Authentication failed.) because the token was wrong. I am not sure what caused this error to appear initially because by the time I saw the error appear, the root cause had disappeared and it wasn't logged to disk properly on my end, but it looks like Javacord got itself stuck in an infinite reconnection loop. As I was watching the log, several connection attempts were made per second, apparent from the output produced by Javacord (see below).

I propose that a timeout is added when attempting to reconnect. Perhaps it should be possible to specify the timeout/delay period manually through some method.

Short snippet from the log:

INFO: Could not resume session. Reconnecting now...
Aug 08, 2017 2:20:18 AM de.btobastian.javacord.utils.JavacordLogger info
INFO: Websocket closed with reason Authentication failed. and code 4004 by server!
Aug 08, 2017 2:20:18 AM de.btobastian.javacord.utils.JavacordLogger info
INFO: Could not resume session. Reconnecting now...
Aug 08, 2017 2:20:18 AM de.btobastian.javacord.utils.JavacordLogger info
INFO: Could not resume session. Reconnecting now...
Aug 08, 2017 2:20:18 AM de.btobastian.javacord.utils.JavacordLogger info
INFO: Websocket closed with reason Authentication failed. and code 4004 by server!

Please let me know if you need more details.

Error when running example code

Hey, I'm trying out javacord, but i keep getting an ExceptionInInitializerError even though I only copy'd your code and set everything up the way they should.

Exception in thread "main" java.lang.ExceptionInInitializerError at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.getDefaultRegistry(PoolingHttpClientConnectionManager.java:109) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:116) at com.mashape.unirest.http.options.Options.refresh(Options.java:72) at com.mashape.unirest.http.options.Options.<clinit>(Options.java:46) at com.mashape.unirest.http.Unirest.setDefaultHeader(Unirest.java:123) at de.btobastian.javacord.Javacord.<clinit>(Javacord.java:45) at nl.rbhva.discordcalendar.App.main(App.java:12) Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl (Caused by java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl) at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1158) at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:960) at java.security.AccessController.doPrivileged(Native Method) at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:957) at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:624) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655) at org.apache.http.conn.ssl.AbstractVerifier.<init>(AbstractVerifier.java:60) at org.apache.http.conn.ssl.AllowAllHostnameVerifier.<init>(AllowAllHostnameVerifier.java:43) at org.apache.http.conn.ssl.AllowAllHostnameVerifier.<clinit>(AllowAllHostnameVerifier.java:45) ... 8 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1020) ... 16 more

I don't know if this is the right place to ask but what am I doing wrong?

Thanks in advance,
Raphaรซl Bunck

Invalid session when starting multiple shards (v3)

If I start multiple shards like e. g. in

DiscordApiBuilder discordApiBuilder = new DiscordApiBuilder().setToken(botToken);
discordApiBuilder.setShard(0, 2).login().exceptionally(Javacord::exceptionLogger);
try { Thread.sleep(5000); } catch (InterruptedException e) { }
discordApiBuilder.setShard(1, 2).login().exceptionally(Javacord::exceptionLogger);

then on starting the second shard, the log bears the message Could not resume session. Reconnecting in 5 seconds...
The 5 seconds later it works fine.

This has something to do with timing. If I wait 6 seconds it works fine the first time. If I start 3 shards, with 5 seconds delay each, then 1 goes fine, 2 hits the message and is delayed, then 3 comes first, can connect normally 1 comes right after and again hits the message and is delayed and then on the next try it works.

Here the corresponding log file:

2017-12-22 01:29:15,863 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <     de.btobastian.javacord.utils.rest.RestRequest> Trying to send GET request to https://discordapp.com/api/v6/gateway/bot
2017-12-22 01:29:15,954 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> < org.apache.http.client.protocol.RequestAddCookies> CookieSpec selected: default
2017-12-22 01:29:15,954 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <  org.apache.http.client.protocol.RequestAuthCache> Auth cache not set in the context
2017-12-22 01:29:15,954 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection request: [route: {s}->https://discordapp.com:443][total kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 200]
2017-12-22 01:29:15,954 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection leased: [id: 1][route: {s}->https://discordapp.com:443][total kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200]
2017-12-22 01:29:15,955 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <     org.apache.http.impl.execchain.MainClientExec> Opening connection {s}->https://discordapp.com:443
2017-12-22 01:29:15,955 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <http.impl.conn.DefaultHttpClientConnectionOperator> Connecting to discordapp.com/104.16.58.5:443
2017-12-22 01:29:15,955 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory> Connecting socket to discordapp.com/104.16.58.5:443 with timeout 10000
2017-12-22 01:29:15,969 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory> Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
2017-12-22 01:29:15,969 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory> Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2017-12-22 01:29:15,969 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory> Starting handshake
2017-12-22 01:29:16,012 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory> Secure session established
2017-12-22 01:29:16,012 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory>  negotiated protocol: TLSv1.2
2017-12-22 01:29:16,012 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory>  negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
2017-12-22 01:29:16,012 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory>  peer principal: CN=discordapp.com, OU=PositiveSSL, OU=Domain Control Validated
2017-12-22 01:29:16,012 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory>  peer alternative names: [discordapp.com, www.discordapp.com]
2017-12-22 01:29:16,012 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <rg.apache.http.conn.ssl.SSLConnectionSocketFactory>  issuer principal: CN=COMODO RSA Domain Validation Secure Server CA, O=COMODO CA Limited, L=Salford, ST=Greater Manchester, C=GB
2017-12-22 01:29:16,013 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <http.impl.conn.DefaultHttpClientConnectionOperator> Connection established 10.10.10.25:60800<->104.16.58.5:443
2017-12-22 01:29:16,013 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <.http.impl.conn.DefaultManagedHttpClientConnection> http-outgoing-1: set socket timeout to 60000
2017-12-22 01:29:16,013 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <     org.apache.http.impl.execchain.MainClientExec> Executing request GET /api/v6/gateway/bot HTTP/1.1
2017-12-22 01:29:16,013 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <     org.apache.http.impl.execchain.MainClientExec> Proxy auth state: UNCHALLENGED
2017-12-22 01:29:16,013 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 >> GET /api/v6/gateway/bot HTTP/1.1
2017-12-22 01:29:16,014 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 >> accept-encoding: gzip
2017-12-22 01:29:16,014 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 >> authorization: Bot <token>
2017-12-22 01:29:16,014 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 >> user-agent: unirest-java/1.3.11
2017-12-22 01:29:16,014 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 >> Host: discordapp.com
2017-12-22 01:29:16,014 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 >> Connection: Keep-Alive
2017-12-22 01:29:16,014 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 >> "GET /api/v6/gateway/bot HTTP/1.1[\r][\n]"
2017-12-22 01:29:16,014 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 >> "accept-encoding: gzip[\r][\n]"
2017-12-22 01:29:16,015 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 >> "authorization: Bot <token>[\r][\n]"
2017-12-22 01:29:16,015 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 >> "user-agent: unirest-java/1.3.11[\r][\n]"
2017-12-22 01:29:16,015 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 >> "Host: discordapp.com[\r][\n]"
2017-12-22 01:29:16,015 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
2017-12-22 01:29:16,015 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 >> "[\r][\n]"
2017-12-22 01:29:16,135 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "HTTP/1.1 200 OK[\r][\n]"
2017-12-22 01:29:16,135 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Date: Fri, 22 Dec 2017 00:29:16 GMT[\r][\n]"
2017-12-22 01:29:16,136 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Content-Type: application/json[\r][\n]"
2017-12-22 01:29:16,136 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Transfer-Encoding: chunked[\r][\n]"
2017-12-22 01:29:16,136 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Connection: keep-alive[\r][\n]"
2017-12-22 01:29:16,136 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Set-Cookie: __cfduid=d22d37ccc36c8e878597e6a7ae6a32b0c1513902556; expires=Sat, 22-Dec-18 00:29:16 GMT; path=/; domain=.discordapp.com; HttpOnly[\r][\n]"
2017-12-22 01:29:16,136 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Strict-Transport-Security: max-age=31536000; includeSubDomains[\r][\n]"
2017-12-22 01:29:16,136 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "X-RateLimit-Limit: 2[\r][\n]"
2017-12-22 01:29:16,136 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "X-RateLimit-Remaining: 0[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "X-RateLimit-Reset: 1513902562[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Via: 1.1 google[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Alt-Svc: clear[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Server: cloudflare-nginx[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "CF-RAY: 3d0ef7438fa526f0-FRA[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "Content-Encoding: gzip[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "4a[\r][\n]"
2017-12-22 01:29:16,137 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x3][0xaa]V*-[0xca]Q[0xb2]RP*/.[0xb6][0xd2][0xd7]OO,I-O[0xac][0xd4]K[0xc9],N[0xce]/J[0xd1]KOW[0xd2]QP*[0xce]H,J)V[0xb2]R0[0xac][0x5][0x0][0x0][0x0][0xff][0xff][0x3][0x0][0x8d][0x9d][0xfc]]0[0x0][0x0][0x0][\r][\n]"
2017-12-22 01:29:16,138 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << HTTP/1.1 200 OK
2017-12-22 01:29:16,138 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Date: Fri, 22 Dec 2017 00:29:16 GMT
2017-12-22 01:29:16,142 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Content-Type: application/json
2017-12-22 01:29:16,142 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Transfer-Encoding: chunked
2017-12-22 01:29:16,143 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Connection: keep-alive
2017-12-22 01:29:16,143 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Set-Cookie: __cfduid=d22d37ccc36c8e878597e6a7ae6a32b0c1513902556; expires=Sat, 22-Dec-18 00:29:16 GMT; path=/; domain=.discordapp.com; HttpOnly
2017-12-22 01:29:16,143 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Strict-Transport-Security: max-age=31536000; includeSubDomains
2017-12-22 01:29:16,143 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << X-RateLimit-Limit: 2
2017-12-22 01:29:16,143 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << X-RateLimit-Remaining: 0
2017-12-22 01:29:16,143 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << X-RateLimit-Reset: 1513902562
2017-12-22 01:29:16,143 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Via: 1.1 google
2017-12-22 01:29:16,143 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Alt-Svc: clear
2017-12-22 01:29:16,144 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Server: cloudflare-nginx
2017-12-22 01:29:16,144 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << CF-RAY: 3d0ef7438fa526f0-FRA
2017-12-22 01:29:16,144 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                           org.apache.http.headers> http-outgoing-1 << Content-Encoding: gzip
2017-12-22 01:29:16,144 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <     org.apache.http.impl.execchain.MainClientExec> Connection can be kept alive indefinitely
2017-12-22 01:29:16,145 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <apache.http.client.protocol.ResponseProcessCookies> Cookie accepted [__cfduid="d22d37ccc36c8e878597e6a7ae6a32b0c1513902556", version:0, domain:discordapp.com, path:/, expiry:Sat Dec 22 01:29:16 CET 2018]
2017-12-22 01:29:16,148 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "0[\r][\n]"
2017-12-22 01:29:16,149 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <                              org.apache.http.wire> http-outgoing-1 << "[\r][\n]"
2017-12-22 01:29:16,149 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection [id: 1][route: {s}->https://discordapp.com:443] can be kept alive indefinitely
2017-12-22 01:29:16,149 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection released: [id: 1][route: {s}->https://discordapp.com:443][total kept alive: 1; route allocated: 1 of 20; total allocated: 1 of 200]
2017-12-22 01:29:16,149 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <     org.apache.http.impl.execchain.MainClientExec> Cancelling request execution
2017-12-22 01:29:16,150 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <     de.btobastian.javacord.utils.rest.RestRequest> Sent GET request to https://discordapp.com/api/v6/gateway/bot and received status code 200 with body {"shards":1,"url":"wss://gateway.discord.gg"}
2017-12-22 01:29:16,185 <DEBUG> <pool-2-thread-1          > <[]> <{shard=0}> <bastian.javacord.utils.ratelimits.RatelimitManager> Calculated an offset of -150 to the Discord time.
2017-12-22 01:29:16,616 <DEBUG> <ReadingThread            > <[]> <{shard=0}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Sending identify packet
2017-12-22 01:29:16,620 <DEBUG> <ReadingThread            > <[]> <{shard=0}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Received HELLO packet
2017-12-22 01:29:16,760 <DEBUG> <Timer-0                  > <[]> <{shard=0}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Sent heartbeat (interval: 41250)
2017-12-22 01:29:16,761 <DEBUG> <ReadingThread            > <[]> <{shard=0}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Received READY packet
2017-12-22 01:29:20,865 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     de.btobastian.javacord.utils.rest.RestRequest> Trying to send GET request to https://discordapp.com/api/v6/gateway/bot
2017-12-22 01:29:20,866 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> < org.apache.http.client.protocol.RequestAddCookies> CookieSpec selected: default
2017-12-22 01:29:20,867 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> < org.apache.http.client.protocol.RequestAddCookies> Cookie [version: 0][name: __cfduid][value: d22d37ccc36c8e878597e6a7ae6a32b0c1513902556][domain: discordapp.com][path: /][expiry: Sat Dec 22 01:29:16 CET 2018] match [(secure)discordapp.com:443/api/v6/gateway/bot]
2017-12-22 01:29:20,869 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <  org.apache.http.client.protocol.RequestAuthCache> Auth cache not set in the context
2017-12-22 01:29:20,869 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection request: [route: {s}->https://discordapp.com:443][total kept alive: 1; route allocated: 1 of 20; total allocated: 1 of 200]
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[read] I/O error: Read timed out"
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection leased: [id: 1][route: {s}->https://discordapp.com:443][total kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200]
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.DefaultManagedHttpClientConnection> http-outgoing-1: set socket timeout to 60000
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     org.apache.http.impl.execchain.MainClientExec> Executing request GET /api/v6/gateway/bot HTTP/1.1
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     org.apache.http.impl.execchain.MainClientExec> Proxy auth state: UNCHALLENGED
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> GET /api/v6/gateway/bot HTTP/1.1
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> accept-encoding: gzip
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> authorization: Bot <token>
2017-12-22 01:29:20,872 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> user-agent: unirest-java/1.3.11
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> Host: discordapp.com
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> Connection: Keep-Alive
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> Cookie: __cfduid=d22d37ccc36c8e878597e6a7ae6a32b0c1513902556
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "GET /api/v6/gateway/bot HTTP/1.1[\r][\n]"
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "accept-encoding: gzip[\r][\n]"
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "authorization: Bot <token>[\r][\n]"
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "user-agent: unirest-java/1.3.11[\r][\n]"
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "Host: discordapp.com[\r][\n]"
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "Cookie: __cfduid=d22d37ccc36c8e878597e6a7ae6a32b0c1513902556[\r][\n]"
2017-12-22 01:29:20,873 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "[\r][\n]"
2017-12-22 01:29:20,884 <DEBUG> <Thread-2                 > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Closing expired connections
2017-12-22 01:29:20,885 <DEBUG> <Thread-2                 > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Closing connections idle longer than 30 SECONDS
2017-12-22 01:29:20,995 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "HTTP/1.1 200 OK[\r][\n]"
2017-12-22 01:29:20,995 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Date: Fri, 22 Dec 2017 00:29:21 GMT[\r][\n]"
2017-12-22 01:29:20,995 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Content-Type: application/json[\r][\n]"
2017-12-22 01:29:20,996 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Transfer-Encoding: chunked[\r][\n]"
2017-12-22 01:29:20,996 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Connection: keep-alive[\r][\n]"
2017-12-22 01:29:20,996 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Strict-Transport-Security: max-age=31536000; includeSubDomains[\r][\n]"
2017-12-22 01:29:20,996 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "X-RateLimit-Limit: 2[\r][\n]"
2017-12-22 01:29:20,996 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "X-RateLimit-Remaining: 1[\r][\n]"
2017-12-22 01:29:20,996 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "X-RateLimit-Reset: 1513902567[\r][\n]"
2017-12-22 01:29:20,996 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Via: 1.1 google[\r][\n]"
2017-12-22 01:29:20,997 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Alt-Svc: clear[\r][\n]"
2017-12-22 01:29:20,997 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Server: cloudflare-nginx[\r][\n]"
2017-12-22 01:29:20,997 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "CF-RAY: 3d0ef761e98726f0-FRA[\r][\n]"
2017-12-22 01:29:20,997 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Content-Encoding: gzip[\r][\n]"
2017-12-22 01:29:20,997 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[\r][\n]"
2017-12-22 01:29:20,997 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "4a[\r][\n]"
2017-12-22 01:29:20,997 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x3][0xaa]V*-[0xca]Q[0xb2]RP*/.[0xb6][0xd2][0xd7]OO,I-O[0xac][0xd4]K[0xc9],N[0xce]/J[0xd1]KOW[0xd2]QP*[0xce]H,J)V[0xb2]R0[0xac][0x5][0x0][0x0][0x0][0xff][0xff][0x3][0x0][0x8d][0x9d][0xfc]]0[0x0][0x0][0x0][\r][\n]"
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << HTTP/1.1 200 OK
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Date: Fri, 22 Dec 2017 00:29:21 GMT
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Content-Type: application/json
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Transfer-Encoding: chunked
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Connection: keep-alive
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Strict-Transport-Security: max-age=31536000; includeSubDomains
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << X-RateLimit-Limit: 2
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << X-RateLimit-Remaining: 1
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << X-RateLimit-Reset: 1513902567
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Via: 1.1 google
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Alt-Svc: clear
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Server: cloudflare-nginx
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << CF-RAY: 3d0ef761e98726f0-FRA
2017-12-22 01:29:20,998 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Content-Encoding: gzip
2017-12-22 01:29:20,999 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     org.apache.http.impl.execchain.MainClientExec> Connection can be kept alive indefinitely
2017-12-22 01:29:20,999 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "0[\r][\n]"
2017-12-22 01:29:20,999 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[\r][\n]"
2017-12-22 01:29:21,000 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection [id: 1][route: {s}->https://discordapp.com:443] can be kept alive indefinitely
2017-12-22 01:29:21,000 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection released: [id: 1][route: {s}->https://discordapp.com:443][total kept alive: 1; route allocated: 1 of 20; total allocated: 1 of 200]
2017-12-22 01:29:21,000 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     org.apache.http.impl.execchain.MainClientExec> Cancelling request execution
2017-12-22 01:29:21,000 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     de.btobastian.javacord.utils.rest.RestRequest> Sent GET request to https://discordapp.com/api/v6/gateway/bot and received status code 200 with body {"shards":1,"url":"wss://gateway.discord.gg"}
2017-12-22 01:29:21,000 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <bastian.javacord.utils.ratelimits.RatelimitManager> Calculated an offset of 0 to the Discord time.
2017-12-22 01:29:21,302 <DEBUG> <ReadingThread            > <[]> <{shard=1}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Sending identify packet
2017-12-22 01:29:21,304 <DEBUG> <ReadingThread            > <[]> <{shard=1}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Received HELLO packet
2017-12-22 01:29:21,741 <INFO > <ReadingThread            > <[]> <{shard=1}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Could not resume session. Reconnecting in 5 seconds...
2017-12-22 01:29:25,886 <DEBUG> <Thread-2                 > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Closing expired connections
2017-12-22 01:29:25,886 <DEBUG> <Thread-2                 > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Closing connections idle longer than 30 SECONDS
2017-12-22 01:29:26,741 <DEBUG> <ReadingThread            > <[]> <{shard=1}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Sending identify packet
2017-12-22 01:29:26,874 <DEBUG> <ReadingThread            > <[]> <{shard=1}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Received READY packet
2017-12-22 01:29:26,874 <DEBUG> <Timer-1                  > <[]> <{shard=1}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Sent heartbeat (interval: 41250)
2017-12-22 01:29:26,976 <DEBUG> <pool-14-thread-1         > <[]> <{shard=1}> <.btobastian.javacord.utils.DiscordWebsocketAdapter> Updating status (game: !help)
2017-12-22 01:29:26,982 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     de.btobastian.javacord.utils.rest.RestRequest> Trying to send GET request to https://discordapp.com/api/v6/oauth2/applications/@me
2017-12-22 01:29:26,983 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> < org.apache.http.client.protocol.RequestAddCookies> CookieSpec selected: default
2017-12-22 01:29:26,983 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> < org.apache.http.client.protocol.RequestAddCookies> Cookie [version: 0][name: __cfduid][value: d22d37ccc36c8e878597e6a7ae6a32b0c1513902556][domain: discordapp.com][path: /][expiry: Sat Dec 22 01:29:16 CET 2018] match [(secure)discordapp.com:443/api/v6/oauth2/applications/@me]
2017-12-22 01:29:26,984 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <  org.apache.http.client.protocol.RequestAuthCache> Auth cache not set in the context
2017-12-22 01:29:26,984 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection request: [route: {s}->https://discordapp.com:443][total kept alive: 1; route allocated: 1 of 20; total allocated: 1 of 200]
2017-12-22 01:29:26,985 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[read] I/O error: Read timed out"
2017-12-22 01:29:26,985 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection leased: [id: 1][route: {s}->https://discordapp.com:443][total kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200]
2017-12-22 01:29:26,985 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.DefaultManagedHttpClientConnection> http-outgoing-1: set socket timeout to 60000
2017-12-22 01:29:26,986 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     org.apache.http.impl.execchain.MainClientExec> Executing request GET /api/v6/oauth2/applications/@me HTTP/1.1
2017-12-22 01:29:26,986 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     org.apache.http.impl.execchain.MainClientExec> Proxy auth state: UNCHALLENGED
2017-12-22 01:29:26,986 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> GET /api/v6/oauth2/applications/@me HTTP/1.1
2017-12-22 01:29:26,986 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> accept-encoding: gzip
2017-12-22 01:29:26,986 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> authorization: Bot <token>
2017-12-22 01:29:26,986 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> user-agent: unirest-java/1.3.11
2017-12-22 01:29:26,986 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> Host: discordapp.com
2017-12-22 01:29:26,987 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> Connection: Keep-Alive
2017-12-22 01:29:26,987 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 >> Cookie: __cfduid=d22d37ccc36c8e878597e6a7ae6a32b0c1513902556
2017-12-22 01:29:26,987 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "GET /api/v6/oauth2/applications/@me HTTP/1.1[\r][\n]"
2017-12-22 01:29:26,987 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "accept-encoding: gzip[\r][\n]"
2017-12-22 01:29:26,987 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "authorization: Bot <token>[\r][\n]"
2017-12-22 01:29:26,987 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "user-agent: unirest-java/1.3.11[\r][\n]"
2017-12-22 01:29:26,988 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "Host: discordapp.com[\r][\n]"
2017-12-22 01:29:26,988 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
2017-12-22 01:29:26,988 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "Cookie: __cfduid=d22d37ccc36c8e878597e6a7ae6a32b0c1513902556[\r][\n]"
2017-12-22 01:29:26,988 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 >> "[\r][\n]"
2017-12-22 01:29:27,110 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "HTTP/1.1 200 OK[\r][\n]"
2017-12-22 01:29:27,110 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Date: Fri, 22 Dec 2017 00:29:27 GMT[\r][\n]"
2017-12-22 01:29:27,111 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Content-Type: application/json[\r][\n]"
2017-12-22 01:29:27,111 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Transfer-Encoding: chunked[\r][\n]"
2017-12-22 01:29:27,111 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Connection: keep-alive[\r][\n]"
2017-12-22 01:29:27,111 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Strict-Transport-Security: max-age=31536000; includeSubDomains[\r][\n]"
2017-12-22 01:29:27,111 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Content-Encoding: gzip[\r][\n]"
2017-12-22 01:29:27,111 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Via: 1.1 google[\r][\n]"
2017-12-22 01:29:27,112 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Alt-Svc: clear[\r][\n]"
2017-12-22 01:29:27,112 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "Server: cloudflare-nginx[\r][\n]"
2017-12-22 01:29:27,112 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "CF-RAY: 3d0ef7882d2b26f0-FRA[\r][\n]"
2017-12-22 01:29:27,112 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[\r][\n]"
2017-12-22 01:29:27,112 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "12b[\r][\n]"
2017-12-22 01:29:27,113 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x3]M[0x90]Kn[0xc3] [0x10][0x86][0xaf]2b[0xdd]D[0xd8][0x18]lwWUU/Pu[0x1b][0x8d]a[0xec] 9[0xe0][0x2]N[0x15]E[0xb9]{[0xc1]M[0xa4][0xac][0x80][0xff][0x1][0x1f]se[0x86][0xa2][0xe]vI[0xd6];[0xf6][\n]"
2017-12-22 01:29:27,113 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[0xec][\r][0x6][0x9f]`[0xf4][0x1]R@[0x17]g,F[0xdc][0xc3][0xfb][0x1a][0x2][0xb9]4_[0xc0]&[0xf0].[0xaf]q][0x16][0x1f]R[0x4]\[0x93][0xdf]=[0xa5][0xc1][0x8f]@g[\n]"
2017-12-22 01:29:27,113 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[0x97]t[0xb4]n[0x2][0xe7][0xdd][0xee][0xc3]M[0xb3][0x8d][0xc7][0xd2][0x8d]D[0x11][0x92][0x87][0x87]t[0xb6][0x8][0x9f][0xde]O3[0xc1][0xd7][0xfd][0xe][0xda][0xb3][0x17]`[0xe]OT[0x88][0x1e][0xaa][0xf]E[0xf5][0xbf][0x8e]B[0x96][0xaf]l[0x8d][0x14][0x1e][0x99]o<-6P[0x9][0x18][[0xfe]s[0xb2]nkdOH[0xd5][0x16][0xc3][0x9a][0xed][0xd4]T[0x92][0xcb][0x9a][0xb7]y[0xc3]kQ[0xb]Q<<c[0xc2]-=(mj[0xd5]"VrT[0x9a][0x1a]Sq[0xa3];[0xea][0xa5]i[0x6][0xd3]t[0x82][0xdd]r<[0x8f][0xe8][0xb0][0xac][0xc3]lu[0xae][0x8c]8G[0xba][0x8b][0x81]~[0xd6][0xcc]q[0xd0][0xde][0xd0]a[0xca][0xe0][0xe9])p[0x7][0xe8]y[0xcf][0x95]P[0xaa]oeF[0xa8][0xba]n[0x83][0xd3][0xff][0xe3]7J[0xf3][0xae]i%[0xea]^[\n]"
2017-12-22 01:29:27,113 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "T"[0xbf]H[0x1a][0x1b][0xd3][0xa3]2\+d[0xb7]?[0xd9][0x1c][0x97] [0xb2][0x1][0x0][0x0][\r][\n]"
2017-12-22 01:29:27,113 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << HTTP/1.1 200 OK
2017-12-22 01:29:27,113 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Date: Fri, 22 Dec 2017 00:29:27 GMT
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Content-Type: application/json
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Transfer-Encoding: chunked
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Connection: keep-alive
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Strict-Transport-Security: max-age=31536000; includeSubDomains
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Content-Encoding: gzip
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Via: 1.1 google
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Alt-Svc: clear
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << Server: cloudflare-nginx
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                           org.apache.http.headers> http-outgoing-1 << CF-RAY: 3d0ef7882d2b26f0-FRA
2017-12-22 01:29:27,114 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     org.apache.http.impl.execchain.MainClientExec> Connection can be kept alive indefinitely
2017-12-22 01:29:27,115 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "0[\r][\n]"
2017-12-22 01:29:27,115 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <                              org.apache.http.wire> http-outgoing-1 << "[\r][\n]"
2017-12-22 01:29:27,116 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection [id: 1][route: {s}->https://discordapp.com:443] can be kept alive indefinitely
2017-12-22 01:29:27,116 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <.http.impl.conn.PoolingHttpClientConnectionManager> Connection released: [id: 1][route: {s}->https://discordapp.com:443][total kept alive: 1; route allocated: 1 of 20; total allocated: 1 of 200]
2017-12-22 01:29:27,116 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     org.apache.http.impl.execchain.MainClientExec> Cancelling request execution
2017-12-22 01:29:27,116 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <     de.btobastian.javacord.utils.rest.RestRequest> Sent GET request to https://discordapp.com/api/v6/oauth2/applications/@me and received status code 200 with body {"owner":{"id":"341505207341023233","avatar":"b6cd267aa15f6ce4d10dc8e95d4bd483","username":"Vampire","discriminator":"3567"},"bot_require_code_grant":false,"name":"Translator","icon":"d6c08475ac953a63483eca4d9a6d0c6a","description":"A bot for translations. Currently it only supports auto-translation of everything non-English it sees to English via Google Translate.","id":"390906366975410188","bot_public":false}
2017-12-22 01:29:27,117 <DEBUG> <pool-9-thread-1          > <[]> <{shard=1}> <bastian.javacord.utils.ratelimits.RatelimitManager> Calculated an offset of -116 to the Discord time.
2017-12-22 01:29:27,119 <INFO > <pool-9-thread-1          > <[]> <{shard=1}> <autler.discord.bot.translator.TranslatorDiscordBot> https://discordapp.com/oauth2/authorize?client_id=390906366975410188&scope=bot&permissions=3136
2017-12-22 01:29:30,886 <DEBUG> <Thread-2                 > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Closing expired connections
2017-12-22 01:29:30,886 <DEBUG> <Thread-2                 > <[]> <{shard=0}> <.http.impl.conn.PoolingHttpClientConnectionManager> Closing connections idle longer than 30 SECONDS

Cannot login with a username and password

Trying to use the API and connect with a username and password is impossible. Tracing the bug - it seems that the JSON payload of the response contains an "[username] field is required" and similar for password - it seems your login request is invalid somehow.

Bug at startup

22:09:50.385 [pool-4-thread-1] WARN de.btobastian.javacord.utils.PacketHandler - Couldn't handle packet of type VOICE_STATE_UPDATE. Please contact the developer! (packet: {"self_deaf":false,"user_id":"296277025944240150","guild_id":"275392071336984578","deaf":false,"session_id":"c485186050a4af91bbb22f8014775ab2","mute":false,"suppress":false,"self_video":false,"self_mute":false,"channel_id":"291808178411274240"}) java.lang.NullPointerException: null at de.btobastian.javacord.utils.handler.voice.VoiceStateUpdateHandler.handle(VoiceStateUpdateHandler.java:79) at de.btobastian.javacord.utils.PacketHandler$1.run(PacketHandler.java:71) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)

I'm using version 2.0.14-4

Voice system

Hello,
please add voice stream or something like this. I want to stream voice to VoiceChannel.

[Need help] updateRole() incomprehension

Hello,
I don't understand this function at updateRole(User user, Role Role[])
What is Role Role[] ?
My code server.updateRoles(message.getAuthor(), role.equals("Custom"));
Thanks to help me

New error when getting network connection problem

After updating to the latest development code, it seems to show up 4 times everytime there is connection issue.

[03:39:48] [WritingThread/WARN] [de.btobastian.javacord.utils.DiscordWebsocketAdapter/sponge]: Websocket error!
com.neovisionaries.ws.client.WebSocketException: Flushing frames to the server failed: Connection closed by remote host
at com.neovisionaries.ws.client.WritingThread.doFlush(WritingThread.java:436) [WritingThread.class:?]
at com.neovisionaries.ws.client.WritingThread.sendFrames(WritingThread.java:386) [WritingThread.class:?]
at com.neovisionaries.ws.client.WritingThread.main(WritingThread.java:110) [WritingThread.class:?]
at com.neovisionaries.ws.client.WritingThread.run(WritingThread.java:57) [WritingThread.class:?]
Caused by: java.net.SocketException: Connection closed by remote host
at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1555) ~[?:1.8.0_111]
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:71) ~[?:1.8.0_111]
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) ~[?:1.8.0_111]
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) ~[?:1.8.0_111]
at java.io.FilterOutputStream.flush(FilterOutputStream.java:140) ~[?:1.8.0_111]
at com.neovisionaries.ws.client.WritingThread.flush(WritingThread.java:273) ~[WritingThread.class:?]
at com.neovisionaries.ws.client.WritingThread.doFlush(WritingThread.java:424) ~[WritingThread.class:?]
... 3 more

Couldn't handle packet of type CHANNEL_DELETE

I don't know if this affects anything, but I keep getting this warning message:

WARNING: Couldn't handle packet of type CHANNEL_DELETE. Please contact the devel
oper! (packet: {"is_private":false,"permission_overwrites":[{"allow":269484048,"
deny":0,"id":"218839529073803264","type":"member"},{"allow":0,"deny":1048576,"id
":"341658166720856065","type":"role"}],"nsfw":false,"parent_id":null,"name":"Oll
e's Channel","guild_id":"341658166720856065","bitrate":64000,"position":8,"id":"
343444472178147328","user_limit":0,"type":"voice"})
java.lang.NullPointerException
        at de.btobastian.javacord.entities.impl.ImplServer.removeVoiceChannel(Im
plServer.java:1108)
        at de.btobastian.javacord.utils.handler.channel.ChannelDeleteHandler.han
dleServerVoiceChannel(ChannelDeleteHandler.java:102)
        at de.btobastian.javacord.utils.handler.channel.ChannelDeleteHandler.han
dle(ChannelDeleteHandler.java:64)
        at de.btobastian.javacord.utils.PacketHandler$1.run(PacketHandler.java:7
1)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:617)
        at java.lang.Thread.run(Thread.java:745)

NPE in GuildCreateHandler

java.lang.NullPointerException
        at de.btobastian.javacord.entities.impl.ImplServer.<init>(ImplServer.java:187)
        at de.btobastian.javacord.utils.handler.server.GuildCreateHandler.handle(GuildCreateHandler.java:59)
        at de.btobastian.javacord.utils.PacketHandler$1.run(PacketHandler.java:71)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

[Request] Try to reconnect x times every y minutes

For what I can tell, the way it works now is that by default the bot will try to reconnect 5 times in the last 5 minutes and if no connection is made it stops trying. But could it be done so it keeps trying to reconnect till a connection is made? Lets say, it tries 5 times in 5 minutes, but then waits a few more minutes and retries 5 more times, till it connects?
I know I could just increase the values to achieve something like that, but wouldn't be the ideal solution. I had worked a workaround for that in 2.0.14, but wasn't a very elegant solution either!

Couldn't handle packet of type READY when used as self bot

Everything works swimmingly when connecting with a bot token. But there is an exception in PacketHandler.java when it connects as a user. To try and troubleshoot I went back to the basic ping pong example, assuming that would work and I would have to work out what was wrong with my thing. But it still had the same problem. If I connect with a bot account it works fine, but it won't work with either an email and password or with my token. I guess this is probably more of a support issue, because if it wasn't possible to connect using a user account someone would have noticed by now. Do you know what I might have wrong?

This is the console output:
Sep 01, 2017 1:15:22 PM de.btobastian.javacord.utils.JavacordLogger info INFO: No SLF4J compatible logger was found. Using default javacord implementation! Sep 01, 2017 1:15:26 PM de.btobastian.javacord.utils.JavacordLogger warn WARNING: Couldn't handle packet of type READY. Please contact the developer! (packet:<snip: seems to have personal data> java.lang.NullPointerException at de.btobastian.javacord.entities.impl.ImplServer.<init>(ImplServer.java:187) at de.btobastian.javacord.utils.handler.ReadyHandler.handle(ReadyHandler.java:53) at de.btobastian.javacord.utils.PacketHandler.handlePacket(PacketHandler.java:80) at de.btobastian.javacord.utils.DiscordWebsocketAdapter.onTextMessage(DiscordWebsocketAdapter.java:168) at de.btobastian.javacord.utils.DiscordWebsocketAdapter.onBinaryMessage(DiscordWebsocketAdapter.java:259) at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368) at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:272) at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:992) at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:751) at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:110) at com.neovisionaries.ws.client.ReadingThread.run(ReadingThread.java:66)

And this is my code (basically identical to the ping pong example):

package main;

import de.btobastian.javacord.DiscordAPI;
import de.btobastian.javacord.Javacord;
import de.btobastian.javacord.entities.message.Message;
import de.btobastian.javacord.listener.message.MessageCreateListener;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.google.common.util.concurrent.FutureCallback;

public class Main
{
	static String botToken;
	static String myToken = (snip)
	static String email = (snip)
	static String password = (snip)

	public static void main(String[] args)
	{
		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		try (InputStream input = classLoader.getResourceAsStream("config.properties")) {
			Properties prop = new Properties();
			prop.load(input);
			botToken = prop.getProperty("test token");
		} catch (IOException e) {
			e.printStackTrace();
		}


		//DiscordAPI api = Javacord.getApi(email, password); //doesn't work
		DiscordAPI api = Javacord.getApi(myToken, false); //doesn't work
		//DiscordAPI api = Javacord.getApi(botToken, true); //works fine
		api.connect(new FutureCallback<DiscordAPI>()
		{
			@Override
			public void onSuccess(DiscordAPI api)
			{
				api.registerListener(new MessageCreateListener()
				{
					@Override
					public void onMessageCreate(DiscordAPI api, Message message)
					{
						if(message.getContent().equals("ping"))
						{
							message.reply("pong");
						}
					}
				});
			}
			@Override
			public void onFailure(Throwable t)
			{
				t.printStackTrace();
			}
		});
	}
}

Edit: it is actually running, but can't write replies. When it tries (after message.reply("pong")) this is the console output:
Sep 01, 2017 1:41:51 PM de.btobastian.javacord.utils.JavacordLogger warn WARNING: Uncaught exception in MessageCreateListener! java.lang.NullPointerException at de.btobastian.javacord.entities.message.impl.ImplMessage.reply(ImplMessage.java:402) at main.Main$1$1.onMessageCreate(Main.java:48) at de.btobastian.javacord.utils.handler.message.MessageCreateHandler$1.run(MessageCreateHandler.java:66) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Clear chat

Hi, I want to clean up the chat.
But when my code is executed, nothing happens.
Can you please tell me how to do this?
My code:
Future<MessageHistory> xuy = channel.getMessageHistory(2); channel.bulkDelete(String.valueOf(xuy));

No valid token provided AND missing email or password. Connecting not possible!

I am 100% sure I am using the right token (I copy and pasted, and followed the guide you wrote exactly). I am still getting this:

Exception in thread "main" java.lang.IllegalArgumentException: No valid token provided AND missing email or password. Connecting not possible!
	at de.btobastian.javacord.ImplDiscordAPI.connectBlocking(ImplDiscordAPI.java:154)
	at Main.<init>(Main.java:18)
	at Main.main(Main.java:11)

Tried with blocking and non-blocking. What should I do?

Login With 2FA Enabled

I enabled two factor authentication on my account, because of this I can not log in with this library. I would like it it you could allow the use of two factor authentication.

Implementation of discovering Listeners

Extending your listeners (e.g. MessageCreateListener) into another interface causes errors where the default java lookup of interfaces isn't enough. I recommend using Apache Common Lang's ClassUtils.getAllInterfaces(Class<?>) which allows for lookup of ALL interfaces, not just the ones declared in the class.

I've implemented a hackish version using Java Reflection on your ImplDiscordAPI and Javacord classes. This was my method:

    @Override
public void registerListener(Listener listener)
{
    for (Class<?> implementedInterface : ClassUtils.getAllInterfaces(listener.getClass()))
    {
        if (Listener.class.isAssignableFrom(implementedInterface))
        {
            List<Listener> listenersList = listeners.get(implementedInterface);
            if (listenersList == null)
            {
                listenersList = new ArrayList<>();
                listeners.put(implementedInterface, listenersList);
            }
            synchronized (listenersList)
            {
                listenersList.add(listener);
            }
        }
    }
}

I hope this is solved as it is a very useful when making custom classes to house command information that every command shall use.

Thanks in advance for consideration,
~Mystic

[Request] Add support for Nicknames

Hi, I can't find any way to utilize nicknames using Javacord. Either I just need sent in the right direction or there currently isn't support for nicknames. If it's the later I would like to request support be added.

[Request] onServerLogon

There is an onServerJoin method for determining when the bot is newly added to a server, but how about a listener that detects when the bot logs back onto a server it's already a member of. I can think of doing this by constantly looking at the ConcurrentHashMap of servers and detecting when it changes, but that seems like way too much computation.

Doesn't support reactions with custom emoji from other servers

As seen here, reactions automatically assume that the custom emoji are from the server the channel is sent from, meaning that reactions with custom emoji that aren't from that server aren't added to the Message entity.

public ImplReaction(ImplDiscordAPI api, Message message, JSONObject data) {
      -snip-
        if(emoji.isNull("id")) {
            this.customEmoji = null;
            this.unicodeEmoji = emoji.getString("name");
        } else {
            this.unicodeEmoji = null;
            this.customEmoji = message.getChannelReceiver().getServer().getCustomEmojiById(emoji.getString("id"));
        }
}

How should I handle replies to messages that are too long?

I tried splitting up replies into chunks of 2000 chars (that's the limit for each message), but it didn't work:

(the variable string is the response, by the way)

                            if(string != null) {
                                if(string.length() > 2000) {
                                    // split into chunks of 2000
                                    List<String> strings = new ArrayList<String>();
                                    int index = 0;
                                    int chunks = 2000;
                                    while (index < string.length()) {
                                        strings.add(string.substring(index, Math.min(index + chunks, string.length())));
                                        index += chunks;
                                    }

                                    for(String s : strings) {
                                        message.reply(string); // I know for a fact that `string` is set correctly and that the code to split messages into chunks is working. It is a problem with message.reply(string).
                                    }
                                } else*/
                                    message.reply(string);
                            }

There's no output or exceptions. No messages sent on discord. No nothing. It simply just does not work. I tried putting a Thread.sleep(1000) after the message.reply(string) to see if maybe a delay would work, but nope. I also tried making the message chunks 500 chars long, but that didn't work either. Honestly, I have no idea what to say.

I'm sorry but I must be really stupid.

How do I send a message? I'm not talking about replying to one I'm talking about sending a message in general. I've looked through the source files and the javadocs and I cant find anything.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.