aboutsummaryrefslogtreecommitdiff
path: root/src/constants.rs
blob: 785ee59e4a6a92088145db612e210fcce345228a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use ::prelude_internal::*;

/// The base URI for the API.
pub const API_BASE: &'static str = "https://discordapp.com/api/v6";
/// The gateway version used by the library. The gateway URI is retrieved via
/// the REST API.
pub const GATEWAY_VERSION: u8 = 6;
/// The [UserAgent] sent along with every request.
///
/// [UserAgent]: ../hyper/header/struct.UserAgent.html
pub const USER_AGENT: &'static str = concat!("DiscordBot (https://github.com/zeyla/serenity, ", env!("CARGO_PKG_VERSION"), ")");

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum OpCode {
    Event,
    Heartbeat,
    Identify,
    StatusUpdate,
    VoiceStateUpdate,
    VoiceServerPing,
    Resume,
    Reconnect,
    GetGuildMembers,
    InvalidSession,
    Hello,
    HeartbeatAck,
    SyncGuild,
    SyncCall,
}

map_nums! { OpCode;
    Event 0,
    Heartbeat 1,
    Identify 2,
    StatusUpdate 3,
    VoiceStateUpdate 4,
    VoiceServerPing 5,
    Resume 6,
    Reconnect 7,
    GetGuildMembers 8,
    InvalidSession 9,
    Hello 10,
    HeartbeatAck 11,
    SyncGuild 12,
    SyncCall 13,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VoiceOpCode {
    Identify,
    SelectProtocol,
    Hello,
    Heartbeat,
    SessionDescription,
    Speaking,
}

map_nums! { VoiceOpCode;
    Identify 0,
    SelectProtocol 1,
    Hello 2,
    Heartbeat 3,
    SessionDescription 4,
    Speaking 5,
}