Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Format using rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jan 27, 2022
1 parent 059526b commit a5ac96b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hard_tabs = true
28 changes: 8 additions & 20 deletions src/handler.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use tokio::time::{sleep, Duration};
use crate::settings::Settings;
use colored::Colorize;
use serde::Deserialize;
Expand All @@ -13,6 +12,7 @@ use serenity::{
},
prelude::*,
};
use tokio::time::{sleep, Duration};
pub struct Handler {
guild_id: u64,
users: Mutex<Users>,
Expand Down Expand Up @@ -42,7 +42,7 @@ impl Handler {
online: 0,
count: 0,
}),
sleep_time : settings.sleep_time,
sleep_time: settings.sleep_time,
use_widget: settings.use_widget,
include_only: settings.include_only.clone(),
}
Expand All @@ -65,7 +65,6 @@ impl Handler {
};
let presence_count = match self.use_widget {
true => {

if self.sleep_time > 0 {
sleep(Duration::from_millis(self.sleep_time)).await;
}
Expand Down Expand Up @@ -125,24 +124,10 @@ impl EventHandler for Handler {
let name = format!("{}#{}", user.name, user.discriminator);

if approximate_count > current_users.count {
println!(
"{}",
format!(
"[JOIN] {}",
name
)
.green()
);
println!("{}", format!("[JOIN] {}", name).green());
current_users.count += 1;
} else {
println!(
"{}",
format!(
"[LEFT] {}",
name
)
.green()
);
println!("{}", format!("[LEFT] {}", name).green());
current_users.count -= 1;
}
}
Expand Down Expand Up @@ -218,7 +203,10 @@ impl EventHandler for Handler {
}
// this is true if the user changes their status to online
else if let Some(user) = &presence.user {
println!("{}", format!("[ON] {}#{}", user.name, user.discriminator).green());
println!(
"{}",
format!("[ON] {}#{}", user.name, user.discriminator).green()
);
}

// fix offset
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use crate::settings::Settings;
use colored::control;
use colored::Colorize;
use handler::Handler;
use proctitle::set_title;
use serenity::{client::bridge::gateway::GatewayIntents, prelude::*};
use std::env;
use proctitle::set_title;

#[tokio::main]
async fn main() {
Expand Down

0 comments on commit a5ac96b

Please sign in to comment.