Skip to content

Instantly share code, notes, and snippets.

@Miezhiko
Created June 2, 2020 09:21
Show Gist options
  • Save Miezhiko/c6864868454836a0d0e20132fe6d7382 to your computer and use it in GitHub Desktop.
Save Miezhiko/c6864868454836a0d0e20132fe6d7382 to your computer and use it in GitHub Desktop.
fn ready(&self, ctx : Context, ready : Ready) {
info!("Connected as {}", ready.user.name);
voice::rejoin_voice_channel(&ctx);
let conf = conf::parse_config();
let last_guild_u64 = conf.last_guild.parse::<u64>().unwrap_or(0);
if last_guild_u64 != 0 {
let guild_id = GuildId( last_guild_u64 );
if let Ok(channels) = guild_id.channels(&ctx) {
let main_channel = channels.iter().find(|&(c, _)|
if let Some(name) = c.name(&ctx)
{ name == "bot" } else { false });
if let Some((_, channel)) = main_channel {
let timer = timer::Timer::new();
let _guard = {
let ch_clone = channel.clone();
timer.schedule_repeating(chrono::Duration::minutes(1), move || {
let rndx = rand::thread_rng().gen_range(0, 2);
if rndx != 1 {
info!("TEST!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment