better stuff

This commit is contained in:
2026-08-07 06:21:15 +02:00
parent fc32026c86
commit ab18ac194e
2 changed files with 11 additions and 8 deletions
+10 -5
View File
@@ -15,12 +15,11 @@ use tokio::{
use crate::bot::Bot;
async fn shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) -> anyhow::Result<()> {
async fn try_shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) -> anyhow::Result<()> {
let mut stdin = BufReader::new(io::stdin());
let mut line = String::new();
loop {
let mut stdin = BufReader::new(io::stdin());
let mut line = String::new();
stdin.read_line(&mut line).await?;
match line.to_lowercase().trim() {
@@ -56,6 +55,12 @@ async fn shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) -> anyhow::Re
}
}
async fn shutdown_listener(bot: Arc<Bot>, tx: watch::Sender<bool>) {
if let Err(e) = try_shutdown_listener(bot, tx).await {
log::error!("{e}");
}
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut builder = env_logger::Builder::from_default_env();