Implement the start command

This commit is contained in:
2025-12-17 11:23:37 -06:00
parent b36c7d32a2
commit f2c1c9c905
+19 -4
View File
@@ -4,17 +4,32 @@ use matrix_sdk::{
ruma::events::room::message::{OriginalSyncRoomMessageEvent, RoomMessageEventContent},
};
use crate::MagbotContext;
use crate::{MagbotContext, config::MagbotStatus};
/// Sets up the bot to listen for title suggestions
pub async fn start(
event: &OriginalSyncRoomMessageEvent,
room: &Room,
ctx: Ctx<MagbotContext>,
mut ctx: Ctx<MagbotContext>,
) -> anyhow::Result<()> {
let user = event.sender.to_string();
// set to listening
// send message that magbot is listening
todo!()
match ctx.0.status {
MagbotStatus::Running => {
let msg = RoomMessageEventContent::text_plain(format!(
"{user} Magbot is already listening for titles!"
));
room.send(msg).await?;
}
MagbotStatus::Sleeping => {
ctx.0.status = MagbotStatus::Running;
let msg = RoomMessageEventContent::text_plain(format!(
"{user} Magbot is now listening for titles!"
));
room.send(msg).await?;
}
}
Ok(())
}
/// Stops the bot from listening for title suggestions