public function isAdmin($user_id = null)
{
if ($user_id === null && $this->update !== null) {
//Try to figure out if the user is an admin
$update_methods = ['getMessage', 'getInlineQuery', 'getChosenInlineResult', 'getCallbackQuery', 'getEditedMessage'];
foreach ($update_methods as $update_method) {
$object = call_user_func([$this->update, $update_method]);
if ($object !== null && ($from = $object->getFrom())) {
$user_id = $from->getId();
break;
}
}
}
return $user_id === null ? false : in_array($user_id, $this->admins_list, true);
}