Skip to content

Commit

Permalink
fixes & typos
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Nov 17, 2023
1 parent d28bc12 commit dd035c5
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 26 deletions.
2 changes: 0 additions & 2 deletions delta/mod.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Bot } from "../deps.ts";
import trigger from "./trigger.ts";
import useful from "./useful.ts";

export default async (bot: Bot) => {
await bot
.use(useful)
.use(trigger)
};
10 changes: 5 additions & 5 deletions src/functions/about.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ static TEXT: &str = r#"
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<()> {
if !msg.chat.is_private() {
return {
Expand All @@ -31,3 +26,8 @@ pub async fn command(bot: &Bot, msg: &Message) -> ResponseResult<()> {

Ok(())
}

pub fn keyboard() -> InlineKeyboardMarkup {
let mut keyboard = Keyboard::new();
keyboard.url("Ochiq Havolalar", "https://github.com/rust-lang-uz/rustina")
}
6 changes: 3 additions & 3 deletions src/functions/groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static TEXT: &str = "<b>Telegramdagi Rust Hamjamiyatlari yoki Guruhlari:</b>\nAg
pub async fn command(bot: &Bot, msg: &Message, groups: &Groups) -> ResponseResult<()> {
bot.send_message(msg.chat.id, TEXT)
.parse_mode(ParseMode::Html)
.reply_markup(keyboard_list(&groups, 1))
.reply_markup(keyboard_list(groups, 1))
.await?;

Ok(())
Expand All @@ -29,7 +29,7 @@ pub async fn callback_list(
if let Some(Message { id, chat, .. }) = q.message.clone() {
bot.edit_message_text(chat.id, id, TEXT)
.parse_mode(ParseMode::Html)
.reply_markup(keyboard_list(&groups, args[0].parse().unwrap_or(1)))
.reply_markup(keyboard_list(groups, args[0].parse().unwrap_or(1)))
.await?;
} else if let Some(id) = q.inline_message_id.clone() {
bot.edit_message_text_inline(id, "Oopsie, something went wrong...")
Expand Down Expand Up @@ -80,7 +80,7 @@ pub fn keyboard_list(groups: &Groups, page: i32) -> InlineKeyboardMarkup {
&format!(
"detail_{}_{}",
page,
group.telegram.clone().replace("@", "")
group.telegram.clone().replace('@', "")
),
);
keyboard.row();
Expand Down
5 changes: 2 additions & 3 deletions src/functions/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ use crate::Command;
use teloxide::{payloads::SendMessageSetters, prelude::*, types::ParseMode};

static TEXT: &[(&str, &str)] = &[
("doc", "reply qilingan odamga dok borligi haqida eslatish"),
("docs", "reply qilingan odamga dok borligi haqida eslatish"),
("useful", "rust haqida foydali yoki kerakli ma'lumotlar"),
("last", "eng oxirgi reliz haqida qisqacha ma'lumot"),
("latest", "eng oxirgi reliz haqida qisqacha ma'lumot"),
("version", "biron anniq reliz haqida to'liq ma'lumot"),
(
"off",
"reply qilingan odamga offtop borligi haqida eslatish",
),
("nometa", "to'g'ri savol berish haqida eslatma"),
("group", "rust ga oid guruh va hamjamiyatlar"),
("help", "ushbu xabarni qayta ko'rsatish"),
("about", "ushbu botimizning rivojlantirish qismi"),
Expand Down
4 changes: 2 additions & 2 deletions src/functions/latest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ pub async fn command(bot: &Bot, github: GitHub, msg: &Message) -> ResponseResult

pub fn view(release: &Release) -> String {
format!(
"<b>Hozirgi eng oxirgi versiya bu <a href=\"{}\">\
"<b>Hozirgi eng oxirgi versiya bu <a href=\"https://releases.rs/docs/{}\">\
{}</a> va ushbu reliz </b> <code>{}</code> da e'lon qilingan <a href=\"{}\">\
{}</a> tomonidan.\
\n\n\
",
format!("https://releases.rs/docs/{}", release.tag_name),
release.tag_name,
release.tag_name,
release.published_at.unwrap().date_naive(),
release.author.html_url,
Expand Down
2 changes: 2 additions & 0 deletions src/functions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::single_match)]

pub mod about;
pub mod groups;
pub mod help;
Expand Down
10 changes: 5 additions & 5 deletions src/functions/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ Iltimos qoidalarga oz bo'lsada vaqt ajratishni unutmang, bu muhim! Ushbu guruhda
<b>Ushbu qoidalarni doimiy tarzda buzish, butunlay ban yoki bir necha ogohlantirishlirga olib keladi!</b>
"#;

pub fn keyboard() -> InlineKeyboardMarkup {
let mut keyboard = Keyboard::new();
keyboard.url("Guruhga qaytish", "https://t.me/rustlanguz")
}

pub async fn command(bot: &Bot, msg: &Message) -> ResponseResult<()> {
if !msg.chat.is_private() {
return {
Expand All @@ -39,3 +34,8 @@ pub async fn command(bot: &Bot, msg: &Message) -> ResponseResult<()> {

Ok(())
}

pub fn keyboard() -> InlineKeyboardMarkup {
let mut keyboard = Keyboard::new();
keyboard.url("Guruhga qaytish", "https://t.me/rustlanguz")
}
12 changes: 6 additions & 6 deletions src/functions/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ static TEXT: &str = r#"
Sizni ko'rib turganimdan bag'oyatda xursandman. Men O'zbek Rust jamiyati tomonidan yaratilgan bot hisoblanib, O'zbek Rust jamiyati foydalanuvchilari uchun foydali resurslarni yetkazish, saqlash va ularni saralash uchun xizmat qilaman.
"#;

pub fn keyboard() -> InlineKeyboardMarkup {
let mut keyboard = Keyboard::new();
keyboard.url("Jamiyat", "https://t.me/rustlanguz");
keyboard.url("Web Sahifa", "https://rust-lang.uz")
}

pub async fn command(bot: &Bot, msg: &Message) -> ResponseResult<()> {
bot.send_message(msg.chat.id, TEXT)
.parse_mode(ParseMode::Html)
Expand All @@ -25,3 +19,9 @@ pub async fn command(bot: &Bot, msg: &Message) -> ResponseResult<()> {

Ok(())
}

pub fn keyboard() -> InlineKeyboardMarkup {
let mut keyboard = Keyboard::new();
keyboard.url("Jamiyat", "https://t.me/rustlanguz");
keyboard.url("Web Sahifa", "https://rust-lang.uz")
}
6 changes: 6 additions & 0 deletions src/utils/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ pub struct GitHub {
client: Octocrab,
}

impl Default for GitHub {
fn default() -> Self {
Self::new()
}
}

impl GitHub {
pub fn new() -> Self {
Self {
Expand Down
6 changes: 6 additions & 0 deletions src/utils/group_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pub struct Groups {
groups: Vec<Group>,
}

impl Default for Groups {
fn default() -> Self {
Self::new()
}
}

impl Groups {
pub fn new() -> Self {
let json: Vec<Group> = serde_json::from_str(GROUPS).unwrap();
Expand Down

0 comments on commit dd035c5

Please sign in to comment.