Skip to content

Commit

Permalink
last few changes with doc gen
Browse files Browse the repository at this point in the history
  • Loading branch information
krisppurg committed Aug 23, 2023
1 parent 534d5c6 commit 99df368
Show file tree
Hide file tree
Showing 26 changed files with 15,264 additions and 16,604 deletions.
4 changes: 3 additions & 1 deletion dimscord.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
## @ify channels, users, roles, etc, this includes iconUrls too. There's also
## helper restapi procs, e.g. `guild.editRole(name=some "something")`, `channel.send("..")`.
## Which'd be useful for shortening code, you can use `discord.api` as an alternate.
## Additionally, there's also a `waitFor`/`waitForRaw` which is incredibly useful for waiting for events.
##
## - `constants` Say if you were to check what verification level is the guild
## you can use the constants like vlHigh, vlLow, vlVeryHigh, vlMedium,
## this file includes permission enums like permAddReactions, permViewAuditLogs,
## permCreateInstantInvite, etc. Intents are also included there.
##
## - `voice` Allows you to connect to the voice gateway,
## play audio in voice channel, etc.
## play audio in voice channel, etc. [Look at examples/voice.nim for reference](https://github.com/krisppurg/dimscord/blob/master/examples/voice.nim)
##
## For joining/leaving a voice channel, see `gateway`.
##
Expand Down Expand Up @@ -69,6 +70,7 @@
## - `-d:discordCompress` Compress gateway payloads, by using zippy.
## - `-d:discordv9` Discord API v9 is used for threads (as in discord's channel type).
## - `-d:dimscordVoice` Enables the voice module. Requires libsodium and libopus
## - `-d:discordEtf` Enables etf support for gateway, currently not the fastest as dimscord relies on json.

{.define: ssl.}

Expand Down
2 changes: 1 addition & 1 deletion dimscord/gateway.nim
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ when defined(discordEtf):
result = newStringOfCap(x.len shl 1)
toUgly(result, x)

proc `%%`*(v: openarray[(string, DataValue)]): Table[string, DataValue] =
proc `%%`(v: openarray[(string, DataValue)]): Table[string, DataValue] =
v.toTable

proc toTerm [T: auto](x: T): DataValue =
Expand Down
4 changes: 2 additions & 2 deletions dimscord/helpers.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Utilities and helper functions for every discord object.
## It mostly contains `helper` procedures.
## - You can use this for getting an avatar url and permission checking without
## - You can use this for getting avatars, icons, get timestamp from id, permission checking without
## the hassle for doing complicated bitwise work.
## - Furthermore, you can also use this to [waitFor] a certain event and [waitForRaw] for raw json handling before dimscord handles them.

import constants, objects, options
import strformat, strutils, times, asyncdispatch
Expand Down
3 changes: 1 addition & 2 deletions dimscord/voice.nim
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,7 @@ proc stopPlaying*(v: VoiceClient) =
v.data = ""

proc elapsed*(v: VoiceClient): float =
## Shows the elapsed time
## Note: this may be inaccurate.
## Shows the elapsed time in seconds.
(v.sent*20)/1000

proc sendAudioPacket*(v: VoiceClient, data: string) {.async.} =
Expand Down
183 changes: 62 additions & 121 deletions docs/dimscord.html

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/dimscord.idx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Reference dimscord.html#reference Reference
Modules required dimscord.html#modules-required Modules required
Definable options dimscord.html#definable-options Definable options
nimTitle dimscord dimscord.html module dimscord 0
heading Reference dimscord.html#reference Reference 0
heading Modules required dimscord.html#modules-required Modules required 0
heading Definable options dimscord.html#definable-options Definable options 0
4,320 changes: 2,046 additions & 2,274 deletions docs/dimscord/constants.html

Large diffs are not rendered by default.

1,188 changes: 604 additions & 584 deletions docs/dimscord/constants.idx

Large diffs are not rendered by default.

