module Discord

Defined in:

discordcr/mappings/converters.cr
discordcr/mappings/channel.cr
discordcr/mappings/user.cr
discordcr/mappings/voice.cr
discordcr/mappings/guild.cr
discordcr/mappings/gateway.cr
discordcr/mappings/invite.cr
discordcr/mappings/oauth2.cr
discordcr/mappings/permissions.cr
discordcr/mappings/rest.cr
discordcr/mappings/vws.cr
discordcr/mappings/webhook.cr
discordcr/cache.cr
discordcr/version.cr
discordcr/errors.cr
discordcr/rest.cr
discordcr/client.cr
discordcr/dca.cr
discordcr/snowflake.cr
discordcr/sodium.cr
discordcr/websocket.cr
discordcr/voice.cr
discordcr.cr

Constant Summary

DISCORD_EPOCH = 1420070400000_u64
VERSION = "0.4.0"

Class Method Summary

Class Method Detail

def self.every(time_span : Time::Span, &block) #

Runs the given block every time_span. This method takes into account the execution time for the block to keep the intervals accurate.

Note that if the block takes longer to execute than the given time_span, there will be no delay: the next iteration follows immediately, with no attempt to get in sync.


[View source]
def self.timed_run(total_time : Time::Span, &block) #

Utility function that runs the given block and measures the time it takes, then sleeps the given time minus that time. This is useful for voice code because (in most cases) voice data should be sent to Discord at a rate of one frame every 20 ms, and if the processing and sending takes a certain amount of time, then noticeable choppiness can be heard.


[View source]