fix for the del command not working properly

This commit is contained in:
jude 2020-10-25 17:39:39 +00:00
parent a7fa722518
commit dd621a022a
3 changed files with 13 additions and 4 deletions

View File

@ -14,6 +14,10 @@ You'll need rustc and cargo for compilation. To run, you'll need Python 3 still
### Compiling
Reminder Bot can be built by running `cargo build --release` in the top level directory. It is necessary to create a folder called 'assets' containing an image file with its name specified in the environment as `WEBHOOK_AVATAR`, of dimensions 128x128px to be used as the webhook avatar.
#### Compilation environment variables
These environment variables must be provided when compiling the bot
* `WEBHOOK_AVATAR` - accepts the name of an image file located in `$CARGO_MANIFEST_DIR/assets/` to be used as the avatar when creating webhooks. **IMPORTANT: image file must be 128x128 or smaller in size**
### 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 `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
@ -33,7 +37,6 @@ __Other Variables__
* `PYTHON_LOCATION` - default `venv/bin/python3`. Can be changed if your Python executable is located somewhere else
* `LOCAL_LANGUAGE` - default `EN`. Specifies the string set to fall back to if a string cannot be found (and to be used with new users)
* `THEME_COLOR` - default `8fb677`. Specifies the hex value of the color to use on info message embeds
* `WEBHOOK_AVATAR` - default `None`, accepts the path to an image file to be used as the avatar when creating webhooks. **IMPORTANT: image file must be 128x128 or smaller in size**
* `CASE_INSENSITIVE` - default `1`, if `1`, commands will be treated with case insensitivity (so both `$help` and `$HELP` will work)
* `SHARD_COUNT` - default `None`, accepts the number of shards that are being ran
* `SHARD_RANGE` - default `None`, if `SHARD_COUNT` is specified, specifies what range of shards to start on this process

View File

@ -577,7 +577,6 @@ WHERE
let reply = msg
.channel_id
.await_reply(&ctx)
.filter_limit(1)
.author_id(msg.author.id)
.channel_id(msg.channel_id)
.await;
@ -641,6 +640,13 @@ INSERT INTO events (event_name, bulk_count, guild_id, user_id) VALUES ('delete',
1,
);
let _ = msg.channel_id.say(&ctx, content).await;
} else {
let content = user_data
.response(&pool, "del/count")
.await
.replacen("{}", "0", 1);
let _ = msg.channel_id.say(&ctx, content).await;
}
}
@ -1046,7 +1052,7 @@ async fn natural(ctx: &Context, msg: &Message, args: String) -> CommandResult {
let mut args_iter = args.splitn(2, &send_str);
let (time_crop_opt, msg_crop_opt) = (args_iter.next(), args_iter.next());
let (time_crop_opt, msg_crop_opt) = (args_iter.next(), args_iter.next().map(|m| m.trim()));
if let (Some(time_crop), Some(msg_crop)) = (time_crop_opt, msg_crop_opt) {
let python_call = Command::new(&*PYTHON_LOCATION)

View File

@ -144,7 +144,7 @@ SELECT id, name, nudge, blacklisted, webhook_id, webhook_token, paused, paused_u
sqlx::query!(
"
INSERT INTO channels (channel, name, guild_id) VALUES (?, ?, (SELECT id FROM guilds WHERE guild = ?))
INSERT IGNORE INTO channels (channel, name, guild_id) VALUES (?, ?, (SELECT id FROM guilds WHERE guild = ?))
", channel_id, channel_name, guild_id)
.execute(&pool.clone())
.await?;