mirror of
https://github.com/flibusta-apps/book_bot.git
synced 2025-12-08 09:30:45 +01:00
Add pre-commit
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use std::fmt;
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CallbackQueryParseError;
|
||||
|
||||
@@ -12,7 +11,6 @@ impl fmt::Display for CallbackQueryParseError {
|
||||
|
||||
impl std::error::Error for CallbackQueryParseError {}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CommandParseError;
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@ use teloxide::{dptree, prelude::*, types::*};
|
||||
|
||||
use super::errors::CommandParseError;
|
||||
|
||||
|
||||
pub trait CommandParse<T> {
|
||||
fn parse(s: &str, bot_name: &str) -> Result<T, CommandParseError>;
|
||||
}
|
||||
|
||||
|
||||
pub fn filter_command<Output>() -> crate::bots::BotHandler
|
||||
where
|
||||
Output: CommandParse<Output> + Send + Sync + 'static,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub mod errors;
|
||||
pub mod filter_command;
|
||||
pub mod pagination;
|
||||
pub mod split_text;
|
||||
pub mod filter_command;
|
||||
pub mod errors;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use teloxide::types::{InlineKeyboardButton, InlineKeyboardMarkup};
|
||||
|
||||
|
||||
pub enum PaginationDelta {
|
||||
OneMinus,
|
||||
OnePlus,
|
||||
@@ -12,7 +11,6 @@ pub trait GetPaginationCallbackData {
|
||||
fn get_pagination_callback_data(&self, target_page: u32) -> String;
|
||||
}
|
||||
|
||||
|
||||
pub fn generic_get_pagination_button<T>(
|
||||
target_page: u32,
|
||||
delta: PaginationDelta,
|
||||
@@ -36,7 +34,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn generic_get_pagination_keyboard<T>(
|
||||
page: u32,
|
||||
total_pages: u32,
|
||||
|
||||
@@ -26,7 +26,6 @@ pub fn split_text_to_chunks(text: &str, width: usize) -> Vec<String> {
|
||||
result
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::bots::approved_bot::modules::utils::split_text::split_text_to_chunks;
|
||||
|
||||
Reference in New Issue
Block a user