padded readme out. made python location configurable. made ignore_bots configurable. replaced max_message_length with serenity's provided constant

This commit is contained in:
2020-10-12 19:12:33 +01:00
parent 3756e462e0
commit 88596fb399
6 changed files with 31 additions and 11 deletions

View File

@ -29,6 +29,7 @@ use crate::{
MIN_INTERVAL,
MAX_TIME,
LOCAL_TIMEZONE,
PYTHON_LOCATION,
CHARACTERS,
DAY,
HOUR,
@ -843,7 +844,7 @@ async fn natural(ctx: &Context, msg: &Message, args: String) -> CommandResult {
let (time_crop_opt, msg_crop_opt) = (args_iter.next(), args_iter.next());
if let (Some(time_crop), Some(msg_crop)) = (time_crop_opt, msg_crop_opt) {
let python_call = Command::new("venv/bin/python3")
let python_call = Command::new(&*PYTHON_LOCATION)
.arg("dp.py")
.arg(time_crop)
.arg(&user_data.timezone)
@ -863,7 +864,6 @@ async fn natural(ctx: &Context, msg: &Message, args: String) -> CommandResult {
let mut content = msg_crop;
let mut interval = None;
// check other options and then create reminder :)
if msg.guild_id.is_some() {
let re_match = Regex::new(&format!(r#"(?:\s*)(?P<msg>.*) {} (?P<mentions>((?:<@\d+>)|(?:<@!\d+>)|(?:<#\d+>)|(?:\s+))+)$"#, to_str))
.unwrap()
@ -898,7 +898,7 @@ async fn natural(ctx: &Context, msg: &Message, args: String) -> CommandResult {
let interval_str = captures.name("interval").unwrap().as_str();
let python_call = Command::new("venv/bin/python3")
let python_call = Command::new(&*PYTHON_LOCATION)
.arg("dp.py")
.arg(&format!("1 {}", interval_str))
.arg(&*LOCAL_TIMEZONE)

View File

@ -1,6 +1,7 @@
use regex_command_attr::command;
use serenity::{
constants::MESSAGE_CODE_LIMIT,
client::Context,
model::{
id::{
@ -20,7 +21,6 @@ use crate::{
UserData,
GuildData,
},
consts::MAX_MESSAGE_LENGTH,
SQLPool,
};
use sqlx::MySqlPool;
@ -321,7 +321,7 @@ async fn todo(ctx: &Context, msg: &Message, target: TodoTarget, subcommand: SubC
todo_items.iter().enumerate().for_each(|(count, todo)| {
let display = format!("{}: {}\n", count + 1, todo.value);
if char_count + display.len() > MAX_MESSAGE_LENGTH {
if char_count + display.len() > MESSAGE_CODE_LIMIT as usize {
char_count = display.len();
todo_groups.push(display);