Function __shuttle_main

Source
pub(crate) async fn __shuttle_main(secret_store: SecretStore) -> ShuttleSerenity
Expand description

⚙️ Function: Initializes and starts the Discord bot using the Shuttle runtime and Poise framework.

This function is the entry point for the Discord bot. It retrieves secrets (like the Discord token and Riot API key) from the Shuttle runtime, sets up the bot’s framework with its registered commands, and then starts the bot client with the required intents.

§Parameters:

  • secret_store: The Shuttle runtime secret store, which holds sensitive information such as the Discord token and Riot API key.

§Returns:

  • ShuttleSerenity: An instance of the Serenity client wrapped in a result. It starts the bot client once all setup is complete.

§⚠️ Notes:

  • The bot framework is built using the Poise framework, which is designed for building Discord bots easily.
  • The lolstats command is registered globally, meaning it will be available in all servers the bot is in.
  • The function uses non-privileged gateway intents, meaning it doesn’t request sensitive Discord information such as message content or member lists.

§Example:

This function is called automatically when the bot is deployed and run in the Shuttle environment.

#[shuttle_runtime::main]
async fn main(secret_store: SecretStore) -> ShuttleSerenity {
    // Bot setup and startup code
}

The bot will start and listen to commands like lolstats once it is running.