Orca
A bot framework that is easy to reason about, easy to debug, and easy to use.
|
Go to the documentation of this file.
8 #ifndef DISCORD_VOICE_CONNECTIONS_H
9 #define DISCORD_VOICE_CONNECTIONS_H
13 #include "cee-data-sizes.h"
65 const char audio_codec[],
66 const char video_codec[]);
99 struct websockets *
ws;
133 char server_ip[CEE_MAX_IP_ADDR_STR_LEN];
134 char digest[CEE_SHA1_STR_LEN];
135 char unique_key[128];
137 uintmax_t start_time;
161 enum discord_join_vc_status {
162 DISCORD_JOIN_VC_ERROR = 0,
163 DISCORD_JOIN_VC_JOINED = 1,
164 DISCORD_JOIN_VC_EXHAUST_CAPACITY,
165 DISCORD_JOIN_VC_ALREADY_JOINED
256 #endif // DISCORD_VOICE_CONNECTIONS_H
void discord_send_speaking(struct discord_voice *vc, enum discord_voice_speaking_flags flag, int delay)
Notify clients that you are speaking or have stopped speaking.
void discord_voice_shutdown(struct discord_voice *vc)
Gracefully exits a ongoing Discord Voice connection.
uint64_t message_channel_id
used to communicate the status of the bot state changes
Definition: discord-voice-connections.h:142
void discord_voice_set_on_idle(struct discord_voice *vc, voice_idle_cb *callback)
Set a callback that triggers at every event-loop iteration.
enum discord_join_vc_status discord_join_vc(struct discord *client, struct discord_message *msg, u64_snowflake_t guild_id, u64_snowflake_t channel_id, bool self_mute, bool self_deaf)
Send a Voice State Update to Discord.
voice_codec_cb on_codec
triggers when a codec is received
Definition: discord-voice-connections.h:73
void(* voice_client_disconnect_cb)(struct discord *client, struct discord_voice *vc, const struct discord_user *bot, const u64_snowflake_t user_id)
Voice Client Disconnect callback.
Definition: discord-voice-connections.h:49
Voice State Structure.
Definition: voice.h:17
char new_url[512]
the new url after a voice region change
Definition: discord-voice-connections.h:94
u64_unix_ms_t tstamp
Definition: discord-voice-connections.h:121
struct sized_buffer event_data
Definition: discord-voice-connections.h:116
void(* voice_speaking_cb)(struct discord *client, struct discord_voice *vc, const struct discord_user *bot, const u64_snowflake_t user_id, const int speaking, const int delay, const int ssrc)
Voice Speaking callback.
Definition: discord-voice-connections.h:34
u64_snowflake_t guild_id
the session guild id
Definition: discord-voice-connections.h:89
bool is_ready
can start sending/receiving additional events to discord
Definition: discord-voice-connections.h:109
void discord_voice_reconnect(struct discord_voice *vc, bool resume)
Gracefully reconnect a ongoing Discord Voice connection.
char session_id[128]
the session id
Definition: discord-voice-connections.h:97
int ping_ms
latency between client and websockets server, calculated by the interval between HEARTBEAT and HEARTB...
Definition: discord-voice-connections.h:124
bool shutdown
if true shutdown websockets connection as soon as possible
Definition: discord-voice-connections.h:128
bool is_resumable
will attempt to resume session if connection shutsdown
Definition: discord-voice-connections.h:106
bool enable
will attempt reconnecting if true
Definition: discord-voice-connections.h:102
void(* voice_idle_cb)(struct discord *client, struct discord_voice *vc, const struct discord_user *bot)
Idle callback.
Definition: discord-voice-connections.h:23
Definition: discord-voice-connections.h:69
voice_speaking_cb on_speaking
triggers when a user start speaking
Definition: discord-voice-connections.h:71
uint64_t u64_unix_ms_t
unix time in ms
Definition: discord.h:26
The Discord Client structure.
Definition: discord-internal.h:271
void _discord_on_voice_server_update(struct discord *client, u64_snowflake_t guild_id, char token[], char endpoint[])
Update the voice session with a new token and url.
uint64_t u64_snowflake_t
snowflake datatype
Definition: discord.h:32
u64_snowflake_t channel_id
Definition: discord-voice-connections.h:90
u64_snowflake_t bot_id
the bot user id
Definition: discord-voice-connections.h:98
struct discord_voice::@5 reconnect
handle reconnect logic
Discord Voice Connection handle, contain information about its active session.
Definition: discord-voice-connections.h:88
struct websockets * ws
Definition: discord-voice-connections.h:99
Message Structure.
Definition: channel.h:465
u64_unix_ms_t interval_ms
Definition: discord-voice-connections.h:120
char new_token[128]
the new session token after a voice region change
Definition: discord-voice-connections.h:93
int recv_interval
Interval to divide the received packets.
Definition: discord-voice-connections.h:150
unsigned char threshold
max amount of reconnects before giving up
Definition: discord-voice-connections.h:104
struct discord * p_client
pointer to client this struct is part of
Definition: discord-voice-connections.h:126
void discord_voice_connections_init(struct discord *client)
Initialize the fields of a Discord Voice Connections handle.
bool discord_voice_is_alive(struct discord_voice *vc)
Check if a Discord Voice connection is alive.
struct discord_voice::@6 payload
User Structure.
Definition: user.h:45
void _discord_on_voice_state_update(struct discord *client, struct discord_voice_state *vs)
Update the voice session with a new session_id.
bool is_redirect
redirect to a different voice server
Definition: discord-voice-connections.h:108
void(* voice_codec_cb)(struct discord *client, struct discord_voice *vc, const struct discord_user *bot, const char audio_codec[], const char video_codec[])
Voice Codec callback.
Definition: discord-voice-connections.h:61
voice_client_disconnect_cb on_client_disconnect
triggers when a user has disconnected from the voice channel
Definition: discord-voice-connections.h:72
unsigned char attempt
current reconnect attempt (resets to 0 when succesful)
Definition: discord-voice-connections.h:103
enum discord_voice_opcodes opcode
Definition: discord-voice-connections.h:115
char token[128]
the session token
Definition: discord-voice-connections.h:92
voice_idle_cb on_idle
triggers on every event loop iteration
Definition: discord-voice-connections.h:70