Add quirk for api incosistency in reactions
This commit is contained in:
@@ -89,22 +89,41 @@ sub Highlight {
|
||||
return ($userid, $username, $fullname, $highlight, undef);
|
||||
}
|
||||
|
||||
$userid = $msg->from->id;
|
||||
my $userid;
|
||||
if ($msg->can ('from')) {
|
||||
$userid = $msg->from->id;
|
||||
|
||||
if ($msg->from->can ('username') && defined $msg->from->username ) {
|
||||
$username = $msg->from->username;
|
||||
}
|
||||
|
||||
if ($msg->from->can ('first_name') && defined $msg->from->first_name) {
|
||||
$fullname = $msg->from->first_name;
|
||||
|
||||
if ($msg->from->can ('last_name') && defined $msg->from->last_name) {
|
||||
$fullname .= ' ' . $msg->from->last_name;
|
||||
if ($msg->from->can ('username') && defined $msg->from->username ) {
|
||||
$username = $msg->from->username;
|
||||
}
|
||||
} elsif ($msg->from->can ('last_name') && defined $msg->from->last_name) {
|
||||
$fullname .= $msg->from->last_name;
|
||||
}
|
||||
|
||||
if ($msg->from->can ('first_name') && defined $msg->from->first_name) {
|
||||
$fullname = $msg->from->first_name;
|
||||
|
||||
if ($msg->from->can ('last_name') && defined $msg->from->last_name) {
|
||||
$fullname .= ' ' . $msg->from->last_name;
|
||||
}
|
||||
} elsif ($msg->from->can ('last_name') && defined $msg->from->last_name) {
|
||||
$fullname .= $msg->from->last_name;
|
||||
}
|
||||
} else {
|
||||
# Reacions case.
|
||||
$userid = $msg->user->id;
|
||||
|
||||
if ($msg->user->can ('username') && defined $msg->user->username ) {
|
||||
$username = $msg->user->username;
|
||||
}
|
||||
|
||||
if ($msg->user->can ('first_name') && defined $msg->user->first_name) {
|
||||
$fullname = $msg->user->first_name;
|
||||
|
||||
if ($msg->user->can ('last_name') && defined $msg->user->last_name) {
|
||||
$fullname .= ' ' . $msg->user->last_name;
|
||||
}
|
||||
} elsif ($msg->user->can ('last_name') && defined $msg->user->last_name) {
|
||||
$fullname .= $msg->user->last_name;
|
||||
}
|
||||
}
|
||||
if (defined $username) {
|
||||
$visavi .= '@' . $username;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use Mojo::Base 'Teapot::Bot::Object::Base';
|
||||
|
||||
use Teapot::Bot::Object::Chat ();
|
||||
use Teapot::Bot::Object::Chat ();
|
||||
use Teapot::Bot::Object::User ();
|
||||
use Teapot::Bot::Object::MessageReaction ();
|
||||
|
||||
$Teapot::Bot::Object::MessageReactionUpdated::VERSION = '0.026';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user