glyde/status
What the runtime under glyde.run reports that is not a Discord event, and
the words for it. glyde.on_status hands you a Status; describe is the
whole line the default prints, and the smaller functions are its pieces
for a handler that formats the rest itself.
The values a status carries have their words where they live:
gateway.describe_halt, gateway.describe_why, gateway.describe,
transport.describe, error.describe. This module owns the one nobody
else does, the limiter’s notices.
Types
Everything the runtime does that is not a Discord event. Every variant
carries the value, never a rendering: describe is the only way back.
pub type Status {
Connecting(host: String)
Reconnecting(in_ms: Int, resuming: Bool, why: gateway.Why)
Halted(reason: gateway.Halt)
Sent(op: frame.SendOp)
Undecodable(name: String, errors: List(decode.DecodeError))
Note(gateway.Notice)
Paced(limiter.Notice)
}
Constructors
-
Connecting(host: String) -
Reconnecting(in_ms: Int, resuming: Bool, why: gateway.Why)The connection is gone and a redial is armed.
whyis what ended it, so a host printing this says more than “the bot is flapping”. -
Halted(reason: gateway.Halt) -
Sent(op: frame.SendOp)A frame went out, by opcode. Never the body: IDENTIFY carries the token.
-
Undecodable(name: String, errors: List(decode.DecodeError))A dispatch glyde models whose
dno longer fits its decoder: a glyde bug or a Discord schema change. The listeners saw it asevent.Raw. -
Note(gateway.Notice)A diagnostic from the core: a zombie connection, a dropped command, a frame that would not decode.
-
Paced(limiter.Notice)A diagnostic from the rate limiter: a bucket learned, a global freeze, the invalid-request budget running low.
Values
pub fn describe(status: Status) -> String
One line per status, for a host that just wants to print them.
pub fn describe_pacing(notice: limiter.Notice) -> String
The limiter is stdlib only and has no words of its own, so they live here.