From 0fecace65ba38af1c67ac6f29051220cc6184661 Mon Sep 17 00:00:00 2001 From: HexPandaa <47880094+HexPandaa@users.noreply.github.com> Date: Tue, 7 Mar 2023 07:10:50 +0100 Subject: [PATCH] Fix indentation for poise init example (#687) --- cargo-shuttle/src/init.rs | 78 +++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/cargo-shuttle/src/init.rs b/cargo-shuttle/src/init.rs index b36c1c52c..0ebf76822 100644 --- a/cargo-shuttle/src/init.rs +++ b/cargo-shuttle/src/init.rs @@ -504,47 +504,47 @@ impl ShuttleInit for ShuttleInitPoise { fn get_boilerplate_code_for_framework(&self) -> &'static str { indoc! {r#" use anyhow::Context as _; - use poise::serenity_prelude as serenity; - use shuttle_secrets::SecretStore; - use shuttle_service::ShuttlePoise; - - struct Data {} // User data, which is stored and accessible in all command invocations - type Error = Box; - type Context<'a> = poise::Context<'a, Data, Error>; - - /// Responds with "world!" - #[poise::command(slash_command)] - async fn hello(ctx: Context<'_>) -> Result<(), Error> { - ctx.say("world!").await?; - Ok(()) - } - - #[shuttle_service::main] - async fn poise(#[shuttle_secrets::Secrets] secret_store: SecretStore) -> ShuttlePoise { - // Get the discord token set in `Secrets.toml` - let discord_token = secret_store - .get("DISCORD_TOKEN") - .context("'DISCORD_TOKEN' was not found")?; - - let framework = poise::Framework::builder() - .options(poise::FrameworkOptions { - commands: vec![hello()], - ..Default::default() + use poise::serenity_prelude as serenity; + use shuttle_secrets::SecretStore; + use shuttle_service::ShuttlePoise; + + struct Data {} // User data, which is stored and accessible in all command invocations + type Error = Box; + type Context<'a> = poise::Context<'a, Data, Error>; + + /// Responds with "world!" + #[poise::command(slash_command)] + async fn hello(ctx: Context<'_>) -> Result<(), Error> { + ctx.say("world!").await?; + Ok(()) + } + + #[shuttle_service::main] + async fn poise(#[shuttle_secrets::Secrets] secret_store: SecretStore) -> ShuttlePoise { + // Get the discord token set in `Secrets.toml` + let discord_token = secret_store + .get("DISCORD_TOKEN") + .context("'DISCORD_TOKEN' was not found")?; + + let framework = poise::Framework::builder() + .options(poise::FrameworkOptions { + commands: vec![hello()], + ..Default::default() + }) + .token(discord_token) + .intents(serenity::GatewayIntents::non_privileged()) + .setup(|ctx, _ready, framework| { + Box::pin(async move { + poise::builtins::register_globally(ctx, &framework.options().commands).await?; + Ok(Data {}) }) - .token(discord_token) - .intents(serenity::GatewayIntents::non_privileged()) - .setup(|ctx, _ready, framework| { - Box::pin(async move { - poise::builtins::register_globally(ctx, &framework.options().commands).await?; - Ok(Data {}) - }) - }) - .build() - .await - .map_err(shuttle_service::error::CustomError::new)?; + }) + .build() + .await + .map_err(shuttle_service::error::CustomError::new)?; - Ok(framework) - }"#} + Ok(framework) + }"#} } }