refactor: introduce plugin_ids constants, replace hardcoded plugin ID strings

This commit is contained in:
2026-03-31 23:40:23 +08:00
parent c8dece351c
commit 98d827f5c3
5 changed files with 22 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
use crate::core::message::{Destination, Envelope, Message, PlayerCommand, WifiCommand};
use crate::core::plugin_ids;
/// 命令解析结果
pub struct DispatchResult {
@@ -137,7 +138,7 @@ fn ok_video(from: &str, message: Message) -> Result<DispatchResult, String> {
Ok(DispatchResult {
envelope: Envelope {
from: from.to_string(),
to: Destination::Plugin("video".to_string()),
to: Destination::Plugin(plugin_ids::VIDEO.to_string()),
message,
},
})
@@ -147,7 +148,7 @@ fn ok_wifi(from: &str, message: Message) -> Result<DispatchResult, String> {
Ok(DispatchResult {
envelope: Envelope {
from: from.to_string(),
to: Destination::Plugin("wifi".to_string()),
to: Destination::Plugin(plugin_ids::WIFI.to_string()),
message,
},
})