summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/commands.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/server/src/commands.rs b/server/src/commands.rs
index 904305bf..d6ca8b25 100644
--- a/server/src/commands.rs
+++ b/server/src/commands.rs
@@ -22,7 +22,7 @@ use crate::{
use anyhow::{anyhow, bail, Result};
use clap::{Parser, ValueEnum};
use hurrycurry_bot::algos::ALGO_CONSTRUCTORS;
-use hurrycurry_protocol::{Menu, Message, PacketC, PlayerID};
+use hurrycurry_protocol::{Menu, Message, MessageTimeout, PacketC, PlayerID};
use std::{fmt::Write, time::Duration};
#[derive(Parser)]
@@ -83,6 +83,11 @@ enum Command {
StartTutorial {
item: String,
},
+ #[clap(alias = "tr")]
+ TranslateMessage {
+ message_id: String,
+ arguments: Vec<String>,
+ },
}
#[derive(ValueEnum, Clone)]
@@ -239,6 +244,22 @@ impl Server {
// TODO prevent too many (> 1) tutorials for this player
self.entities.push(Box::new(Tutorial::new(player, item)));
}
+ Command::TranslateMessage {
+ message_id,
+ arguments,
+ } => {
+ self.packet_out.push_back(PacketC::Communicate {
+ player,
+ message: Some(Message::Translation {
+ id: message_id,
+ params: arguments.into_iter().map(|c| Message::Text(c)).collect(),
+ }),
+ timeout: Some(MessageTimeout {
+ initial: 5.,
+ remaining: 5.,
+ }),
+ });
+ }
}
Ok(())
}