Skip to content

Commit

Permalink
GuildChannel.guild_id assignments.
Browse files Browse the repository at this point in the history
definitely not uni related by the term 'assignments' haha
  • Loading branch information
krisppurg committed Aug 1, 2024
1 parent c2ab3a2 commit 6d4b064
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dimscord/dispatch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ proc webhooksUpdate(s: Shard, data: JsonNode) {.async.} =
)
chan = s.cache.guildChannels.getOrDefault(
data["channel_id"].str,
GuildChannel(id: data["channel_id"].str)
GuildChannel(id: data["channel_id"].str, guild_id: guild.id)
)

s.checkAndCall(WebhooksUpdate, guild, chan)
Expand Down
5 changes: 4 additions & 1 deletion dimscord/restapi/channel.nim
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ proc createGuildChannel*(api: RestApi, guild_id, name: string; kind = 0;
$payload,
audit_reason = reason
)).newGuildChannel
result.guild_id = guild_id

proc deleteChannel*(api: RestApi, channel_id: string; reason = "") {.async.} =
## Deletes or closes a channel.
Expand Down Expand Up @@ -222,7 +223,9 @@ proc getGuildChannels*(api: RestApi,
result = (await api.request(
"GET",
endpointGuildChannels(guild_id)
)).elems.map(newGuildChannel)
)).elems.map(proc (x: JsonNode): GuildChannel =
x["guild_id"] = %*guild_id
x.newGuildChannel)

proc editGuildChannelPositions*(api: RestApi, guild_id, channel_id: string;
position = none int; parent_id = none string; lock_permissions = false;
Expand Down

0 comments on commit 6d4b064

Please sign in to comment.