Extract trait

This commit is contained in:
jude
2024-02-17 20:24:30 +00:00
parent 4823754955
commit c1305cfb36
14 changed files with 336 additions and 176 deletions

View File

@ -37,7 +37,7 @@ use crate::{
commands::{
allowed_dm, clock::clock, clock_context_menu::clock_context_menu, command_macro,
dashboard::dashboard, delete, donate::donate, help::help, info::info, look, multiline,
nudge, offset, pause, remind, settings, timer, timezone::timezone, todo, webhook::webhook,
nudge, offset, pause, remind, settings, timer, timezone, todo, webhook,
},
consts::THEME_COLOR,
event_handlers::listener,
@ -109,7 +109,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
clock(),
clock_context_menu(),
dashboard(),
timezone(),
timezone::command(),
poise::Command {
subcommands: vec![
allowed_dm::set_allowed_dm::set_allowed_dm(),
@ -127,7 +127,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
}],
..settings::settings()
},
webhook(),
webhook::command(),
poise::Command {
subcommands: vec![
command_macro::delete_macro::delete_macro(),
@ -138,9 +138,9 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
],
..command_macro::command_macro()
},
pause::pause(),
offset::offset(),
nudge::nudge(),
pause::command(),
offset::command(),
nudge::command(),
look::look(),
delete::delete(),
poise::Command {
@ -152,7 +152,7 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
..timer::timer()
},
multiline::multiline(),
remind::remind(),
remind::command(),
poise::Command {
subcommands: vec![
poise::Command {
@ -197,12 +197,14 @@ async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
sqlx::migrate!().run(&database).await?;
let popular_timezones = sqlx::query!(
"SELECT IFNULL(timezone, 'UTC') AS timezone
"
SELECT IFNULL(timezone, 'UTC') AS timezone
FROM users
WHERE timezone IS NOT NULL
GROUP BY timezone
ORDER BY COUNT(timezone) DESC
LIMIT 21"
LIMIT 21
"
)
.fetch_all(&database)
.await