mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
Add unready
command to spinach for symmetry. (#23)
This commit is contained in:
parent
8c18fdb2b9
commit
aeb9130345
@ -184,7 +184,7 @@ sub spinach_cmd {
|
|||||||
$arguments = lc $arguments;
|
$arguments = lc $arguments;
|
||||||
$arguments =~ s/^\s+|\s+$//g;
|
$arguments =~ s/^\s+|\s+$//g;
|
||||||
|
|
||||||
my $usage = "Usage: spinach start|stop|abort|join|exit|ready|players|kick|choose|lie|truth|score|show; for more information about a command: spinach help <command>";
|
my $usage = "Usage: spinach start|stop|abort|join|exit|ready|unready|players|kick|choose|lie|truth|score|show; for more information about a command: spinach help <command>";
|
||||||
|
|
||||||
my $command;
|
my $command;
|
||||||
($command, $arguments) = split / /, $arguments, 2;
|
($command, $arguments) = split / /, $arguments, 2;
|
||||||
@ -326,7 +326,7 @@ sub spinach_cmd {
|
|||||||
if ($self->{current_state} eq 'nogame') {
|
if ($self->{current_state} eq 'nogame') {
|
||||||
return "There is no game started. Use `start` to begin a new game.";
|
return "There is no game started. Use `start` to begin a new game.";
|
||||||
} elsif ($self->{current_state} ne 'getplayers') {
|
} elsif ($self->{current_state} ne 'getplayers') {
|
||||||
return "There is a game in progress. You may join after the game is over.";
|
return "There is a game in progress. Use `join` to play!";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $id = $self->{pbot}->{messagehistory}->{database}->get_message_account($nick, $user, $host);
|
my $id = $self->{pbot}->{messagehistory}->{database}->get_message_account($nick, $user, $host);
|
||||||
@ -342,6 +342,19 @@ sub spinach_cmd {
|
|||||||
return "$nick: You haven't joined this game yet.";
|
return "$nick: You haven't joined this game yet.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
when ('unready') {
|
||||||
|
my $id = $self->{pbot}->{messagehistory}->{database}->get_message_account($nick, $user, $host);
|
||||||
|
|
||||||
|
foreach my $player (@{$self->{state_data}->{players}}) {
|
||||||
|
if ($player->{id} == $id) {
|
||||||
|
$player->{ready} = 0;
|
||||||
|
return "/msg $self->{channel} $nick is no longer ready!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "$nick: You haven't joined this game yet.";
|
||||||
|
}
|
||||||
|
|
||||||
when ('exit') {
|
when ('exit') {
|
||||||
my $id = $self->{pbot}->{messagehistory}->{database}->get_message_account($nick, $user, $host);
|
my $id = $self->{pbot}->{messagehistory}->{database}->get_message_account($nick, $user, $host);
|
||||||
my $removed = 0;
|
my $removed = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user