Files
shadowbot/src/commands/botconfig_common.rs
T
Puechberty Arthur e1016e0af1 Refactor profile commands to improve status handling and embed responses
- Updated `handle_idle`, `handle_invisible`, `handle_online`, `handle_listen`, `handle_playto`, `handle_stream`, `handle_watch`, and `handle_remove_activity` functions to use a unified approach for setting bot status and sending embed messages.
- Removed dependency on `botconfig_common` and replaced it with direct database interactions for status management.
- Added new helper functions for logging and moderation channel management.
- Introduced permission handling improvements in `set` command with better error messages and user feedback.
- Created new utility functions for parsing user and role IDs, ensuring better command access control.
2026-04-10 06:42:46 +02:00

19 lines
657 B
Rust

pub fn parse_color(value: &str) -> Option<u32> {
let v = value.trim().to_lowercase();
match v.as_str() {
"red" | "rouge" => Some(0xED4245),
"green" | "vert" => Some(0x57F287),
"blue" | "bleu" => Some(0x5865F2),
"yellow" | "jaune" => Some(0xFEE75C),
"orange" => Some(0xFAA61A),
"purple" | "violet" => Some(0x9B59B6),
"pink" | "rose" => Some(0xEB459E),
"white" | "blanc" => Some(0xFFFFFF),
"black" | "noir" => Some(0x000000),
_ => {
let hex = v.trim_start_matches('#').trim_start_matches("0x");
u32::from_str_radix(hex, 16).ok()
}
}
}