glyde/testing/frames

The frames a scripted Discord sends, as the text a transport hands a shard. Fixtures only: nothing here runs anything or judges an adapter.

glyde/testing/adapter scripts its scenarios out of these, and a test with its own scripted socket can use them without pulling in the conformance suite.

import glyde/testing/frames

let script = [frames.hello(45_000), frames.ready(1, session, host)]

Values

pub fn ack() -> String

Op 11.

pub fn beat_request() -> String

Op 1: Discord asking for a heartbeat now rather than at the deadline.

pub fn dispatch(
  name: String,
  seq: Int,
  data: json.Json,
) -> String

Op 0. Any dispatch, with the payload you give it.

pub fn hello(interval_ms: Int) -> String

Op 10. heartbeat_interval is clamped to [1000, 600_000] by the core.

pub fn invalid_session(resumable: Bool) -> String

Op 9.

pub fn ready(
  seq: Int,
  session_id: String,
  resume_host: String,
) -> String

Op 0 with t: READY, carrying the three keys the protocol needs.

pub fn resumed(seq: Int) -> String

Op 0 with t: RESUMED.

pub fn server_reconnect() -> String

Op 7: reconnect and resume.

pub const token: String

The token every scripted bot identifies with. Not a real one, and it never reaches a socket.

Search Document