Skip to content

Commit

Permalink
Fix lifetime error
Browse files Browse the repository at this point in the history
  • Loading branch information
AS1100K committed Nov 9, 2024
1 parent 2ef15e2 commit 96dfac1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,21 @@ fn setup_bot(mut commands: Commands, discord_bot_config: Res<DiscordBotConfig>)
client_builder = client_builder.activity(activity);
}

let discord_bot_config_clone = discord_bot_config.clone();

tokio_runtime().spawn(async move {
let mut client = client_builder
.await
.expect("Unable to build discord Client");

if discord_bot_config.shards == 0 {
if discord_bot_config_clone.shards == 0 {
client
.start()
.await
.expect("Unable to run the discord Client");
} else {
client
.start_shards(discord_bot_config.shards)
.start_shards(discord_bot_config_clone.shards)
.await
.expect("Unable to run the discord Client with multiple shards.")
}
Expand Down

0 comments on commit 96dfac1

Please sign in to comment.