aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Perry <np@nathanperry.dev>2024-08-16 03:09:00 -0400
committerNathan Perry <np@nathanperry.dev>2024-08-16 03:09:00 -0400
commit7d47be4c40ac8f9a9c33ae8c78e44d20c2c46ef6 (patch)
tree9da7169c81985e4daa6698586945536782becf91 /src
parenta9e284db95dc39d61c91089126bc8848d36fa4f7 (diff)
windows: windows_util -> util::windows
Diffstat (limited to 'src')
-rw-r--r--src/bot.rs14
-rw-r--r--src/lib.rs3
-rw-r--r--src/util/mod.rs9
-rw-r--r--src/util/windows.rs (renamed from src/windows_util.rs)0
4 files changed, 13 insertions, 13 deletions
diff --git a/src/bot.rs b/src/bot.rs
index de31c73..0c44349 100644
--- a/src/bot.rs
+++ b/src/bot.rs
@@ -258,11 +258,11 @@ fn on_err(err: FrameworkError<PoiseData, anyhow::Error>) -> BoxFuture<()> {
} else {
return;
}
- },
+ }
Err(e) => {
error!("processing unrecognized message: {e}");
"BANIC".to_string()
- },
+ }
}
} else {
if let Err(e) = commands::meme::invoke::_meme(
@@ -270,7 +270,7 @@ fn on_err(err: FrameworkError<PoiseData, anyhow::Error>) -> BoxFuture<()> {
msg_content,
Default::default(),
)
- .await
+ .await
{
error!("producing meme for unrecognized: {e}");
"BANIC".to_string()
@@ -278,7 +278,7 @@ fn on_err(err: FrameworkError<PoiseData, anyhow::Error>) -> BoxFuture<()> {
return;
}
}
- },
+ }
_ => "BANIC".to_string(),
};
@@ -377,7 +377,7 @@ fn check(ctx: PoiseContext) -> BoxFuture<anyhow::Result<bool>> {
})
}
-fn before_handle<'fut>(ctx: PoiseContext<'fut>) -> Pin<Box<dyn Future<Output = ()> + Send + 'fut>> {
+fn before_handle<'fut>(ctx: PoiseContext<'fut>) -> Pin<Box<dyn Future<Output=()> + Send + 'fut>> {
debug!(
"got command '{}' from user '{}' ({})",
ctx.command().name,
@@ -397,7 +397,7 @@ fn after_handle(ctx: PoiseContext) -> BoxFuture<()> {
pub async fn run() -> anyhow::Result<()> {
#[cfg(all(windows, feature = "windows_autostart_postgres"))]
let started_pg =
- tokio::task::spawn_blocking(|| unsafe { crate::windows_util::ensure_postgres_started() })
+ tokio::task::spawn_blocking(|| unsafe { util::windows::ensure_postgres_started() })
.await??;
let token = &CONFIG.discord.auth.token;
@@ -431,7 +431,7 @@ pub async fn run() -> anyhow::Result<()> {
if started_pg {
log::info!("we started postgres, stopping it before shutdown");
- tokio::task::spawn_blocking(|| crate::windows_util::shutdown_postgres()).await??;
+ tokio::task::spawn_blocking(|| util::windows::shutdown_postgres()).await??;
}
}
diff --git a/src/lib.rs b/src/lib.rs
index ac56087..1f03290 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -21,9 +21,6 @@ pub mod config;
pub mod log_setup;
pub mod util;
-#[cfg(windows)]
-pub mod windows_util;
-
pub use crate::{
config::*,
util::*,
diff --git a/src/util/mod.rs b/src/util/mod.rs
index fb4b552..d214957 100644
--- a/src/util/mod.rs
+++ b/src/util/mod.rs
@@ -37,6 +37,9 @@ use crate::{
mod rest_vec;
+#[cfg(windows)]
+pub mod windows;
+
pub use rest_vec::*;
pub async fn currently_playing(ctx: PoiseContext<'_>) -> bool {
@@ -66,9 +69,9 @@ pub async fn users_listening(ctx: &Context) -> anyhow::Result<bool> {
pub fn msg<U, E>(ctx: poise::Context<'_, U, E>) -> Option<&Message> {
match ctx {
poise::Context::Prefix(poise::PrefixContext {
- msg,
- ..
- }) => Some(msg),
+ msg,
+ ..
+ }) => Some(msg),
_ => None,
}
}
diff --git a/src/windows_util.rs b/src/util/windows.rs
index 3b1339e..3b1339e 100644
--- a/src/windows_util.rs
+++ b/src/util/windows.rs