Closed TimmekHW closed 1 year ago
The bot responds to any slash "/".
I've seen this bug before, it's not a difficult fix. The bot only parses the commands that it knows, so it assumes that everything else it sees is a prompt.
And is it possible to add /g in addition to /gen?
This is also pretty easy to add.
//very small request
` .await .map_err(|e| anyhow!(e))?; ""//this line would support html markup"" .to_owned()`
~I'm not sure I understand this request. Is it that you want the command description to support HTML markup? I don't think the telegram bot API supports markdown or markup in the bot description.~
Nevermind, I see -- you mean here: https://github.com/capslock/stable-diffusion-bot/blob/main/crates/stable-diffusion-bot/src/bot/handlers/mod.rs#L61. Yes, it's easy: the fix is to change the parse mode on L67.
// Or use teloxide::types::ParseMode::Html for HTML
bot.send_message(msg.chat.id, text).parse_mode(teloxide::types::ParseMode::MarkdownV2).await?;
Fixed by https://github.com/capslock/stable-diffusion-bot/commit/215a54c386bade1eeac563ae207aae2ab92ecc5e.
/g
-> /gen
added in https://github.com/capslock/stable-diffusion-bot/commit/650d61b098fc8a59211bcb942bdf732b90d573ac. Also adds /generate
.
I updated the parse mode to use Markdown in https://github.com/capslock/stable-diffusion-bot/commit/a530cfdbdccf6b6232004b9c7c2f667002e9a7d8. If you want Html, you'll want to change to ParseMode::Html
and use html::escape
, and change the import from utils::{command::BotCommands, markdown}
to utils::{command::BotCommands, html}
.
The bot responds to any slash "/". How can this be fixed? And is it possible to add /g in addition to /gen?
Now there is another moderator bot in the conference, which is also fun. But every time we write '/анекдот', Stable_bot appears and starts generating a picture, although we haven’t asked it yet.
//very small request https://github.com/capslock/stable-diffusion-bot/blob/54355b310691cc1d517f0e678ad4ca4a6b8dd352/crates/stable-diffusion-bot/src/bot/handlers/image.rs#L29