feat(new command): add privacy command
This commit is contained in:
parent
b621a3af66
commit
d9d65e8d58
|
@ -5,6 +5,10 @@
|
||||||
|
|
||||||
Для более подробного описания, введите команды без аргументов.
|
Для более подробного описания, введите команды без аргументов.
|
||||||
|
|
||||||
|
<b>Команды (для всех)</b>
|
||||||
|
|
||||||
|
<code>/privacy</code> - политика конфиденциальности.
|
||||||
|
|
||||||
<b>Эмодзи (для админов)</b>
|
<b>Эмодзи (для админов)</b>
|
||||||
|
|
||||||
🎲 - выдаёт мут пользователю на случайно заданное время (от 1 до 6 дней);
|
🎲 - выдаёт мут пользователю на случайно заданное время (от 1 до 6 дней);
|
||||||
|
|
|
@ -4,6 +4,7 @@ pub mod files {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub const HELP_COMMAND_TEXT: &str = include_str!("help_command.html");
|
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 MUTE_COMMAND_HELP: &str = include_str!("mute_command_help.html");
|
||||||
pub const UNMUTE_COMMAND_HELP: &str = include_str!("unmute_command_help.html");
|
pub const UNMUTE_COMMAND_HELP: &str = include_str!("unmute_command_help.html");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
В боте <strong>Gluon v.0.1</strong> ни где не предусмотрено хранение данных о пользователе.
|
|
@ -5,11 +5,11 @@ use telers::{
|
||||||
Bot,
|
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())
|
MessageSender::builder(message.chat().id())
|
||||||
.text(HELP_COMMAND_TEXT)
|
.text(info_text)
|
||||||
.parse_mode(ParseMode::HTML)
|
.parse_mode(ParseMode::HTML)
|
||||||
.build()
|
.build()
|
||||||
.send(&bot)
|
.send(&bot)
|
|
@ -1,3 +1,3 @@
|
||||||
pub mod help_command;
|
pub mod info_commands_template;
|
||||||
pub mod mute_command;
|
pub mod mute_command;
|
||||||
pub mod unmute_command;
|
pub mod unmute_command;
|
||||||
|
|
28
src/main.rs
28
src/main.rs
|
@ -4,6 +4,7 @@ use telers::{
|
||||||
enums::ContentType,
|
enums::ContentType,
|
||||||
event::ToServiceProvider,
|
event::ToServiceProvider,
|
||||||
filters::{content_type::ContentType as CT, Command},
|
filters::{content_type::ContentType as CT, Command},
|
||||||
|
types::Message,
|
||||||
Bot, Dispatcher, Router,
|
Bot, Dispatcher, Router,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,9 +15,13 @@ mod utils;
|
||||||
|
|
||||||
use middlewares::admin_check_middleware::AdminCheck;
|
use middlewares::admin_check_middleware::AdminCheck;
|
||||||
|
|
||||||
|
use assets::files::{HELP_COMMAND_TEXT, PRIVACY_COMMAND_TEXT};
|
||||||
|
|
||||||
mod handlers;
|
mod handlers;
|
||||||
use 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,
|
dice_handler::dice::dice_handler,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,6 +69,22 @@ async fn main() {
|
||||||
let mut admin_commands = Router::new("admin_commands");
|
let mut admin_commands = Router::new("admin_commands");
|
||||||
let mut default_commands = Router::new("default_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
|
admin_commands
|
||||||
.message
|
.message
|
||||||
.register(unmute)
|
.register(unmute)
|
||||||
|
@ -79,11 +100,6 @@ async fn main() {
|
||||||
.inner_middlewares
|
.inner_middlewares
|
||||||
.register(AdminCheck {});
|
.register(AdminCheck {});
|
||||||
|
|
||||||
default_commands
|
|
||||||
.message
|
|
||||||
.register(help)
|
|
||||||
.filter(Command::one("help"));
|
|
||||||
|
|
||||||
command.include(admin_commands).include(default_commands);
|
command.include(admin_commands).include(default_commands);
|
||||||
|
|
||||||
route.include(command);
|
route.include(command);
|
||||||
|
|
Loading…
Reference in New Issue