From 259633bdb9d13e2f655e3c0779e330ddd902adaa Mon Sep 17 00:00:00 2001 From: Bastian Oppermann Date: Mon, 28 Mar 2016 11:16:30 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b9c74d0..f38fa61 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,96 @@ # sdcf4j -A simple Discord command framework for Java +A **s**imple **D**iscord **c**ommand **f**ramework **for** **J**ava, supporting Javacord, JDA and Discord4J + +#Maven +```xml + + sdcf4j-repo + http://repo.bastian-oppermann.de + +... + + + de.btobastian.sdcf4j + sdcf4j-core + 1.0.0 + + + + de.btobastian.sdcf4j + + sdcf4j-javacord + 1.0.0 + +``` + +## Support + +* [Javacord server](https://discord.gg/0qJ2jjyneLEgG7y3) +* [DiscordAPI #java_javacord channel](https://discord.gg/0SBTUU1wZTVXVKEo) + +You can find me on one of these servers/channels. Fell free to contact me if you need help. :) + +#Download +For those of you how don't use maven: [Jenkins](http://ci.ketrwu.de/job/sdcf4j/lastSuccessfulBuild/) + +Thanks to ketrwu (https://github.com/KennethWussmann). + +#Javadocs +The javadocs can be found here: [JavaDocs](http://ci.ketrwu.de/job/sdcf4j/de.btobastian.sdcf4j$sdcf4j-core/javadoc/) + +Thanks to ketrwu, too. + +#Examples + +Ping command: +```java +public class PingCommand implements CommandExecutor { + + @Command(aliases = {"!ping"}, description = "Pong!") + public String onCommand(String command, String[] args) { + return "Pong!"; + } + +} +``` + +Parameters are completely dynamic, so all of this examples would work: +```java +// no parameters (Javacord, JDA and Discord4J) +@Command(aliases = {"!ping"}, description = "Pong!") +public String onCommand() { + return "Pong!"; +} + +// DiscordAPI and Message as parameter (Javacord) +@Command(aliases = {"!ping"}, description = "Pong!") +public String onCommand(DiscordAPI api, Message message) { + return "Pong!"; +} + +// only Message as parameter without return type (Javacord and JDA) +@Command(aliases = {"!ping"}, description = "Pong!") +public void onCommand(Message message) { + message.reply("Pong!"); +} + +// no private messages and async (Javacord and JDA) +@Command(aliases = {"!channelInfo", "!ci"}, description = "Pong!", async = true, privateMessages = false) +public String onCommand(Channel channel) { + return "You are in channel #" + channel.getName() + " with id " + channel.getId(); +} +``` + +#Register a CommandExecutor + +```java +// Javacord +CommandHandler cmdHandler = new JavacordHandler(api); +// JDA +CommandHandler cmdHandler = new JDAHandler(jda); +// Discord4J +CommandHandler cmdHandler = new Discord4JHandler(client); + +// register the command +cmdHandler.registerCommand(new PingCommand()); +``` From 3de5621606c300bfca0855096a663e8a3460bb31 Mon Sep 17 00:00:00 2001 From: Bastian Oppermann Date: Mon, 28 Mar 2016 11:17:46 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f38fa61..157edaf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # sdcf4j -A **s**imple **D**iscord **c**ommand **f**ramework **for** **J**ava, supporting Javacord, JDA and Discord4J +A **s**imple **D**iscord **c**ommand **f**ramework **for** **J**ava, supporting [Javacord](https://github.com/BtoBastian/Javacord), [JDA](https://github.com/DV8FromTheWorld/JDA) and [Discord4J](https://github.com/austinv11/Discord4J) #Maven ```xml