Skip to content

Commit

Permalink
Rebased to DV8FromTheWorld/development
Browse files Browse the repository at this point in the history
  • Loading branch information
Almighty-Alpaca committed Mar 25, 2016
2 parents 2733b76 + c08ee8d commit e919f19
Show file tree
Hide file tree
Showing 208 changed files with 19,363 additions and 1,336 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Expand Up @@ -2,6 +2,14 @@
config.json
tokens.json

# music files
*.mp3
*.aac
*.m4a
*.wav
*.flac
*.ogg

# gradle
/build/
/.gradle/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2015 Austin Keener & Michael Ritter
Copyright 2015-2016 Austin Keener & Michael Ritter

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
93 changes: 61 additions & 32 deletions README.md
@@ -1,15 +1,16 @@
# JDA (Java Discord API)
JDA strives to provide a clean and full wrapping of the Discord REST api and its Websocket-Events for Java.
JDA strives to provide a clean and full wrapping of the Discord REST api and its Websocket-Events for Java.<br>
Besides audio, this library is full featured, allowing every operation that the Discord Client can provide.

## Creating the JDA Object
Creating the JDA Object is done via the JDABuilder class.
After setting email and password either via Constructor, or via setters,
the JDA Object is then created by calling the `.build()` (non-blocking login) or the `.buildBlocking()` method.
the JDA Object is then created by calling the `.buildBlocking()` or the `.buildAsync()` (non-blocking login) method.
<p>
Examples:

```java
JDA jda = new JDABuilder("email", "password").build();
JDA jda = new JDABuilder("email", "password").buildBlocking();
```

