Skip to content

Commit

Permalink
fix: solve the message parsed in the hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Phosphorus-M committed Oct 2, 2024
1 parent f53adea commit 67ba66a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/hooks/left_chat_member.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use teloxide::{Bot, types::ChatMemberUpdated, requests::Requester, utils::html};
use teloxide::types::ParseMode::Html;
use teloxide::{
payloads::SendMessageSetters, requests::Requester, types::ChatMemberUpdated, utils::html, Bot,
};

use crate::models::errors::BotErrors;


pub async fn left_chat_member(bot: Bot, chat_member: ChatMemberUpdated) -> Result<(), BotErrors> {
let user = chat_member.old_chat_member.user;

Expand All @@ -14,7 +16,8 @@ pub async fn left_chat_member(bot: Bot, chat_member: ChatMemberUpdated) -> Resul
chat_member.chat.id,
format!("Hasta la proximaaaa {username}!"),
)
.parse_mode(Html)
.await?;

Ok(())
}
}
10 changes: 5 additions & 5 deletions src/hooks/new_chat_member.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use teloxide::{Bot, types::ChatMemberUpdated, requests::Requester, utils::html};

use crate::models::errors::BotErrors;


use teloxide::types::ParseMode::Html;
use teloxide::{
payloads::SendMessageSetters, requests::Requester, types::ChatMemberUpdated, utils::html, Bot,
};

/// Welcome Endpoint
pub async fn new_chat_member(bot: Bot, chat_member: ChatMemberUpdated) -> Result<(), BotErrors> {
Expand All @@ -18,8 +18,8 @@ pub async fn new_chat_member(bot: Bot, chat_member: ChatMemberUpdated) -> Result
.unwrap_or_else(|| html::user_mention(user.id, user.full_name().as_str()));

bot.send_message(chat_member.chat.id, format!("Bienvenidx a {telegram_group_name}, un lugar horrible pero bueno, pasala bien {username}!"))
.parse_mode(Html)
.await?;

Ok(())
}

0 comments on commit 67ba66a

Please sign in to comment.