telegram: add /delete_{id} command, offer delete after deny
This commit is contained in:
parent
ff6868bf80
commit
b420f57cd7
1 changed files with 10 additions and 1 deletions
|
|
@ -81,7 +81,7 @@ pub async fn bot_task(bot: Bot, chat_id: ChatId, data_dir: PathBuf) {
|
||||||
} else if let Some(id) = text.strip_prefix("/deny_") {
|
} else if let Some(id) = text.strip_prefix("/deny_") {
|
||||||
match entries::set_status(&entries_dir, id, Status::Denied) {
|
match entries::set_status(&entries_dir, id, Status::Denied) {
|
||||||
Ok(name) => {
|
Ok(name) => {
|
||||||
bot.send_message(msg.chat.id, format!("Denied ({name})."))
|
bot.send_message(msg.chat.id, format!("Denied ({name}).\n/delete_{id}"))
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -134,6 +134,15 @@ pub async fn bot_task(bot: Bot, chat_id: ChatId, data_dir: PathBuf) {
|
||||||
bot.send_message(msg.chat.id, e).await?;
|
bot.send_message(msg.chat.id, e).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if let Some(id) = text.strip_prefix("/delete_") {
|
||||||
|
match entries::delete_entry(&data_dir, id) {
|
||||||
|
Ok(name) => {
|
||||||
|
bot.send_message(msg.chat.id, format!("Deleted ({name}).")).await?;
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
bot.send_message(msg.chat.id, e).await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue