17
src/bot/handlers/basic/get_chat_id.rs
Normal file
17
src/bot/handlers/basic/get_chat_id.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use grammers_client::{Client, Update};
|
||||
|
||||
use crate::{bot::handlers::Handler, utils::messages::get_message};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct GetChatId;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Handler for GetChatId {
|
||||
async fn react(&self, _: &Client, update: &Update) -> anyhow::Result<()> {
|
||||
let message = get_message(update);
|
||||
if let Some(msg) = message {
|
||||
msg.reply(msg.chat().id().to_string()).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
17
src/bot/handlers/basic/help.rs
Normal file
17
src/bot/handlers/basic/help.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use grammers_client::{Client, Update};
|
||||
|
||||
use crate::bot::handlers::Handler;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Help;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Handler for Help {
|
||||
async fn react(&self, _: &Client, update: &Update) -> anyhow::Result<()> {
|
||||
let Update::NewMessage(message) = update else {return Ok(())};
|
||||
|
||||
message.reply("Хелпа").await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
2
src/bot/handlers/basic/mod.rs
Normal file
2
src/bot/handlers/basic/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod get_chat_id;
|
||||
pub mod help;
|
Reference in New Issue
Block a user