Skip to main content

Guest

Trait Guest 

Source
pub trait Guest {
    // Required methods
    fn init(config: Vec<(String, String)>) -> Registration;
    fn on_config_change(config: Vec<(String, String)>);
    fn on_event(event: Event);
    fn on_interaction(interaction: Interaction);
    fn on_autocomplete(interaction: Interaction) -> Vec<Choice> ⓘ;
    fn on_timer(id: u64, tag: String);
    fn on_voice_event(event: VoiceEvent);
}

Required Methods§

Source

fn init(config: Vec<(String, String)>) -> Registration

Called once per instance start with the bot’s configuration: the keys its manifest declares in [config], each with the owner’s value or else the declared default (keys with neither are left out). Secret values are passed like any other.

Source

fn on_config_change(config: Vec<(String, String)>)

The owner changed the configuration while the bot runs: every value again, as for init. The instance is not restarted and its commands stay registered.

Source

fn on_event(event: Event)

A subscribed event (§9.2).

Source

fn on_interaction(interaction: Interaction)

An application command, component click or modal submit.

Source

fn on_autocomplete(interaction: Interaction) -> Vec<Choice> ⓘ

Autocomplete: return up to 25 choices for the focused option.

Source

fn on_timer(id: u64, tag: String)

A timer fired.

Source

fn on_voice_event(event: VoiceEvent)

Something happened in the bot’s voice stay or player.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§