mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2024-11-23 04:31:05 +08:00
这下小修小补了
This commit is contained in:
parent
113a1518d1
commit
1c62e4aa0e
|
@ -9,7 +9,7 @@ use crate::data_struct::ica::all_rooms::Room;
|
|||
use crate::data_struct::ica::messages::{Message, MessageTrait, NewMessage};
|
||||
use crate::data_struct::ica::online_data::OnlineData;
|
||||
use crate::ica::client::send_message;
|
||||
use crate::{py, version_str, MainStatus, VERSION};
|
||||
use crate::{help_msg, py, version_str, MainStatus, VERSION};
|
||||
|
||||
/// 获取在线数据
|
||||
pub async fn get_online_data(payload: Payload, _client: Client) {
|
||||
|
@ -22,7 +22,6 @@ pub async fn get_online_data(payload: Payload, _client: Client) {
|
|||
}
|
||||
}
|
||||
|
||||
// #[allow(clippy::collapsible_if)]
|
||||
/// 接收消息
|
||||
pub async fn add_message(payload: Payload, client: Client) {
|
||||
if let Payload::Text(values) = payload {
|
||||
|
@ -51,6 +50,9 @@ pub async fn add_message(payload: Payload, client: Client) {
|
|||
}
|
||||
));
|
||||
send_message(&client, &reply).await;
|
||||
} else if message.content() == "/bot-help" {
|
||||
let reply = message.reply_with(&help_msg());
|
||||
send_message(&client, &reply).await;
|
||||
}
|
||||
if MainStatus::global_config().ica().admin_list.contains(&message.sender_id()) {
|
||||
// admin 区
|
||||
|
|
|
@ -26,9 +26,23 @@ pub type MainStatus = status::BotStatus;
|
|||
pub type StopGetter = tokio::sync::oneshot::Receiver<()>;
|
||||
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
pub const ICA_VERSION: &str = "1.6.1";
|
||||
pub const TAILCHAT_VERSION: &str = "1.2.1";
|
||||
pub const ICA_VERSION: &str = "1.6.2";
|
||||
pub const TAILCHAT_VERSION: &str = "1.2.2";
|
||||
|
||||
const HELP_MSG: &str = r#"/bot-rs
|
||||
展示 rust 侧信息
|
||||
/bot-py
|
||||
展示 python 侧信息(如果python插件启用了的话)
|
||||
/bot-ls
|
||||
显示所有插件信息
|
||||
/bot-enable <plugin>
|
||||
启用某个插件
|
||||
/bot-disable <plugin>
|
||||
禁用某个插件
|
||||
|
||||
by shenjackyuanjie"#;
|
||||
|
||||
pub fn help_msg() -> String { format!("{}\n{}", version_str(), HELP_MSG) }
|
||||
pub fn version_str() -> String {
|
||||
format!(
|
||||
"shenbot-rs v{}-{} ica v{}({}) tailchat v{}",
|
||||
|
|
|
@ -9,7 +9,7 @@ use tracing::{event, info, Level};
|
|||
use crate::data_struct::tailchat::messages::ReceiveMessage;
|
||||
use crate::data_struct::tailchat::status::{BotStatus, UpdateDMConverse};
|
||||
use crate::tailchat::client::{emit_join_room, send_message};
|
||||
use crate::{py, MainStatus, TAILCHAT_VERSION, VERSION};
|
||||
use crate::{help_msg, py, MainStatus, TAILCHAT_VERSION, VERSION};
|
||||
|
||||
/// 所有
|
||||
pub async fn any_event(event: Event, payload: Payload, _client: Client, _status: Arc<BotStatus>) {
|
||||
|
@ -94,6 +94,9 @@ pub async fn on_message(payload: Payload, client: Client, _status: Arc<BotStatus
|
|||
}
|
||||
));
|
||||
send_message(&client, &reply).await;
|
||||
} else if message.content == "/bot-help" {
|
||||
let reply = message.reply_with(&help_msg());
|
||||
send_message(&client, &reply).await;
|
||||
}
|
||||
if MainStatus::global_config().tailchat().admin_list.contains(&message.sender_id) {
|
||||
// admin 区
|
||||
|
|
Loading…
Reference in New Issue
Block a user