diff --git a/src/assets/help_command.html b/src/assets/help_command.html
index 7f27de7..301b9c3 100644
--- a/src/assets/help_command.html
+++ b/src/assets/help_command.html
@@ -3,7 +3,11 @@
/mute {ID | REPLY} <DURATION> [TIME METRIC]
- выдаёт мут на заданное время;
/unmute {ID | REPLY}
- снимает мут;
-Для более подробного описания, введите команды без аргументов.
+Для более подробного описания, введите команды без аргументов.
+
+Команды (для всех)
+
+/privacy
- политика конфиденциальности.
Эмодзи (для админов)
diff --git a/src/assets/mod.rs b/src/assets/mod.rs
index b165277..2631361 100644
--- a/src/assets/mod.rs
+++ b/src/assets/mod.rs
@@ -4,6 +4,7 @@ pub mod files {
use super::*;
pub const HELP_COMMAND_TEXT: &str = include_str!("help_command.html");
+ pub const PRIVACY_COMMAND_TEXT: &str = include_str!("privacy_command.html");
pub const MUTE_COMMAND_HELP: &str = include_str!("mute_command_help.html");
pub const UNMUTE_COMMAND_HELP: &str = include_str!("unmute_command_help.html");
}
diff --git a/src/assets/privacy_command.html b/src/assets/privacy_command.html
new file mode 100644
index 0000000..9c91fa2
--- /dev/null
+++ b/src/assets/privacy_command.html
@@ -0,0 +1 @@
+В боте Gluon v.0.1 ни где не предусмотрено хранение данных о пользователе.
diff --git a/src/handlers/command_handlers/help_command.rs b/src/handlers/command_handlers/info_commands_template.rs
similarity index 62%
rename from src/handlers/command_handlers/help_command.rs
rename to src/handlers/command_handlers/info_commands_template.rs
index d4475dc..2d0ec7b 100644
--- a/src/handlers/command_handlers/help_command.rs
+++ b/src/handlers/command_handlers/info_commands_template.rs
@@ -5,11 +5,11 @@ use telers::{
Bot,
};
-use crate::{assets::files::HELP_COMMAND_TEXT, types::structs::message_sender::MessageSender};
+use crate::types::structs::message_sender::MessageSender;
-pub async fn help(bot: Bot, message: Message) -> HandlerResult {
+pub async fn send_info(bot: Bot, message: Message, info_text: &'static str) -> HandlerResult {
MessageSender::builder(message.chat().id())
- .text(HELP_COMMAND_TEXT)
+ .text(info_text)
.parse_mode(ParseMode::HTML)
.build()
.send(&bot)
diff --git a/src/handlers/command_handlers/mod.rs b/src/handlers/command_handlers/mod.rs
index 35b9d7a..2114140 100644
--- a/src/handlers/command_handlers/mod.rs
+++ b/src/handlers/command_handlers/mod.rs
@@ -1,3 +1,3 @@
-pub mod help_command;
+pub mod info_commands_template;
pub mod mute_command;
pub mod unmute_command;
diff --git a/src/main.rs b/src/main.rs
index 9d9c535..8ad8e64 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,6 +4,7 @@ use telers::{
enums::ContentType,
event::ToServiceProvider,
filters::{content_type::ContentType as CT, Command},
+ types::Message,
Bot, Dispatcher, Router,
};
@@ -14,9 +15,13 @@ mod utils;
use middlewares::admin_check_middleware::AdminCheck;
+use assets::files::{HELP_COMMAND_TEXT, PRIVACY_COMMAND_TEXT};
+
mod handlers;
use handlers::{
- command_handlers::{help_command::help, mute_command::mute, unmute_command::unmute},
+ command_handlers::{
+ info_commands_template::send_info, mute_command::mute, unmute_command::unmute,
+ },
dice_handler::dice::dice_handler,
};
@@ -64,6 +69,22 @@ async fn main() {
let mut admin_commands = Router::new("admin_commands");
let mut default_commands = Router::new("default_commands");
+ let help =
+ |bot: Bot, msg: Message| async { send_info(bot, msg, HELP_COMMAND_TEXT).await };
+
+ let privacy =
+ |bot: Bot, msg: Message| async { send_info(bot, msg, PRIVACY_COMMAND_TEXT).await };
+
+ default_commands
+ .message
+ .register(help)
+ .filter(Command::one("help"));
+
+ default_commands
+ .message
+ .register(privacy)
+ .filter(Command::one("privacy"));
+
admin_commands
.message
.register(unmute)
@@ -79,11 +100,6 @@ async fn main() {
.inner_middlewares
.register(AdminCheck {});
- default_commands
- .message
- .register(help)
- .filter(Command::one("help"));
-
command.include(admin_commands).include(default_commands);
route.include(command);