polyphony-chat / chorus

A Rust library for interacting with multiple Polyphony- and Spacebar-Compatible instances at once.
https://crates.io/crates/chorus
Mozilla Public License 2.0
16 stars 7 forks source link

More accurate "GatewayHello::default()" #534

Closed bitfl0wer closed 1 month ago

bitfl0wer commented 1 month ago

Replaces the derived std::default::Default with

impl std::default::Default for GatewayHello {
    fn default() -> Self {
        Self {
            // "HELLO" opcode is 10
            op: 10,
            d: Default::default(),
        }
    }
}

impl std::default::Default for HelloData {
    fn default() -> Self {
        Self {
            // Discord docs mention 45000 seconds - discord.sex mentions 41250. Defaulting to 45s
            heartbeat_interval: 45000,
        }
    }
}