-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f32ed7
commit f53adea
Showing
4 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use teloxide::{requests::Requester, types::{ChatId, Message}, Bot}; | ||
use tracing::info; | ||
|
||
use crate::models::errors::BotErrors; | ||
|
||
pub async fn me(msg: &Message, action: String, bot: &Bot) -> Result<(), BotErrors> { | ||
if action.is_empty() { | ||
return Err(BotErrors::MeCommandBadUsed); | ||
} | ||
|
||
if let Some(user) = msg.from() { | ||
if (user.id.0 as i64).eq(&msg.chat.id.0) { | ||
let username = if let Some(username) = user.username.clone() { | ||
username | ||
} else { | ||
user.full_name() | ||
}; | ||
|
||
// our telegram chat id | ||
bot.send_message(ChatId(-1001217390053), format!("{username} {action}", )).await?; | ||
} | ||
} | ||
|
||
info!(" {}", msg.chat.id); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters