mirror of
https://github.com/house-of-vanity/desubot.git
synced 2025-08-21 15:27:14 +00:00
Fix warnings. Bump version.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "desubot"
|
name = "desubot"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
authors = ["AB <ab@hexor.ru>"]
|
authors = ["AB <ab@hexor.ru>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
static CODE: &str = "<b>Code highlighter</b>
|
#[allow(dead_code)]
|
||||||
|
static CODE_HELP: &str = "<b>Code highlighter</b>
|
||||||
|
|
||||||
<i>Usage</i>
|
<i>Usage</i>
|
||||||
<pre>/CODE
|
<pre>/CODE
|
||||||
#<theme - Dracula by default>
|
|
||||||
<CODE>
|
<CODE>
|
||||||
#<lang - JS by default></pre>
|
#<lang - JS by default> #<theme - Dracula by default></pre>
|
||||||
|
|
||||||
Language may be defined by both name and extension - Rust, rs...
|
Language may be defined by both name and extension - Rust, rs...
|
||||||
Max lines - 80
|
Max lines - 80
|
||||||
@@ -33,4 +33,11 @@ gruvbox
|
|||||||
gruvbox-light
|
gruvbox-light
|
||||||
gruvbox-white
|
gruvbox-white
|
||||||
zenburn
|
zenburn
|
||||||
";
|
";
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub static SQL_HELP: &str = "<b>Perform an SQL command</b>
|
||||||
|
<i>* Only one sentence per message.
|
||||||
|
* Only SELECT command.
|
||||||
|
* Max result length is 100 lines. Use LIMIT 100.
|
||||||
|
* SQLITE syntax is available only.</i>";
|
@@ -23,6 +23,8 @@ use syntect::util::LinesWithEndings;
|
|||||||
use telegram_bot::prelude::*;
|
use telegram_bot::prelude::*;
|
||||||
use telegram_bot::{Api, Message, ParseMode};
|
use telegram_bot::{Api, Message, ParseMode};
|
||||||
|
|
||||||
|
include!("../assets/help_text.rs");
|
||||||
|
|
||||||
pub struct Here {
|
pub struct Here {
|
||||||
pub data: String,
|
pub data: String,
|
||||||
}
|
}
|
||||||
@@ -65,6 +67,10 @@ impl Execute for Sql {
|
|||||||
|
|
||||||
async fn exec_with_result(&self, api: &Api, message: &Message) -> Result<String, Error> {
|
async fn exec_with_result(&self, api: &Api, message: &Message) -> Result<String, Error> {
|
||||||
let mut sql = self.data.clone();
|
let mut sql = self.data.clone();
|
||||||
|
debug!("PIZDA - {}", sql);
|
||||||
|
if sql == "/sql" || sql == "/sql-" {
|
||||||
|
return Ok(SQL_HELP.to_string())
|
||||||
|
}
|
||||||
let is_head = if sql.starts_with('-') {
|
let is_head = if sql.starts_with('-') {
|
||||||
sql = sql.replacen("-", "", 1);
|
sql = sql.replacen("-", "", 1);
|
||||||
false
|
false
|
||||||
|
@@ -48,7 +48,7 @@ pub async fn handler(
|
|||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
let _ = api
|
let _ = api
|
||||||
.send(message.text_reply(CODE).parse_mode(ParseMode::Html))
|
.send(message.text_reply(CODE_HELP).parse_mode(ParseMode::Html))
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user