Skip to content

Commit

Permalink
fix: randomize breakout rooms, lol
Browse files Browse the repository at this point in the history
  • Loading branch information
Fyko committed Aug 23, 2023
1 parent c4d0c16 commit 581d31b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions chuckle-interactions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ zephyrus = { workspace = true }

# lockfile deps
tokio = { workspace = true, optional = true }
rand = "0.8.5"

[features]
default = ["lockfile"]
Expand Down
4 changes: 3 additions & 1 deletion chuckle-interactions/src/commands/breakout_rooms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use chuckle_util::{
db::get_settings,
ChuckleState,
};
use rand::seq::SliceRandom;
use twilight_model::{channel::Channel, id::Id};
use zephyrus::{prelude::*, twilight_exports::ChannelMarker};

Expand All @@ -27,7 +28,7 @@ pub async fn create(
return text_response(ctx, "No breakout rooms category set.".to_string(), true).await;
}

let voice_states = ctx
let mut voice_states = ctx
.data
.cache
.voice_channel_states(channel)
Expand All @@ -45,6 +46,7 @@ pub async fn create(
)
.await;
}
voice_states.shuffle(&mut rand::thread_rng());

let rooms = chunkify(voice_states, size.into(), remainder_strategy).chunks;

Expand Down

0 comments on commit 581d31b

Please sign in to comment.