225 changes: 87 additions & 138 deletions docs/dimscord/dispatch.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/dimscord/dispatch.idx
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fullSet dimscord/dispatch.html#fullSet,typedesc[T] dispatch: fullSet[T](U: typedesc[T]): set[T]
handleEventDispatch dimscord/dispatch.html#handleEventDispatch,Shard,DispatchEvent,JsonNode dispatch: handleEventDispatch(s: Shard; event: DispatchEvent; data: JsonNode): owned(\n Future[void])
nimTitle dispatch dimscord/dispatch.html module dimscord/dispatch 0
nim fullSet dimscord/dispatch.html#fullSet,typedesc[T] proc fullSet[T](U: typedesc[T]): set[T] 53
nim handleEventDispatch dimscord/dispatch.html#handleEventDispatch,Shard,DispatchEvent,JsonNode proc handleEventDispatch(s: Shard; event: DispatchEvent; data: JsonNode): owned(\n Future[void]) 1002
495 changes: 212 additions & 283 deletions docs/dimscord/gateway.html

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions docs/dimscord/gateway.idx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
`%%` dimscord/gateway.html#%%,openArray[] gateway: `%%`(v: openArray[(string, DataValue)]): Table[string, DataValue]
updateStatus dimscord/gateway.html#updateStatus,Shard,seq[ActivityStatus],string gateway: updateStatus(s: Shard; activities: seq[ActivityStatus] = @[]; status = "online";\n afk = false): owned(Future[void])
updateStatus dimscord/gateway.html#updateStatus,Shard,string gateway: updateStatus(s: Shard; activity = none ActivityStatus; status = "online";\n afk = false): owned(Future[void])
resume dimscord/gateway.html#resume,Shard gateway: resume(s: Shard): owned(Future[void])
requestGuildMembers dimscord/gateway.html#requestGuildMembers,Shard,,string,seq[string] gateway: requestGuildMembers(s: Shard; guild_id: string or seq[string]; limit = none int;\n query = none string; nonce = ""; presences = false;\n user_ids: seq[string] = @[]): owned(Future[void])
getGuildMember dimscord/gateway.html#getGuildMember,Shard,string,string gateway: getGuildMember(s: Shard; guild_id, user_id: string; presence = false): Future[\n Member]
voiceStateUpdate dimscord/gateway.html#voiceStateUpdate,Shard,string gateway: voiceStateUpdate(s: Shard; guild_id: string; channel_id = none string;\n self_mute, self_deaf = false): owned(Future[void])
disconnect dimscord/gateway.html#disconnect,Shard gateway: disconnect(s: Shard; should_reconnect = true): owned(Future[void])
endSession dimscord/gateway.html#endSession,DiscordClient gateway: endSession(discord: DiscordClient): owned(Future[void])
startSession dimscord/gateway.html#startSession,DiscordClient,set[GatewayIntent],int,int,int,int,int gateway: startSession(discord: DiscordClient; autoreconnect = true; gateway_intents: set[\n GatewayIntent] = {giGuilds, giGuildMessages, giDirectMessages,\n giGuildVoiceStates, giMessageContent};\n large_message_threshold, large_threshold = 50;\n max_message_size = 5000000; gateway_version = 10;\n max_shards = none int; shard_id = 0;\n cache_users, cache_guilds, guild_subscriptions = true;\n cache_guild_channels, cache_dm_channels = true): owned(\n Future[void])
latency dimscord/gateway.html#latency,Shard gateway: latency(s: Shard): int
nimTitle gateway dimscord/gateway.html module dimscord/gateway 0
nim updateStatus dimscord/gateway.html#updateStatus,Shard,seq[ActivityStatus],string proc updateStatus(s: Shard; activities: seq[ActivityStatus] = @[]; status = "online";\n afk = false): owned(Future[void]) 249
nim updateStatus dimscord/gateway.html#updateStatus,Shard,string proc updateStatus(s: Shard; activity = none ActivityStatus; status = "online";\n afk = false): owned(Future[void]) 269
nim resume dimscord/gateway.html#resume,Shard proc resume(s: Shard): owned(Future[void]) 314
nim requestGuildMembers dimscord/gateway.html#requestGuildMembers,Shard,,string,seq[string] proc requestGuildMembers(s: Shard; guild_id: string or seq[string]; limit = none int;\n query = none string; nonce = ""; presences = false;\n user_ids: seq[string] = @[]): owned(Future[void]) 333
nim getGuildMember dimscord/gateway.html#getGuildMember,Shard,string,string proc getGuildMember(s: Shard; guild_id, user_id: string; presence = false): Future[\n Member] 362
nim voiceStateUpdate dimscord/gateway.html#voiceStateUpdate,Shard,string proc voiceStateUpdate(s: Shard; guild_id: string; channel_id = none string;\n self_mute, self_deaf = false): owned(Future[void]) 381
nim disconnect dimscord/gateway.html#disconnect,Shard proc disconnect(s: Shard; should_reconnect = true): owned(Future[void]) 498
nim endSession dimscord/gateway.html#endSession,DiscordClient proc endSession(discord: DiscordClient): owned(Future[void]) 681
nim startSession dimscord/gateway.html#startSession,DiscordClient,set[GatewayIntent],int,int,int,int,int proc startSession(discord: DiscordClient; autoreconnect = true; gateway_intents: set[\n GatewayIntent] = {giGuilds, giGuildMessages, giDirectMessages,\n giGuildVoiceStates, giMessageContent};\n large_message_threshold, large_threshold = 50;\n max_message_size = 5000000; gateway_version = 10;\n max_shards = none int; shard_id = 0;\n cache_users, cache_guilds, guild_subscriptions = true;\n cache_guild_channels, cache_dm_channels = true): owned(\n Future[void]) 728
nim latency dimscord/gateway.html#latency,Shard proc latency(s: Shard): int 828
nimgrp updatestatus dimscord/gateway.html#updateStatus-procs-all proc 247
Loading

0 comments on commit 99df368

Please sign in to comment.