-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http://pastebin.com/QJQigUHm and more
- Loading branch information
Showing
10 changed files
with
267 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# DiscordG | ||
Developed by Hlaaftana. | ||
|
||
To ask me any questions other than "what's the difference between Groovy and Java", go [here](https://discord.gg/0SBTUU1wZTUMeVC4). If you were going to ask the difference between Groovy and Java, [see for yourself](http://www.vogella.com/tutorials/Groovy/article.html). | ||
|
||
## What is this? | ||
This is a Groovy wrapper for the complicated connection stuff Discord needs you to do to connect to it and use its services. | ||
|
||
|
@@ -24,18 +26,22 @@ import ml.hlaaftana.discordg.APIBuilder | |
API api = APIBuilder.build("[email protected]", "example123") | ||
api.addListener("message create") { Event e -> | ||
if (e.data.message.content.startsWith("!ping")){ | ||
e.data.message.channel.sendMessage("Pong!") | ||
e.data.sendMessage("Pong!") | ||
} | ||
} | ||
``` | ||
|
||
**PLEASE** check out the examples [here](https://github.com/hlaaftana/DiscordG/tree/master/examples). I provide important explanations in some of them (PingPong and PingPongPlus especially) | ||
|
||
Oh, by the way, | ||
|
||
## Where can I find the documentation? | ||
[Here](http://hlaaftana.ml/discordg/docs/), for one. | ||
|
||
You can also check the source code which is populated with Groovydoc. | ||
|
||
If you need further help, contact me [here](https://discord.gg/0SBTUU1wZTUMeVC4). | ||
|
||
## Where do I install this? | ||
Check the releases for this repository. You'll find .jar files which you can add to your build path in your IDE or add to -cp in your javac and java commands. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ml.hlaaftana.karmafields | ||
|
||
import ml.hlaaftana.discordg.APIBuilder | ||
import ml.hlaaftana.discordg.objects.* | ||
import ml.hlaaftana.discordg.util.bot.CommandBot | ||
|
||
API api = APIBuilder.build() | ||
CommandBot bot = new CommandBot(api) | ||
|
||
bot.defaultPrefix = "!" | ||
|
||
bot.addCommand new CommandBot.Command("hello"){ | ||
def run(Event e){ | ||
e.data.sendMessage("Hello there, ${e.data.message.author.mention}!") | ||
} | ||
} | ||
|
||
bot.addCommand new CommandBot.ResponseCommand("Hello there, but sadly I can't access the event data using this method of respondng to commands. :'(", "hello") | ||
|
||
bot.addCommand new CommandBot.ClosureCommand({ Event e, Command c -> | ||
e.data.sendMessage("Hello there, ${e.data.message.author.mention}!") | ||
}, "hello") | ||
|
||
bot.initialize("[email protected]", "example") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.