Skip to content

Commit

Permalink
about command
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Nov 16, 2023
1 parent 8d83e5e commit 655be21
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
8 changes: 0 additions & 8 deletions delta/mod.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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);
};
29 changes: 29 additions & 0 deletions src/functions/about.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use crate::utils::kbmng::Keyboard;
use teloxide::{
payloads::SendMessageSetters,
prelude::*,
types::{InlineKeyboardMarkup, ParseMode},
};

static TEXT: &str = r#"
<b>Hurmatli foydalanuvchi!</b>
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(())
}
2 changes: 2 additions & 0 deletions src/functions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod help;
pub mod rules;
pub mod start;
pub mod about;

pub use teloxide::prelude::*;

Expand All @@ -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(())
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pub enum Command {

/// Rules of our chat
Rules,

/// About the bot
About,
}

pub fn handler() -> UpdateHandler<Box<dyn std::error::Error + Send + Sync + 'static>> {
Expand Down

0 comments on commit 655be21

Please sign in to comment.