-
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.
- Loading branch information
Showing
21 changed files
with
381 additions
and
339 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
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,21 +1,18 @@ | ||
import hlaaftana.discordg.objects.* | ||
import hlaaftana.discordg.* | ||
|
||
Client client = DiscordG.withToken("token") | ||
client = DiscordG.withToken args[0] | ||
|
||
client.listener(Events.CHANNEL){ | ||
client.listener('channel') { | ||
if (channel.text && !channel.private) | ||
channel.sendMessage("Hello there, new channel!") | ||
} | ||
|
||
client.listener(Events.CHANNEL_DELETE){ | ||
if (server) | ||
server.sendMessage("Looks like $channel.type channel \"$channel.name\" was deleted.") | ||
client.listener('channel deleted') { | ||
if (guild) guild.sendMessage("Looks like $channel.type channel \"$channel.name\" was deleted.") | ||
} | ||
|
||
client.listener(Events.CHANNEL_UPDATE){ | ||
client.listener('channel changed') { | ||
if (channel.text) | ||
channel.sendMessage("Seems this channel changed. I like it.") | ||
if (channel.voice) | ||
server.sendMessage("Seems $channel.mention changed. I like it.") | ||
else guild.sendMessage("Seems $channel.mention changed. I like it.") | ||
} |
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,16 +1,15 @@ | ||
import hlaaftana.discordg.objects.* | ||
import hlaaftana.discordg.* | ||
|
||
Client client = DiscordG.withToken("token") | ||
Client client = DiscordG.withToken args[0] | ||
|
||
client.listener(Events.MEMBER){ | ||
server.sendMessage("Welcome to the server, $member.mention!") | ||
client.listener('member') { | ||
guild.sendMessage("Welcome to the guild, $member.mention!") | ||
} | ||
|
||
client.listener(Events.MEMBER_LEFT){ | ||
server.sendMessage("Aww, $member.mention left the server.") | ||
client.listener('member left') { | ||
guild.sendMessage("Aww, $member.mention left the guild.") | ||
} | ||
|
||
client.listener(Events.MEMBER_UPDATE){ | ||
server.sendMessage("I see your roles changed, $member.mention.") | ||
client.listener('member changed') { | ||
guild.sendMessage("I see you changed, $member.mention.") | ||
} |
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,15 +1,11 @@ | ||
import hlaaftana.discordg.objects.* | ||
import hlaaftana.discordg.* | ||
|
||
|
||
Client client = DiscordG.withToken("token") | ||
Client client = DiscordG.withToken args[0] | ||
|
||
/* | ||
* Names like "message" and "sendMessage" directly correspond to values in the ".listener" method, | ||
* but need to be gathered from the first argument of the closure in the ".addListener" method. | ||
*/ | ||
client.listener(Events.MESSAGE){ | ||
if (message.content.startsWith("!ping")){ | ||
sendMessage("Pong!") | ||
} | ||
client.listener('message') { | ||
if (content.startsWith("!ping")) respond "Pong!" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import hlaaftana.discordg.objects.* | ||
import hlaaftana.discordg.* | ||
|
||
Client client = DiscordG.withToken("token") | ||
Client client = DiscordG.withToken args[0] | ||
|
||
client.listener(Events.SERVER){ | ||
server.sendMessage("Hello there, new server!") | ||
client.listener 'guild', { | ||
guild.sendMessage("Hello there, new guild!") | ||
} | ||
|
||
client.listener(Events.SERVER_DELETE){ | ||
println "It seems I left or was banned in/kicked out of $server.name." | ||
client.listener 'guild deleted', { | ||
println "It seems I left or was banned in/kicked out of $guild.name." | ||
} | ||
|
||
client.listener(Events.SERVER_UPDATE){ | ||
server.sendMessage("Seems this server updated.") | ||
client.listener 'guild changed', { | ||
guild.sendMessage("Seems this guild updated.") | ||
} |
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,19 +1,26 @@ | ||
import hlaaftana.discordg.util.bot.CommandBot | ||
import hlaaftana.discordg.util.bot.CommandEventData | ||
|
||
// triggers here mean the same thing as prefixes, buty ou can change it to suffixes | ||
CommandBot bot = new CommandBot(triggers: ["!", "\$"]) // notice how we don't log in yet | ||
CommandBot bot = new CommandBot(triggers: ["!", "\$"]) | ||
|
||
// the command's only alias is "hello", and can also be a list. | ||
// do note that after "hello" i can add a list or string as | ||
// a list of custom triggers / a trigger | ||
// the variables are the variables in the event data and | ||
// methods inside Command which take | ||
// a Message or the event data as arguments | ||
bot.command("hello"){ | ||
sendMessage("Hello there, $author.mention!") | ||
bot.command("hello") { | ||
respond "Hello there, $author.mention!" | ||
} | ||
|
||
// here we login with the api and register our listeners. | ||
// note that you can login before initializing and then call bot.initalize | ||
// without any arguments. | ||
bot.initialize("token") | ||
bot.formatter = { "| $it |" } | ||
|
||
bot.command(["say", "repeat", ~/echo+/]) { | ||
respond arguments | ||
} | ||
|
||
bot.command "mfw", category: "meme", { | ||
assert command.info.category == "meme" | ||
respond ">mfw $arguments" | ||
delete() | ||
} | ||
|
||
bot.command("whatsmyname") { | ||
respond username | ||
}.extraArgs.username = { CommandEventData it -> it.private ? it.member.nick : it.author.name } | ||
|
||
bot.initialize args[0] // token |
This file was deleted.
Oops, something went wrong.
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.