-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
9 changed files
with
88 additions
and
176 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import which from "./which.ts"; | ||
import { Bot } from "../deps.ts"; | ||
import trigger from "./trigger.ts"; | ||
import useful from "./useful.ts"; | ||
|
||
export default async (bot: Bot) => { | ||
await bot | ||
.use(which) | ||
.use(useful) | ||
.use(trigger) | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,47 @@ | ||
use teloxide::{prelude::*, types::*}; | ||
|
||
static TEXT_FAIL: &str = "Ha-ha... yaxshi urinish!"; | ||
static TEXT_NON_REPLY: &str = "↪ Reply bilan ko'rsatingchi habarni!"; | ||
|
||
pub async fn command(bot: &Bot, msg: &Message, me: &Me) -> ResponseResult<()> { | ||
if msg.reply_to_message().is_none() { | ||
return { | ||
bot.send_message(msg.chat.id, TEXT_NON_REPLY).await?; | ||
Ok(()) | ||
}; | ||
} | ||
|
||
// if replied person is bot itself, send fail message | ||
if let Some(user) = msg.reply_to_message().as_ref().unwrap().from() { | ||
if user.username.clone().unwrap() == me.username() { | ||
return { | ||
bot.send_message(msg.chat.id, TEXT_FAIL).await?; | ||
Ok(()) | ||
}; | ||
} | ||
} | ||
|
||
bot.delete_message(msg.chat.id, msg.id).await?; | ||
bot.delete_message(msg.chat.id, msg.reply_to_message().unwrap().id) | ||
.await?; | ||
|
||
bot.send_message(msg.chat.id, view(msg.reply_to_message().unwrap())) | ||
.parse_mode(ParseMode::Html) | ||
.await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn view(msg: &Message) -> String { | ||
format!( | ||
"<b>Hurmatli <a href=\"tg://user?id={}\">{}</a>,</b>\ | ||
\n\n\ | ||
Tushunishim bo'yicha siz mavzudan chetlayashayabsiz. Iltimos, \ | ||
quyidagi tugmachani bosish orqali bizning offtop guruhga o'tib oling! \ | ||
Offtopic guruhimizda istalgan mavzuda suhbatlashish ruxsat etiladi. Boshqalarga halaqit qilmayliga 😉\ | ||
\n\n\ | ||
<b>Hurmat ila, Rustina (Rastina)</b>", | ||
msg.from().unwrap().id, | ||
msg.from().unwrap().first_name | ||
) | ||
} |
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
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
d28bc12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to deploy: