Jda java discord api

JDA (Java Discord API)¶

JDA strives to provide a clean and full wrapping of the Discord REST API and its Websocket-Events for Java.

If you have any suggestions/questions/feedback for this wiki, please visit the #wiki-dev channel in the JDA Discord Server

public class ReadyListener implements EventListener  public static void main(String[] args) throws InterruptedException  // Note: It is important to register your ReadyListener before building JDA jda = JDABuilder.createDefault("token") .addEventListeners(new ReadyListener()) .build(); // optionally block until JDA is ready jda.awaitReady(); > @Override public void onEvent(GenericEvent event)  if (event instanceof ReadyEvent) System.out.println("API is ready!"); > > 
public class MessageListener extends ListenerAdapter  public static void main(String[] args)  JDA jda = JDABuilder.createDefault("token") .enableIntents(GatewayIntent.MESSAGE_CONTENT) // enables explicit access to message.getContentDisplay() .build(); //You can also add event listeners to the already built JDA instance // Note that some events may not be received if the listener is added after calling build() // This includes events such as the ReadyEvent jda.addEventListener(new MessageListener()); > @Override public void onMessageReceived(MessageReceivedEvent event)  if (event.isFromType(ChannelType.PRIVATE))  System.out.printf("[PM] %s: %s\n", event.getAuthor().getName(), event.getMessage().getContentDisplay()); > else  System.out.printf("[%s][%s] %s: %s\n", event.getGuild().getName(), event.getTextChannel().getName(), event.getMember().getEffectiveName(), event.getMessage().getContentDisplay()); > > > 

More Examples: We provide a small set of Examples in the Example Directory.

Download¶

You can get the latest released builds here: Promoted Downloads

If you want the most up-to-date builds, you can get them here: Latest Build Downloads

Docs¶

Javadocs are available in both jar format and web format.
The jar format is available on the Promoted Downloads page or on any of the build pages of the legacy v4 Downloads or v5 Downloads.

The web format allows for viewing of the Latest Docs or legacy Docs and also viewing of each individual build’s javadoc. To view the javadoc for a specific build, you will need to go to that build’s page on the build server and download the javadoc jar for the specific build.
A shortcut would be: https://ci.dv8tion.net/job/JDA5/BUILD_NUMBER_GOES_HERE , you just need to replace the «BUILD_NUMBER_GOES_HERE» with the build you want.
Once you have the jar extract the files with the zip tool of your preference (winrar or 7zip, etc.) and open the index.html file with your internet browser.

Getting Help¶

If you need help, or just want to talk with the JDA or other Devs, you can join the Official JDA Discord Guild.

Alternatively you can also join the Unofficial Discord API Guild. Once you joined, you can find JDA-specific help in the #java_jda channel. The JDA specific server will often have faster responses than the #java_jda channel in the Discord API server.

For guides and setup help you can also take a look at this wiki.
Especially interesting are the Getting Started Pages.

Contributing to JDA¶

If you want to contribute to JDA, make sure to base your branch off of our master branch (or a feature-branch) and create your PR into that same branch. We will be rejecting any PRs between branches or into release branches!

It is also highly recommended to get in touch with the Devs before opening Pull Requests (either through an issue or the Discord servers mentioned above).
It is very possible that your change might already be in development or you missed something.

More information can be found at the wiki page Contributing

Dependencies¶

This project requires Java 8.
For other dependencies, see README

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Home

Clone this wiki locally

JDA strives to provide a clean and full wrapping of the Discord REST api and its Websocket-Events for Java.

Note: If you have any suggestions/questions/feedback for this wiki please contact Minn#6688 or DV8FromTheWorld#6297 via Discord

public class ReadyListener implements EventListener < public static void main(String[] args) throws LoginException < JDA jda = JDABuilder.createDefault(args[0]) .addEventListeners(new ReadyListener()).build(); > @Override public void onEvent(GenericEvent event) < if(event instanceof ReadyEvent) System.out.println("API is ready!"); > >
public class MessageListener extends ListenerAdapter < public static void main(String[] args) throws LoginException < JDA jda = JDABuilder.createDefault(args[0]).build(); jda.addEventListeners(new MessageListener()); > @Override public void onMessageReceived(MessageReceivedEvent event) < if (event.isFromType(ChannelType.TEXT)) < System.out.printf("[%s][%s] %#s: %s%n", event.getGuild().getName(), event.getChannel().getName(), event.getAuthor(), event.getMessage().getContentDisplay()); > else < System.out.printf("[PM] %#s: %s%n", event.getAuthor(), event.getMessage().getContentDisplay()); > > >

We provide a small set of Examples in the Example Directory.

You can get the latest released builds here: Promoted Downloads

If you want the most up-to-date builds, you can get them here: Latest Build Downloads

Javadocs are available in both jar format and web format.
The jar format is available on the Promoted Downloads page or on any of the build pages of the Downloads.

The web format allows for viewing of the Latest Docs and also viewing of each individual build’s javadoc. To view the javadoc for a specific build, you will need to go to that build’s page on the build server and download the javadoc jar for the specific build.
A shortcut would be: https://ci.dv8tion.net/job/JDA/BUILD_NUMBER_GOES_HERE, you just need to replace the «BUILD_NUMBER_GOES_HERE» with the build you want.
Once you have the jar extract the files with the zip tool of your preference (winrar or 7zip, etc.) and open the index.html file with your internet browser.

If you need help, or just want to talk with the JDA or other Devs, you can join the Official JDA Discord Guild.

Alternatively you can also join the Unofficial Discord API Guild. Once you joined, you can find JDA-specific help in the #java_jda channel.

For guides and setup help you can also take a look at the wiki
Especially interesting are the Getting Started and Setup Pages.

If you want to contribute to JDA, make sure to base your branch off of our development branch (or a feature-branch) and create your PR into that same branch. We will be rejecting any PRs between branches or into release branches!

It is also highly recommended to get in touch with the Devs before opening Pull Requests (either through an issue or the Discord servers mentioned above).
It is very possible that your change might already be in development or you missed something.

More information can be found at the wiki page Contributing

This project requires Java 8.
For other dependencies, see README

Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß

Источник

Читайте также:  Python 3 basehttprequesthandler example
Оцените статью