```java
Expand All @@ -30,7 +31,7 @@ public class ReadyListener implements EventListener
{
public static void main(String[] args)
{
JDA jda = new JDABuilder(args[0], args[1]).addListener(new ReadyListener()).build();
JDA jda = new JDABuilder(args[0], args[1]).addListener(new ReadyListener()).buildBlocking();
}

@Override
Expand All @@ -47,7 +48,7 @@ public class MessageListener extends ListenerAdapter
{
public static void main(String[] args)
{
JDA jda = new JDABuilder(args[0], args[1]).build();
JDA jda = new JDABuilder(args[0], args[1]).buildBlocking();
jda.addListener(new MessageListener());
}

Expand All @@ -69,30 +70,29 @@ Current Promoted Version:

![JDA promoted verison](https://www.dropbox.com/s/4jddygn33340uf4/version.png?dl=1)

You can get the latest promoted build here:
[Promoted Build Downloads](http://home.dv8tion.net:8080/job/JDA/Promoted%20Build/)
You can get the latest promoted builds here:
[Promoted Downloads](https://github.com/DV8FromTheWorld/JDA/releases)<br>
(Contains information about Maven and Gradle distribution)


If you want the most up-to-date builds, you can get them here: [Beta Build Downloads](http://home.dv8tion.net:8080/job/JDA/)<br>
**Note:** It is quite possible that these are broken or bugged. Use with caution.

Version 1.1.0 (Build 57) is also available via maven central

Maven:
```
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>1.1.0_57</version>
</dependency>
```
Gradle:
```
compile 'net.dv8tion:JDA:1.1.0_57'
```
**Note:** It is quite possible that these are broken or bugged. Use with caution.<br>
The dev builds are also available for maven/gradle on JCenter through Bintray [JDA JCenter Bintray](https://bintray.com/dv8fromtheworld/maven/JDA/)

## Docs
Javadocs are available in both jar format and web format.<br>
The jar format is available on the [Promoted Downloads](https://github.com/DV8FromTheWorld/JDA/releases) page or on any of the
build pages of the [Beta Downloads](http://home.dv8tion.net:8080/job/JDA/).<br>
<br>
The web format allows for viewing of the [Latest Promoted Docs](http://home.dv8tion.net:8080/job/JDA/Promoted%20Build/javadoc/)
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](http://home.dv8tion.net:8080/job/JDA/) and click the javadoc button on the left side of the build page.<br>
A shortcut would be: http://home.dv8tion.net:8080/job/JDA/BUILD_NUMBER_GOES_HERE/javadoc/, you just need to replace the
"BUILD_NUMBER_GOES_HERE" with the build you want.<br>
Example: Build 90's javadoc url would be http://home.dv8tion.net:8080/job/JDA/90/javadoc/

## Getting Help
If you need help, or just want to talk with the JDA or other Discord Devs, you can join the [Unofficial Discord API](https://discord.gg/0SBTUU1wZTUS0HMl) Guild.
If you need help, or just want to talk with the JDA or other Discord Devs, you can join the [Unofficial Discord API](https://discord.gg/0SBTUU1wZTUydsWv) Guild.

Once you joined, you can find JDA-specific help in the #java_jda channel

Expand All @@ -103,33 +103,62 @@ and create your PR into that same branch. **We will be rejecting any PRs to mast
It is also highly recommended to get in touch with the Devs via the Discord API Guild (see section above).

## TODO
* Voice
* ~~Sending audio~~ (Completed)
* Receiving audio
* Ability to access a single combined stream and individual user audio streams.
* ~~Usage examples~~
* Extensive documentation
* ~~Private Messages~~
* ~~Sending Private Messages~~
* ~~Figure out a good Event system that handles both, private and guild messages~~
* ~~Implement the Handler-code types other than MESSAGE_CREATE~~
* ~~Invites~~
* ~~Changing Account details (username, email, avatar, password)~~
* ~~Changing the own Presence~~
* Modifying the server
* Permissions
* Implement Exceptions
* ~~Modifying the server~~
* ~~Permissions~~
* ~~Implement Exceptions~~
* ~~Revisit the Permission calculation~~
* Read-States (which Message was last read in which channel)
* Message-ACK
* Voice (planned last, gonna take some while)
* ~~Message-ACK~~

## Dependencies:
This project requires **Java 8**.<br>
All dependencies are managed automatically by Gradle.
* NV Websocket Client
* Version: **1.16**
* [Github](https://github.com/TakahikoKawasaki/nv-websocket-client)
* [Central Repository](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.neovisionaries%22%20AND%20a%3A%22nv-websocket-client%22)
* [JCenter Repository](https://bintray.com/bintray/jcenter/com.neovisionaries%3Anv-websocket-client/view)
* Unirest
* Version: **1.4.7**
* [Github](https://github.com/Mashape/unirest-java)
* [JCenter Repository](https://bintray.com/bintray/jcenter/com.mashape.unirest%3Aunirest-java/view)
* Apache Commons Lang3
* Version: **3.4**
* [Website](https://commons.apache.org/proper/commons-lang/)
* [Central Repository](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.commons%22%20AND%20a%3A%22commons-lang3%22)
* [JCenter Repository](https://bintray.com/bintray/jcenter/org.apache.commons%3Acommons-lang3/view)
* json.org
* Version: **20150729**
* [Github](https://github.com/douglascrockford/JSON-java)
* [Central Repository](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.json%22%20AND%20a%3A%22json%22)
* [JCenter Repository](https://bintray.com/bintray/jcenter/org.json%3Ajson/view)
* JNA
* Version: **4.2.1**
* [Github](https://github.com/java-native-access/jna)
* [JCenter Repository](https://bintray.com/bintray/jcenter/net.java.dev.jna%3Ajna/view)
* Tritonus-Share
* Version: **0.3.7-2**
* [Sourceforge](https://sourceforge.net/projects/tritonus/)
* [JCenter Repository](https://bintray.com/bintray/jcenter/com.googlecode.soundlibs%3Atritonus-share/view)
* Tritonus-DSP
* Version: **0.3.6**
* [Sourceforge](https://sourceforge.net/projects/tritonus/)
* [JCenter Repository](https://bintray.com/dv8fromtheworld/maven/Tritonus-DSP/view)
* MP3-SPI
* Version: **1.9.5-1**
* [Website](http://www.javazoom.net/mp3spi/mp3spi.html)
* [JCenter Repository](https://bintray.com/bintray/jcenter/com.googlecode.soundlibs%3Amp3spi/view)
* jFLAC
* Version: **1.3**
* [Sourceforge](https://sourceforge.net/projects/jflac/)
* [JCenter Repository](https://bintray.com/dv8fromtheworld/maven/jFLAC/view)
112 changes: 104 additions & 8 deletions build.gradle
@@ -1,32 +1,56 @@
import org.apache.tools.ant.filters.ReplaceTokens

plugins {
id "com.jfrog.bintray" version "1.6"
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'eclipse'

def versionObj = new Version(major: 1, minor: 1, revision: 0)
def versionObj = new Version(major: 1, minor: 3, revision: 0)
group = "net.dv8tion"
archivesBaseName = "JDA"
version = "${versionObj.toString()}"

sourceCompatibility = 1.8
targetCompatibility = 1.8

tasks.eclipse.dependsOn(cleanEclipse)

def filteredSourceDir = file("${buildDir}/filtered")

//This is to fix eclipse's stupidity when first setting up the project.
// It thinks that "filtered" should be a development source folder and cries when it doesn't exist (gradlew clean)
eclipse {
classpath {
file {
withXml {
def sb = it.asString()
sb.replace(0, sb.length(), sb.toString().replace("\n\t<classpathentry kind=\"src\" path=\"build/filtered\"/>", ""));
}
}
}
}


sourceSets {
// This source set will contain all sources that we filter
// This source set will contain all sources that we filter
filtered {
java {
srcDirs = [
filteredSourceDir,
"src/test/java",

"src/examples/java"
]
}
}
}



// copy the main sources and filter any '@buildVersion@' occurences.
task processVersion (type: Copy) {
from sourceSets.main.java
Expand Down Expand Up @@ -58,11 +82,20 @@ task sourcesJar(type: Jar) {

//create a single Jar with all dependencies
task fatJar(type: Jar) {

manifest {
attributes 'Implementation-Version': version

}
baseName = project.name + '-withDependencies'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
from { configurations.compile.collect {
dependency ->
if (dependency.isDirectory()) { //If it is a folder, just include the folder in its entirety
return dependency
} else { //If it isn't a folder, put it in a zipTree. if it is a zip or jar the contents will be extracted.
return zipTree(dependency)
}
}}
with jar
}

Expand All @@ -74,14 +107,27 @@ signing {
sign configurations.archives
}
repositories {
mavenCentral()
jcenter()
}

dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
compile group: 'org.json', name: 'json', version: '20150729'
//General Utility
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.json:json:20150729'

//Native Library Support
compile 'net.java.dev.jna:jna:4.2.1'

//Web Connection Support
compile 'com.neovisionaries:nv-websocket-client:1.16'
compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.7'
compile 'com.mashape.unirest:unirest-java:1.4.7'

//Audio Support
compile 'com.googlecode.soundlibs:tritonus-share:0.3.7-2' //Shared audio code
compile 'org.tritonus:tritonus-dsp:0.3.6' //Volume control
compile 'com.googlecode.soundlibs:mp3spi:1.9.5-1' //MP3 support
compile 'net.sourceforge.jaadec:jaad:0.8.5' //AAC supports
compile 'jflac:jflac:1.3' //FLAC support
}

class Version {
Expand All @@ -100,7 +146,7 @@ class Version {
}

String getBuild() {
System.getenv("BUILD_NUMBER") ? System.getenv("BUILD_NUMBER") : "TEST"
System.getenv("BUILD_NUMBER") ? System.getenv("BUILD_NUMBER") : "DEV"
}

String toString() {
Expand Down Expand Up @@ -156,14 +202,64 @@ uploadArchives {
email 'ritter.michael92@gmail.com'
}
}
}.withXml {
//If we use a repository that isn't just MavenCentral
if (project.getRepositories().size() > 1)
{
int i = 0
def reposNode = asNode().appendNode("repositories")
project.getRepositories().stream().forEach {
repo ->

//Ignore the MavenCentral repository. Don't need to add it.
if (!repo.getProperties().get("url").toString().equals("https://repo1.maven.org/maven2/"))
{
def repoNode = reposNode.appendNode("repository")
repoNode.appendNode("id", "JDA-repo-" + i)
repoNode.appendNode("name", "JDA Repo " + i)
repoNode.appendNode("url", repo.getProperties().get("url"));
i++
}
}
}
}
}
}
}

bintray {
user = bintrayUsername
key = bintrayApiKey
pkg {
repo = 'maven'
name = 'JDA'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/DV8FromTheWorld/JDA.git'
configurations = ['archives']
publish = true;
version {
name = project.version
released = new Date()
}
}
}

bintrayUpload {
onlyIf {
System.getenv("BUILD_NUMBER")
}
}

// tell the compileJava task to compile the filtered source
compileJava.source = sourceSets.filtered.java
compileJava.dependsOn processVersion

//Creates the w/ dependencies jar.
uploadArchives.dependsOn fatJar
bintrayUpload.dependsOn uploadArchives

//If we don't have the username and password for uploading, we probably also
// cant sign the archives, so skip these tasks.
signArchives.onlyIf { !ossrhUsername.isEmpty() && !ossrhPassword.isEmpty() }
uploadArchives.onlyIf {!ossrhUsername.isEmpty() && !ossrhPassword.isEmpty() }
bintrayUpload.onlyIf {!bintrayUsername.isEmpty() && !bintrayApiKey.isEmpty() }
11 changes: 7 additions & 4 deletions gradle.properties
@@ -1,6 +1,9 @@
signing.keyId=
signing.password=
signing.secretKeyRingFile=
signing.keyId=""
signing.password=""
signing.secretKeyRingFile=""

ossrhUsername=
ossrhPassword=
ossrhPassword=

bintrayUsername=
bintrayApiKey=
1 change: 0 additions & 1 deletion settings.gradle
@@ -1,2 +1 @@
rootProject.name = 'JDA'

0 comments on commit e919f19

Please sign in to comment.