From 7d74a86dad69907eac10b9feb6e0a0bb4fe7c95f Mon Sep 17 00:00:00 2001 From: eleksir Date: Mon, 12 Dec 2022 15:19:41 +0300 Subject: [PATCH] In channel context Hightlight() is pointless --- lib/BotLib/Util.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/BotLib/Util.pm b/lib/BotLib/Util.pm index ff93e69..43a7e04 100644 --- a/lib/BotLib/Util.pm +++ b/lib/BotLib/Util.pm @@ -80,7 +80,16 @@ sub Highlight { my $highlight; my $username; my $visavi = ''; - my $userid = $msg->from->id; + + my $userid; + + # In channel message $msg->from->id is omitted + # In channel context Highlight is pointless + if ($msg->chat->type eq 'channel') { + return ($userid, $username, $fullname, $highlight, undef); + } + + $userid = $msg->from->id; if ($msg->from->can ('username') && defined $msg->from->username ) { $username = $msg->from->username;