Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions lib/Bot/BasicBot/Pluggable/Module/Tea.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package Bot::BasicBot::Pluggable::Module::Tea;
use Moose;
use DateTime;
use List::Util qw(shuffle);
use List::MoreUtils qw(uniq);

extends 'Bot::BasicBot::Pluggable::Module';

Expand Down Expand Up @@ -42,8 +43,8 @@ sub help {

If you want to see the current tea round status, issue `!tea status`.

If you want to live on the edge issue the `!tea random` command to have
someone at random selected to make the tea
Feeling lucky Punk? `tea double_or_nothing` gives you the chance to escape
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just change that help message to !tea double_or_nothing and then this looks good to go, nice one!

your tea round. However, it's 50/50 and you could be making the next TWO cups!
HELPMSG

}
Expand Down Expand Up @@ -82,11 +83,13 @@ HELPMSG
sub tidy_lists {
my ( $self, $chan ) = @_;
my @all_nicks = $self->bot->pocoirc->channel_list( $chan );

# don't tell Gianni I used ~~
@nick_list = grep { $_ ~~ @all_nicks && $_ ne $self->bot->nick } @nick_list;

my $extra = '';
if (DateTime->now > $last_used->clone->add(hours => 8)) {
@all_nicks = uniq(@all_nicks); # forgive those who gambled and lost.
@nick_list = shuffle(@nick_list);
$extra = ' (the rota was rewritten due to inactivity)';
}
Expand Down Expand Up @@ -146,7 +149,17 @@ HELPMSG
elsif ( $commands[1] eq 'version' ) {
return "This is teabot version $VERSION";
}
else {
elsif ( $commands[1] eq 'double_or_nothing' ){
my $rand = rand;
if ($rand >= 0.5) {
my $next = pop @nick_list;
push (@nick_list, $next);
return "Wow!!! You got lucky! $who escapes his round. $next is making this round!!";
} else {
unshift (@nick_list, $who);
return "Ouch! Tough luck son! You double or nothin'd your way into making two rounds!";
}
} else {
return "$who-- # Imbecile! [unknown command]";
}

Expand Down