Package net.discordservices.dservices4j

Installation

Please replace API_VERSION with the latest version you can find on the GitHub README.md.

Gradle (recommended)


 repositories{
     maven{ url = 'https://repo.codemc.io/repository/maven-public' }
 }

 dependencies{
     compile 'net.discordservices:dservices4j:API_VERSION'
 }
 

Maven


 <repositories>
     <repository>
         <id>jcenter</id>
         <name>jcenter-bintray</name>
         <url>https://repo.codemc.io/repository/maven-public</url>
     </repository>
 </repositories>

 <dependencies>
     <dependency>
         <groupId>net.discordservices</groupId>
         <artifactId>dservices4j</artifactId>
         <version>API_VERSION</version>
     </dependency>
 </dependencies>
 

Manual

We do not recommend using jar files directly and instead use one of the above dependency management systems.

If you still want to do it manually, or can't use one of the other option, head over to the GitHub releases page and download the jar files from there.

Note that you will not receive any support when using this method.

Usage

To use the Java Wrapper, you should first get an instance of the DServices4J class as all other classes and methods will be used through it.
Afterwards can you just use the corresponding Getter Methods to retrieve an instance of the classes you need.

Example


 // Get a DServices4J instance
 DServices4J dservices = new DServices4J.Builder()
     .setToken("api.token.here")
     .setId("botId")
     .build();
 
 // Get Commands instance
 Commands commands = dservices.getCommands();
 
 // Add a command to the list.
 // The CommandInfo class can be either CommandInfo(name, description, category) or
 // CommandInfo(name, null, category) for no description.
 commands.addCommand(new CommandInfo("vote", "Let's you vote for the bot", "info"));
 
 // Post commands
 commands.postCommands();
 
 
 // Get News instance
 News news = dservices.getNews();
 
 // Post news
 news.postNews("New Command", "A vote command has been added!");
 
 // Post an error/issue
 news.postNews("Discord issues", "Discord has currently issues!", true);
 
 
 // Get Stats instance
 Stats stats = dservices.getStats();
 
 // Post Server count
 stats.postStats(1000);
 
 // Post Server count with shard count
 stats.postStats(3000, 3);