|
|
@ -6,12 +6,12 @@ use crate::queue::SendQueue;
|
|
|
|
use crate::{try_option_send_error, try_send_error};
|
|
|
|
use crate::{try_option_send_error, try_send_error};
|
|
|
|
|
|
|
|
|
|
|
|
impl CommandSetPlayer {
|
|
|
|
impl CommandSetPlayer {
|
|
|
|
|
|
|
|
/// Set the player's name
|
|
|
|
pub fn dispatch_name(&self, args: String, token: Token, db: &mut Db) -> SendQueue {
|
|
|
|
pub fn dispatch_name(&self, args: String, token: Token, db: &mut Db) -> SendQueue {
|
|
|
|
let mut player = try_option_send_error!(token, db.get_connected_player(token));
|
|
|
|
let mut player = try_option_send_error!(token, db.get_connected_player(token));
|
|
|
|
|
|
|
|
|
|
|
|
let new_name = args.trim();
|
|
|
|
let new_name = args.trim();
|
|
|
|
if new_name.is_empty() {
|
|
|
|
if new_name.is_empty() {
|
|
|
|
//return SendQueue::from_string(token, "Name can't be empty")
|
|
|
|
|
|
|
|
return SendQueue(vec![(token, "Name can't be empty".into(), true)].into());
|
|
|
|
return SendQueue(vec![(token, "Name can't be empty".into(), true)].into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|