diff --git a/README.md b/README.md index 8cd89a7..c8607f8 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ i am about the list the pros and cons, but first some that might be one of both * Uses Groovy's JSON parsers which are very fast and/but directly return Java objects. -* Based on Maps instead of immutable objects. +* Caches use JSON objects instead of immutable objects. This also allows for raw Discord data to be +observed. So if you did `group.object.application_id`, you would get the application_id Discord gave. * No interfaces for Discord objects. diff --git a/examples/bot/CommandBotExample.groovy b/examples/bot/CommandBotExample.groovy index b79b5d0..83bc6b8 100644 --- a/examples/bot/CommandBotExample.groovy +++ b/examples/bot/CommandBotExample.groovy @@ -10,7 +10,7 @@ bot.command("hello") { bot.formatter = { "| $it |" } bot.command(["say", "repeat", ~/echo+/]) { - respond arguments + formatted arguments } bot.command "mfw", category: "meme", { diff --git a/src/main/groovy/hlaaftana/discordg/net/RateLimit.groovy b/src/main/groovy/hlaaftana/discordg/net/RateLimit.groovy index 1ed074d..5d86a1f 100644 --- a/src/main/groovy/hlaaftana/discordg/net/RateLimit.groovy +++ b/src/main/groovy/hlaaftana/discordg/net/RateLimit.groovy @@ -2,7 +2,7 @@ package hlaaftana.discordg.net import groovy.transform.CompileStatic import groovy.transform.InheritConstructors -import hlaaftana.discordg.DiscordObject; +import hlaaftana.discordg.DiscordObject @InheritConstructors @CompileStatic diff --git a/src/main/groovy/hlaaftana/discordg/objects/Channel.groovy b/src/main/groovy/hlaaftana/discordg/objects/Channel.groovy index 4fd29e8..62999e0 100644 --- a/src/main/groovy/hlaaftana/discordg/objects/Channel.groovy +++ b/src/main/groovy/hlaaftana/discordg/objects/Channel.groovy @@ -33,10 +33,12 @@ class Channel extends DiscordObject { boolean isGroup(){ type == 3 } boolean isInGuild(){ text || voice || category } boolean isCategory() { type == 4 } + String getCategoryId() { (String) object.parent_id } + Channel getCategory() { null == categoryId ? null : guild.channel(categoryId) } + boolean isNsfw() { (boolean) object.nsfw } String getTopic(){ (String) object.topic } Guild getGuild(){ dm || group ? null : client.guildCache.at(guildId) } String getGuildId(){ (String) object.guild_id } - Guild getParent(){ guild } List getUsers(){ (List) (inGuild ? members : (recipients + client.user)) }