Added silence for some messages.
Signed-off-by: Pavel Kirilin <win10@list.ru>
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
use grammers_client::{Client, Update};
|
use grammers_client::{Client, InputMessage, Update};
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
use crate::{bot::handlers::Handler, utils::messages::get_message};
|
use crate::{bot::handlers::Handler, utils::messages::get_message};
|
||||||
@ -23,7 +23,9 @@ impl Handler for Chooser {
|
|||||||
.and_then(|collected| collected.choose(&mut rand::rngs::OsRng).copied());
|
.and_then(|collected| collected.choose(&mut rand::rngs::OsRng).copied());
|
||||||
// It the string is chosen, reply to message with it.
|
// It the string is chosen, reply to message with it.
|
||||||
if let Some(answer) = response {
|
if let Some(answer) = response {
|
||||||
input_message.reply(answer).await?;
|
input_message
|
||||||
|
.reply(InputMessage::from(answer).silent(true))
|
||||||
|
.await?;
|
||||||
} else {
|
} else {
|
||||||
input_message
|
input_message
|
||||||
.reply("Я не смог понять из чего мне выбирать. Попробуй ещё раз.")
|
.reply("Я не смог понять из чего мне выбирать. Попробуй ещё раз.")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use grammers_client::{Client, Update};
|
use grammers_client::{Client, InputMessage, Update};
|
||||||
|
|
||||||
use crate::{bot::handlers::Handler, utils::messages::get_message};
|
use crate::{bot::handlers::Handler, utils::messages::get_message};
|
||||||
|
|
||||||
@ -9,7 +9,9 @@ pub struct Repeator;
|
|||||||
impl Handler for Repeator {
|
impl Handler for Repeator {
|
||||||
async fn react(&self, _: &Client, update: &Update) -> anyhow::Result<()> {
|
async fn react(&self, _: &Client, update: &Update) -> anyhow::Result<()> {
|
||||||
let Some(message) = get_message(update) else { return Ok(()) };
|
let Some(message) = get_message(update) else { return Ok(()) };
|
||||||
message.respond(message.text()).await?;
|
message
|
||||||
|
.respond(InputMessage::from(message.text()).silent(true))
|
||||||
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user