Display list by default
This commit is contained in:
parent
5627da377f
commit
352e5ab356
86
src/bot.rs
86
src/bot.rs
@ -291,15 +291,53 @@ pub async fn process_command(
|
||||
format!("I haven't seen {} move anywhere near me...", segments[0])
|
||||
}
|
||||
Command::LastOnline => {
|
||||
if segments.len() < 1 {
|
||||
return "Please tell me a page number or the name of a player!".to_string();
|
||||
}
|
||||
|
||||
let mut page = 1;
|
||||
if segments.len() > 0 {
|
||||
if segments[0].parse::<usize>().is_ok() {
|
||||
let mut page: usize = segments[0].parse().unwrap();
|
||||
page = segments[0].parse().unwrap();
|
||||
if page < 1 {
|
||||
page = 1
|
||||
}
|
||||
} else {
|
||||
for (player, player_time_data) in state.player_timestamps.lock().unwrap().iter()
|
||||
{
|
||||
if player == &segments[0] {
|
||||
return format!(
|
||||
"{} - last join: {}, last chat message: {}, last leave: {}",
|
||||
segments[0],
|
||||
if player_time_data.join_time != 0 {
|
||||
Local
|
||||
.timestamp_opt(player_time_data.join_time as i64, 0)
|
||||
.unwrap()
|
||||
.format("%Y/%m/%d %H:%M:%S")
|
||||
.to_string()
|
||||
} else {
|
||||
"never".to_string()
|
||||
},
|
||||
if player_time_data.chat_message_time != 0 {
|
||||
Local
|
||||
.timestamp_opt(player_time_data.chat_message_time as i64, 0)
|
||||
.unwrap()
|
||||
.format("%Y/%m/%d %H:%M:%S")
|
||||
.to_string()
|
||||
} else {
|
||||
"never".to_string()
|
||||
},
|
||||
if player_time_data.leave_time != 0 {
|
||||
Local
|
||||
.timestamp_opt(player_time_data.leave_time as i64, 0)
|
||||
.unwrap()
|
||||
.format("%Y/%m/%d %H:%M:%S")
|
||||
.to_string()
|
||||
} else {
|
||||
"never".to_string()
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
return format!("I haven't seen {} online yet...", segments[0]);
|
||||
}
|
||||
}
|
||||
|
||||
let mut sorted_player_time_data: Vec<PlayerTimeData> = state
|
||||
.player_timestamps
|
||||
@ -337,44 +375,6 @@ pub async fn process_command(
|
||||
paged_players.join(", ")
|
||||
);
|
||||
}
|
||||
|
||||
for (player, player_time_data) in state.player_timestamps.lock().unwrap().iter() {
|
||||
if player == &segments[0] {
|
||||
return format!(
|
||||
"{} - last join: {}, last chat message: {}, last leave: {}",
|
||||
segments[0],
|
||||
if player_time_data.join_time != 0 {
|
||||
Local
|
||||
.timestamp_opt(player_time_data.join_time as i64, 0)
|
||||
.unwrap()
|
||||
.format("%Y/%m/%d %H:%M:%S")
|
||||
.to_string()
|
||||
} else {
|
||||
"never".to_string()
|
||||
},
|
||||
if player_time_data.chat_message_time != 0 {
|
||||
Local
|
||||
.timestamp_opt(player_time_data.chat_message_time as i64, 0)
|
||||
.unwrap()
|
||||
.format("%Y/%m/%d %H:%M:%S")
|
||||
.to_string()
|
||||
} else {
|
||||
"never".to_string()
|
||||
},
|
||||
if player_time_data.leave_time != 0 {
|
||||
Local
|
||||
.timestamp_opt(player_time_data.leave_time as i64, 0)
|
||||
.unwrap()
|
||||
.format("%Y/%m/%d %H:%M:%S")
|
||||
.to_string()
|
||||
} else {
|
||||
"never".to_string()
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
format!("I haven't seen {} online yet...", segments[0])
|
||||
}
|
||||
Command::FollowPlayer => {
|
||||
if segments.len() < 1 {
|
||||
return "Please tell me the name of a player!".to_string();
|
||||
|
Loading…
x
Reference in New Issue
Block a user