Add `cacheGuildChannel`

This commit is contained in:
SeanOMik 2020-06-20 23:37:52 -05:00
parent 76b1797bee
commit dc681a62e4
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
1 changed files with 7 additions and 1 deletions

View File

@ -55,4 +55,10 @@ proc getUser*(cache: Cache, id: snowflake): User =
if (member.user.id == id): if (member.user.id == id):
return member.user return member.user
return newUser(sendRequest(endpoint("/users/" & $id), HttpGet, defaultHeaders())) return newUser(sendRequest(endpoint("/users/" & $id), HttpGet, defaultHeaders()))
proc cacheGuildChannel*(cache: var Cache, guildID: snowflake, channel: Channel) =
## Adds a channel in cache.guilds[guildID].channels.
## Only used for internal library, dont touch!
var guild = cache.getGuild(guildID)
guild.channels.add(channel)