insert events on deleting a reminder

This commit is contained in:
jude 2020-10-14 16:08:26 +01:00
parent 11d12469fc
commit d10bf7ede6
3 changed files with 14 additions and 3 deletions

View File

@ -15,7 +15,7 @@ You'll need rustc and cargo for compilation. To run, you'll need Python 3 still
Reminder Bot can be built by running `cargo build --release` in the top level directory.
### Setting up Python
Reminder Bot by default looks for a venv within it's working directory to run Python out of. To set up a venv, install `python-venv` and run `python -m venv venv`. Then, run `source venv/bin/activate` to activate the venv, and do `pip install dateparser` to install the required library
Reminder Bot by default looks for a venv within it's working directory to run Python out of. To set up a venv, install `python3-venv` and run `python3 -m venv venv`. Then, run `source venv/bin/activate` to activate the venv, and do `pip install dateparser` to install the required library
### Environment Variables
Reminder Bot reads a number of environment variables. Some are essential, and others have hardcoded fallbacks. Environment variables can be loaded from a .env file in the working directory.

View File

@ -605,7 +605,18 @@ DELETE FROM reminders WHERE FIND_IN_SET(id, ?)
.await
.unwrap();
// TODO add deletion events to event list
if let Some(guild_id) = msg.guild_id {
let _ = sqlx::query!(
"
INSERT INTO events (event_name, bulk_count, guild_id, user_id) VALUES ('delete', ?, ?, ?)
",
count_row.count,
guild_id.as_u64(),
user_data.id
)
.execute(&pool)
.await;
}
let content = user_data.response(&pool, "del/count").await.replacen(
"{}",

View File

@ -169,7 +169,7 @@ UPDATE channels SET name = ?, nudge = ?, blacklisted = ?, webhook_id = ?, webhoo
}
pub struct UserData {
id: u32,
pub id: u32,
pub user: u64,
pub name: String,
pub dm_channel: u32,