Skip to content

Commit adcd92f

Browse files
committed
Apply FMT
1 parent c9e32f7 commit adcd92f

File tree

16 files changed

+436
-312
lines changed

16 files changed

+436
-312
lines changed

src/cli/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@ macro_rules! scan {
3131
}};
3232
}
3333

34-
3534
// This is still under WIP. It's very far from being the final wanted version
3635
// it works okay for now
3736
pub async fn live_cli(ctx: &Context) {
3837
let command = scan!(String);
3938
let command = command.split(" ").collect::<Vec<_>>();
40-
39+
4140
match command[0] {
4241
"status:" => {
4342
let status = match command[1] {
@@ -52,16 +51,16 @@ pub async fn live_cli(ctx: &Context) {
5251
};
5352
ctx.set_presence(None, status);
5453
}
55-
54+
5655
"activity:" => {
5756
let activity = command[1..].join(" ");
5857
ctx.set_activity(Some(ActivityData::playing(activity)));
5958
}
60-
59+
6160
_ => {
6261
warn!("Unknown command.");
6362
}
6463
}
65-
64+
6665
info!("Command executed.");
67-
}
66+
}

src/commands/about.rs

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
* as defined by the AGPLv3 license.
1717
*/
1818

19-
use serenity::builder::CreateEmbed;
2019
use crate::commands::{Context, Error};
20+
use serenity::builder::CreateEmbed;
2121

22-
const TEXT: &str =
23-
r#"*Button Clicker* bot is a simple bot about gaining a score by pressing a button.
22+
const TEXT: &str = r#"*Button Clicker* bot is a simple bot about gaining a score by pressing a button.
2423
There's not much to it currently but some features will come as a shop to exchange a "score" to a point multiplier, etc...
2524
Feel free to check up the dev's social if there's an issue with the bot!"#;
2625

@@ -31,22 +30,40 @@ pub async fn about(ctx: Context<'_>) -> Result<(), Error> {
3130
let embed = CreateEmbed::new()
3231
.title("__About__")
3332
.description(TEXT)
34-
.field("__Discord__", "alexou *(will not accept friend requests)*", true)
33+
.field(
34+
"__Discord__",
35+
"alexou *(will not accept friend requests)*",
36+
true,
37+
)
3538
.field("__Twitter__", "[@Alekuso_](https://x.com/Alekuso_)", true)
3639
.field("__Github__", "[Alekuso](https://github.com/Alekuso)", false)
37-
.field("__Bluesky__", "[alex.tanukii.dev](https://bsky.app/profile/alex.tanukii.dev)", true)
40+
.field(
41+
"__Bluesky__",
42+
"[alex.tanukii.dev](https://bsky.app/profile/alex.tanukii.dev)",
43+
true,
44+
)
3845
.field("__Website__", "[tanukii.dev](https://tanukii.dev)", true)
39-
.field("__Alex's community Server__", "[Alex's Den](https://discord.gg/HWQXZJGCAM)", false)
40-
.field("__Bot Invite__", "**[Invite me !](https://discord.com/oauth2/authorize?client_id=774018602549772289)**", false)
41-
.field("__Github Repository__", "[Github Repository](https://github.com/Alekuso/Button-Clicker-Bot)", false)
46+
.field(
47+
"__Alex's community Server__",
48+
"[Alex's Den](https://discord.gg/HWQXZJGCAM)",
49+
false,
50+
)
51+
.field(
52+
"__Bot Invite__",
53+
"**[Invite me !](https://discord.com/oauth2/authorize?client_id=774018602549772289)**",
54+
false,
55+
)
56+
.field(
57+
"__Github Repository__",
58+
"[Github Repository](https://github.com/Alekuso/Button-Clicker-Bot)",
59+
false,
60+
)
4261
.thumbnail(thumbnail)
4362
.color(0x5754d0);
4463

45-
46-
let builder = poise::reply::CreateReply::default()
47-
.embed(embed);
64+
let builder = poise::reply::CreateReply::default().embed(embed);
4865

4966
ctx.send(builder).await?;
5067

5168
Ok(())
52-
}
69+
}

src/commands/help.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* You should have received a copy of the GNU Affero General Public License
1313
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
1414
*
15-
* This software may be subject to the AGPLv3 license if it is used as a service over a network,
15+
* This software may be subject to the AGPLv3 license if it is used as a service over a network,
1616
* as defined by the AGPLv3 license.
1717
*/
1818

@@ -22,13 +22,11 @@ use crate::commands::{Context, Error};
2222
#[poise::command(slash_command)]
2323
pub async fn help(
2424
ctx: Context<'_>,
25-
#[description = "Show help about a specific command"]
26-
command: Option<String>
25+
#[description = "Show help about a specific command"] command: Option<String>,
2726
) -> Result<(), Error> {
28-
2927
let config = poise::builtins::HelpConfiguration::default();
3028

3129
poise::builtins::help(ctx, command.as_deref(), config).await?;
3230

3331
Ok(())
34-
}
32+
}

src/commands/info.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,24 @@
1212
* You should have received a copy of the GNU Affero General Public License
1313
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
1414
*
15-
* This software may be subject to the AGPLv3 license if it is used as a service over a network,
15+
* This software may be subject to the AGPLv3 license if it is used as a service over a network,
1616
* as defined by the AGPLv3 license.
1717
*/
1818

19+
use crate::commands::{Context, Error};
1920
use mongodb::bson::{doc, Document};
2021
use mongodb::Collection;
2122
use readable::byte::*;
2223
use readable::up::*;
2324
use serenity::all::CreateEmbedFooter;
2425
use serenity::builder::CreateEmbed;
2526
use sysinfo::System;
26-
use crate::commands::{Context, Error};
2727

2828
use crate::{MONGO_DB, UPTIME};
2929

3030
/// Get information about the bot
3131
#[poise::command(slash_command)]
32-
pub async fn info(
33-
ctx: Context<'_>,
34-
) -> Result<(), Error> {
32+
pub async fn info(ctx: Context<'_>) -> Result<(), Error> {
3533
let db = MONGO_DB.get().unwrap();
3634

3735
let db_stats = db.run_command(doc! {"dbStats": 1}).await?;
@@ -42,10 +40,16 @@ pub async fn info(
4240
let uptime = UptimeFull::from(UPTIME.get().unwrap());
4341

4442
let server_count = ctx.cache().guilds().len();
45-
let total_users = db.collection::<Collection<Document>>("users").count_documents(doc! {}).await?;
46-
let total_sessions = db.collection::<Collection<Document>>("session").count_documents(doc! {}).await?;
43+
let total_users = db
44+
.collection::<Collection<Document>>("users")
45+
.count_documents(doc! {})
46+
.await?;
47+
let total_sessions = db
48+
.collection::<Collection<Document>>("session")
49+
.count_documents(doc! {})
50+
.await?;
4751
let memory_usage = Byte::from(get_memory_usage());
48-
52+
4953
let thumbnail = ctx.cache().current_user().avatar_url().unwrap_or_default();
5054
let footer = CreateEmbedFooter::new("Made with ❤️ by Alex");
5155
let embed = CreateEmbed::new()
@@ -55,9 +59,7 @@ pub async fn info(
5559
.color(0x5754d0)
5660
.footer(footer);
5761

58-
59-
let builder = poise::reply::CreateReply::default()
60-
.embed(embed);
62+
let builder = poise::reply::CreateReply::default().embed(embed);
6163

6264
ctx.send(builder).await?;
6365

@@ -72,6 +74,6 @@ fn get_memory_usage() -> u64 {
7274
let pid = std::process::id() as usize;
7375

7476
let process = system.process(pid.into()).unwrap();
75-
77+
7678
process.memory()
77-
}
79+
}

0 commit comments

Comments
 (0)