From 655be217f30c202e3d90326ee4ab5cbbcfe23a29 Mon Sep 17 00:00:00 2001 From: Sokhibjon Orzikulov Date: Fri, 17 Nov 2023 01:28:39 +0500 Subject: [PATCH] about command --- delta/mod.ts | 8 -------- src/functions/about.rs | 29 +++++++++++++++++++++++++++++ src/functions/mod.rs | 2 ++ src/lib.rs | 3 +++ 4 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 src/functions/about.rs diff --git a/delta/mod.ts b/delta/mod.ts index e1a8816..c9c1b78 100644 --- a/delta/mod.ts +++ b/delta/mod.ts @@ -1,10 +1,6 @@ -import start from "./start.ts"; -import help from "./help.ts"; import inline from "./inline.ts"; import which from "./which.ts"; import { Bot } from "../deps.ts"; -import about from "./about.ts"; -import rules from "./rules.ts"; import channel from "./channel.ts"; import trigger from "./trigger.ts"; import groups from "./groups.ts"; @@ -14,16 +10,12 @@ import version from "./version.ts"; export default async (bot: Bot) => { await bot - .use(start) - .use(help) .use(inline) .use(which) .use(groups) .use(useful) .use(latest) .use(version) - .use(about) - .use(rules) .use(trigger) .use(channel); }; diff --git a/src/functions/about.rs b/src/functions/about.rs new file mode 100644 index 0000000..5519ff4 --- /dev/null +++ b/src/functions/about.rs @@ -0,0 +1,29 @@ +use crate::utils::kbmng::Keyboard; +use teloxide::{ + payloads::SendMessageSetters, + prelude::*, + types::{InlineKeyboardMarkup, ParseMode}, +}; + +static TEXT: &str = r#" +Hurmatli foydalanuvchi! + +Bizning botimiz aktiv tarzda shakllantirib boriladi. Buning ustida esa bir necha avtor va dasturchilar turadi, ushbu havolalar orqali bizning sinovchilarimizdan biriga aylaning va biz bilan botimiz, hamda guruhimiz ishlatish qulayligini oshiring. +"#; + +pub fn keyboard() -> InlineKeyboardMarkup { + let mut keyboard = Keyboard::new(); + keyboard.url( + "Ochiq Havolalar", + "https://github.com/rust-lang-uz/rustina", + ) +} + +pub async fn command(bot: &Bot, msg: &Message) -> ResponseResult<()> { + bot.send_message(msg.chat.id, TEXT) + .parse_mode(ParseMode::Html) + .reply_markup(keyboard()) + .await?; + + Ok(()) +} diff --git a/src/functions/mod.rs b/src/functions/mod.rs index 324629d..3016f01 100644 --- a/src/functions/mod.rs +++ b/src/functions/mod.rs @@ -1,6 +1,7 @@ pub mod help; pub mod rules; pub mod start; +pub mod about; pub use teloxide::prelude::*; @@ -17,6 +18,7 @@ pub async fn commands( Command::Start => crate::functions::start::command(&bot, &msg).await, Command::Help => crate::functions::help::command(&bot, &msg, &cmd).await, Command::Rules => crate::functions::rules::command(&bot, &msg).await, + Command::About => crate::functions::about::command(&bot, &msg).await, }; Ok(()) diff --git a/src/lib.rs b/src/lib.rs index 51ab839..2432a81 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,9 @@ pub enum Command { /// Rules of our chat Rules, + + /// About the bot + About, } pub fn handler() -> UpdateHandler> {