-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
👋 Hi,
Just reaching out as I've identified a problem with the getReceiver function, firstly, not quite sure why I'm getting the error in the first place, I'm using v8.0.0 of the package, getting the error:
ErrorException: Undefined property: stdClass::$id in /var/www/domain-monitor-api/vendor/laravel-notification-channels/twitter/src/TwitterDirectMessage.php:45
Presumably the error handling of the $user->id here needs to be more robust?
/**
* Get Twitter direct message receiver.
*
* @return string|mixed
*
* @throws CouldNotSendNotification
*/
public function getReceiver(TwitterOAuth $twitter): mixed
{
if (is_int($this->to)) {
return $this->to;
}
$user = $twitter->get('users/show', [
'screen_name' => $this->to,
'include_user_entities' => false,
'skip_status' => true,
]);
if ($twitter->getLastHttpCode() === 404) {
throw CouldNotSendNotification::userWasNotFound($twitter->getLastBody());
}
return $user->id;
}Metadata
Metadata
Assignees
Labels
No labels