Added ,stop cmd

This commit is contained in:
wrk 2023-06-09 02:17:46 +02:00
parent 48957df3cd
commit f88e947391

View File

@ -234,7 +234,10 @@ async fn main() -> std::io::Result<()> {
.add_system("h", show_help) .add_system("h", show_help)
.await .await
.add_system("s", show_status) .add_system("s", show_status)
.await; .await
.add_system("stop", stop)
.await
;
irc.run().await?; irc.run().await?;
Ok(()) Ok(())
@ -532,6 +535,7 @@ fn show_help() -> impl IntoResponse {
",f <nick> ... vs <nick> ... | team battle", ",f <nick> ... vs <nick> ... | team battle",
",f <nick> <nick> <nick> ... | free for all", ",f <nick> <nick> <nick> ... | free for all",
",s | show the current fight status", ",s | show the current fight status",
",stop | stop the current fight",
",hof | hall of fame", ",hof | hall of fame",
], ],
) )
@ -544,3 +548,9 @@ fn show_status(fight: Res<Fight>) -> impl IntoResponse {
format!("{} fighters remaining", fight.fighters.len()) format!("{} fighters remaining", fight.fighters.len())
} }
fn stop(mut fight: ResMut<Fight>) {
fight.fighters = vec![];
fight.channel = "".to_owned();
fight.status = FightStatus::Idle;
}