Why Javacord?

It's fast

Unlike most other libraries, Javacord is 100% multithreaded. Not only simple actions like sending messages are executed asynchronously, but also logging in, event listening, ...

It's simple

Javacord is easy to use, both for beginners as well as experienced Java developers. We don't force you to learn complex frameworks or introduce unnecessary abstraction or unintuitive concepts. Only familiar default Java classes like CompletableFutures or Optionals are used.

Rich Documentation

The best library is worth nothing, if you don't know how to use it. To help you getting started, there are plenty of tutorials in our wiki.

Awesome community

There's a large community of other bot developers in our Discord Server. You can ask questions there, chat with other developers and keep track about Javacord's development.

Here are some examples!

Logging in

This an easy starter template. It logs the bot in and adds a listener, that answers !ping commands with Pong!. It also prints the invite url for the bot.

public class MyFirstBot {

    public static void main(String[] args) {
        // Read the token from the first program parameter when invoking the bot
        String token = args[0];

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

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

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


Creating a text channel

The following example creates a new text channel in a server with some pre-set permissions for the @everyone role.

Server server = ...;
new ServerTextChannelBuilder(server)
        .setTopic("This channel was created by a bot!")
        .addPermissionOverwrite(server.getEveryoneRole(), new PermissionsBuilder()
                .setAllowed(PermissionType.READ_MESSAGES, PermissionType.SEND_MESSAGES, PermissionType.ADD_REACTIONS)
                .setDenied(PermissionType.ATTACH_FILE, PermissionType.READ_MESSAGE_HISTORY)

Deleting the last 100 messages in a channel

This code first fetches the last 100 messages in a given channel and then deletes them.