Skip to content

Commit

Permalink
Merge pull request #10 from birlug/feat/easter-egg
Browse files Browse the repository at this point in the history
easter-egg: appreciate powers of two
  • Loading branch information
ehsan-mohammadi authored Oct 3, 2024
2 parents 99f184c + 935c84f commit 724946d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::telegram::{self, ForwardMessage, PinChatMessage, WebhookReply};

use std::collections::HashMap;

use rust_persian_tools::digits::DigitsEn2Fa;
use telegram_types::bot::{
methods::{
ApproveJoinRequest, ChatTarget, DeclineJoinRequest, DeleteMessage, ReplyMarkup,
Expand Down Expand Up @@ -147,6 +148,14 @@ impl Bot {
// report unallowed chats
return self.forward(&m, self.config.bot.report_chat_id);
}
// easter egg: appreciate powers of two!
if m.message_id.0 & (m.message_id.0 - 1) == 0 {
let reply = format!(
include_str!("./response/easter-egg"),
m.message_id.0.digits_en_to_fa()
);
return self.reply(m, &reply);
}
if let Some(command) = m
.text
.as_ref()
Expand Down
1 change: 1 addition & 0 deletions src/response/easter-egg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
پیام {} ام! 🎉

0 comments on commit 724946d

Please sign in to comment.