From e79f27bf2c1db9fe1401adce65062de8d9e36f62 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Mon, 7 Feb 2022 22:56:16 +0300 Subject: [PATCH] Trim arguments of commands --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/bot.rs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed3e5e3..9ea363e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -168,7 +168,7 @@ dependencies = [ [[package]] name = "crate_upd_bot" -version = "0.1.9" +version = "0.1.10" dependencies = [ "arraylib", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index b4ff5f4..cd3f851 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crate_upd_bot" -version = "0.1.9" +version = "0.1.10" authors = ["Waffle "] edition = "2018" diff --git a/src/bot.rs b/src/bot.rs index 41458e9..fa87708 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -3,6 +3,7 @@ use std::{fmt::Debug, ops::Not, path::PathBuf, sync::Arc}; use fntools::value::ValueExt; use futures::{future, Future, FutureExt}; use teloxide::{ + payloads::SendMessageSetters, prelude::{Requester, *}, types::{Me, Message}, utils::command::{BotCommand, ParseError}, @@ -285,7 +286,7 @@ where fn opt(input: String) -> Result<(Option,), ParseError> { match input.split_whitespace().count() { 0 => Ok((None,)), - 1 => Ok((Some(input),)), + 1 => Ok((Some(input.trim().to_owned()),)), n => Err(ParseError::TooManyArguments { expected: 1, found: n,