Add gateway Ready event
This commit is contained in:
parent
2dda6f767e
commit
ec2030794d
|
@ -134,6 +134,12 @@ pub struct Error {
|
|||
pub code: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
pub struct UnavailableGuild {
|
||||
id: String,
|
||||
unavailable: bool
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
pub struct UserObject {
|
||||
id: String,
|
||||
|
@ -802,6 +808,18 @@ pub struct GatewayResume {
|
|||
|
||||
impl WebSocketEvent for GatewayResume {}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Default)]
|
||||
pub struct GatewayReady {
|
||||
pub v: u8,
|
||||
pub user: UserObject,
|
||||
pub guilds: Vec<UnavailableGuild>,
|
||||
pub session_id: String,
|
||||
pub resume_gateway_url: String,
|
||||
pub shard: Option<(u64, u64)>,
|
||||
}
|
||||
|
||||
impl WebSocketEvent for GatewayReady {}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||
pub struct GatewayHello {
|
||||
pub op: i32,
|
||||
|
|
|
@ -64,6 +64,9 @@ impl<'a> Gateway<'a> {
|
|||
|
||||
// See https://discord.com/developers/docs/topics/gateway-events#receive-events
|
||||
match gateway_payload_t.as_str() {
|
||||
"READY" => {
|
||||
let data: GatewayReady = serde_json::from_str(gateway_payload.d.unwrap().as_str()).unwrap();
|
||||
}
|
||||
"APPLICATION_COMMAND_PERMISSIONS_UPDATE" => {}
|
||||
"AUTO_MODERATION_RULE_CREATE" => {}
|
||||
"AUTO_MODERATION_RULE_UPDATE" => {}
|
||||
|
|
Loading…
Reference in New Issue