Created
August 5, 2024 01:37
-
-
Save Hacksore/8d2d09061ab5010d550dcac790e83f8d to your computer and use it in GitHub Desktop.
peak.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async fn get_current_channel_users(http: &Http, cache: &Cache) { | |
match http.get_guild(GuildId::new(1221093431364026438)).await { | |
Ok(guild) => { | |
if let Ok(channels) = guild.channels(&http).await { | |
if let Some(channel) = channels.get(&ChannelId::new(GUILD_ID)) { | |
if let Ok(members) = channel.members(&cache) { | |
if let Some(random_user) = members.choose(&mut OsRng) { | |
let mut random_user = random_user.clone(); | |
let builder = CreateMessage::new().content(format!( | |
"We are going to make <@{}>", | |
random_user.user.id.to_string() | |
)); | |
let _ = ChannelId::new(1221112008800469052) | |
.send_message(http, builder) | |
.await; | |
random_user.edit(http, EditMember::new().mute(true).deafen(true)).await; | |
} | |
} | |
} | |
} | |
} | |
Err(why) => { | |
println!("Error getting guild: {:?}", why); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment