Implement fortune commands set

+ !f, !ф, !fortune, !фортунка - show random phrase from fortune_mod db
+ !f 1, !ф 1, !fortune 1, !фортунка 1 - show fortune in chat at ~8 am
+ !f 0, !ф 0, !fortune 0, !фортунка 0 - do not show fortune in the morning
+ !f ?, !ф ?, !fortune ?, !фортунка ? - query morning fortune status
This commit is contained in:
eleksir
2020-11-22 15:05:49 +03:00
parent 25b25ade5c
commit ad37a349c1
6 changed files with 769 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ use conf qw(loadConf);
use lat qw(latAnswer);
use karma qw(karmaSet karmaGet);
use friday qw(friday);
use fortune qw(fortune fortune_toggle fortune_status);
use vars qw/$VERSION/;
@@ -265,7 +266,7 @@ sub command {
my $city = substr ($text, 3);
$reply = weather ($city);
} elsif (substr ($text, 1) eq 'lat' || substr ($text, 1) eq 'лат') {
$reply = latAnswer();
$reply = latAnswer ();
} elsif (substr ($text, 1, 6) eq 'karma ' || substr ($text, 1, 6) eq 'карма ' || substr($text, 1) eq 'karma' || substr($text, $1) eq 'карма') {
my $mytext = '';
@@ -279,7 +280,15 @@ sub command {
$reply = karmaGet ($chatid, $mytext);
} elsif (substr ($text, 1) eq 'friday' || substr ($text, 1) eq 'пятница') {
$reply = friday();
$reply = friday ();
} elsif (substr ($text, 1) eq 'fortune' || substr ($text, 1) eq 'фортунка' || substr ($text, 1) eq 'f' || substr ($text, 1) eq 'ф') {
$reply = fortune ();
} elsif (substr ($text, 1) eq 'f 1' || substr ($text, 1) eq 'fortune 1' || substr ($text, 1) eq 'фортунка 1' || substr ($text, 1) eq 'ф 1') {
$reply = fortune_toggle ($chatid, 1);
} elsif (substr ($text, 1) eq 'f 0' || substr ($text, 1) eq 'fortune 0' || substr ($text, 1) eq 'фортунка 0' || substr ($text, 1) eq 'ф 0') {
$reply = fortune_toggle ($chatid, 0);
} elsif (substr ($text, 1) eq 'f ?' || substr ($text, 1) eq 'fortune ?' || substr ($text, 1) eq 'фортунка ?' || substr ($text, 1) eq 'ф ?') {
$reply = fortune_status ($chatid);
}
return $reply;