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
use super::update_presence::UpdatePresencePayload;
use crate::gateway::{intents::Intents, opcode::OpCode};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Identify {
pub d: IdentifyInfo,
pub op: OpCode,
}
impl Identify {
pub const fn new(info: IdentifyInfo) -> Self {
Self {
d: info,
op: OpCode::Identify,
}
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct IdentifyInfo {
pub compress: bool,
pub intents: Intents,
pub large_threshold: u64,
pub presence: Option<UpdatePresencePayload>,
pub properties: IdentifyProperties,
pub shard: Option<[u64; 2]>,
pub token: String,
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct IdentifyProperties {
pub browser: String,
pub device: String,
pub os: String,
}
impl IdentifyProperties {
pub fn new(
browser: impl Into<String>,
device: impl Into<String>,
os: impl Into<String>,
) -> Self {
Self {
browser: browser.into(),
device: device.into(),
os: os.into(),
}
}
}