Skip to content
This repository was archived by the owner on Dec 30, 2017. It is now read-only.

Repository files navigation

April Fools!

Thanks for playing! Love, JDA and D4J devs.

discord.jar

The single best Discord API java wrapper

Download with maven

Features

  • Kicking and banning (API exclusive)
  • Profile settings/account settings (API exclusive)
  • Message building
  • Online statuses (This includes your own status! API exclusive)
  • Avatars + Roles
  • DMs
  • Group messaging
  • User talk (edited) event
  • User join/banned/kicked events
  • Invite joining
  • Much more...

TODO

  • Message history (nearly done)
  • Game status
  • VOIP (Java and C# Host) (currently experimental)

Events

  • AddedToServer (AddedToGuildEvent)
  • APILoadedEvent (You might get NPEs if you don't wait for this)
  • ChannelCreatedEvent (group/channel)
  • ChannelDeletedEvent (group/channel)
  • ChannelUpdatedEvent (group/channel)
  • UserBannedEvent
  • UserChatEvent
  • UserJoinedEvent
  • UserKickedEvent
  • UserTypingEvent
  • UserOnlineStatusChangedEvent
  • UserDeletedMessageEvent
  • MentionEvent (1.3)
  • WebhookCreatedEvent
  • WebhookDeletedEvent
  • WebhookUpdatedEvent

Creating a DiscordAPI instance

In order to create the DiscordAPI instance, you'll need to use the DiscordBuilder class.

Examples:

DiscordAPIapi = newDiscordBuilder("email", "pass").build().login();
DiscordAPIapi = newDiscordBuilder("email", "pass").build();
api.login();

Using the event manager

In order to listen for an event, create a class that implements EventListener, and register it by calling api.getEventManager().registerListener(new YourListener(api));. All events can be found in the discord.jar package as well as the Events section.

publicclassExampleListenerimplementsEventListener {
DiscordAPIapi;
publicExampleListener(DiscordAPIapi){
this.api = api;
}
publicvoiduserChat(UserChatEvente){
if (e.getMsg().getMessage().equals("#ping")){
e.getGroup().sendMessage(newMessageBuilder()
.addString("Yes, ")
.addUserTag(e.getGroupUser(), e.getGroup())
.addString("?")
.build());
}
System.out.println((e.getMsg().isEdited() ? "# " : "") + "[" + e.getGroup().getName() + "] " + e.getGroupUser() + " > " + e.getMsg().getMessage());
}
publicvoidtyping(UserTypingEvente){
System.out.println(e.getGroupUser() + " is typing in " + e.getGroup());
}
}
publicclassTest {
publicstaticvoidmain(String[] args) {
DiscordAPIapi = newDiscordAPI("email", "pass").login();
api.getEventManager().registerListener(newExampleListener(api)); //Register listener
}
}

Shut up and take my money!

repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile "com.github.discord-java:discord.jar:master-VERSION"
}

Dependencies

About

[APRIL FOOLS 2017] The single best Discord API java wrapper

Topics

Resources

Stars

53 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages