Trim() phrase before putting it to karma
This commit is contained in:
@@ -60,6 +60,8 @@ sub logger {
|
|||||||
sub trim {
|
sub trim {
|
||||||
my $str = shift;
|
my $str = shift;
|
||||||
|
|
||||||
|
return $str if ($str eq '');
|
||||||
|
|
||||||
while (substr ($str, 0, 1) =~ /^\s$/xms) {
|
while (substr ($str, 0, 1) =~ /^\s$/xms) {
|
||||||
$str = substr ($str, 1);
|
$str = substr ($str, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ MYHELP
|
|||||||
my @arr = split(/\n/, $text);
|
my @arr = split(/\n/, $text);
|
||||||
|
|
||||||
if ($#arr < 1) {
|
if ($#arr < 1) {
|
||||||
$reply = karmaSet ($chatid, substr ($text, 0, -2), substr ($text, -2));
|
$reply = karmaSet ($chatid, trim (substr ($text, 0, -2)), substr ($text, -2));
|
||||||
} else {
|
} else {
|
||||||
$just_message_in_chat = 1;
|
$just_message_in_chat = 1;
|
||||||
}
|
}
|
||||||
@@ -418,7 +418,7 @@ MYHELP
|
|||||||
my @arr = split(/\n/, $text);
|
my @arr = split(/\n/, $text);
|
||||||
|
|
||||||
if ($#arr < 1) {
|
if ($#arr < 1) {
|
||||||
$reply = karmaSet ($chatid, substr ($text, 0, -2), substr ($text, -2));
|
$reply = karmaSet ($chatid, trim (substr ($text, 0, -2)), substr ($text, -2));
|
||||||
} else {
|
} else {
|
||||||
# just message in chat
|
# just message in chat
|
||||||
$hailo->{$msg->chat->id}->learn ($text);
|
$hailo->{$msg->chat->id}->learn ($text);
|
||||||
|
|||||||
Reference in New Issue
Block a user