Skip to main content

run_external_bot

Function run_external_bot 

Source
pub async fn run_external_bot<B, F>(
    factory: F,
    options: RunExternalOptions,
) -> Result<Vec<MatchResult>, Error>
where B: Bot, F: Fn() -> B + Send + Sync + 'static,
Expand description

Run a bot on the Chipzen external-API remote-play path.

Connects to the lobby, then plays every match the platform dispatches to this bot (a single challenge, or every round of a tournament) until the lobby closes, the bot is evicted, or max_matches matches complete.

factory produces one bot instance per match. Pass a closure that returns a fresh bot (|| MyBot::default()) for correct per-match state when matches may overlap; the same closure can capture-and-clone shared config. Each match runs in its own task on its own gateway socket.

Returns one MatchResult per match played this session.

ยงErrors

  • Error::Protocol if no token can be resolved, or neither url nor a bot_id is available to build the lobby URL.
  • Error::BotDecision if decide() panics under safe_mode = false.