telegram
telegram copied to clipboard
Call to a member function toNotGiven() on not TelegramSenderContract
This pull request allows us not to send notifications if we do not return TelegramSenderContract.
In some cases I no longer need to send a notification. The most common case is that the time for sending the notification has already expired. I would like to be able to return a type that does not implement the TelegramSenderContract functionality. Look at the following code
public function toTelegram($notifiable): TelegramMessage|false
{
if (do not send notification)
{
return false;
}
// Send notification
return TelegramMessage::create()
->to(config('services.telegram-bot-api.chat_id'))
->line('hello');
}
This code return error local.ERROR: Call to a member function toNotGiven() on false {"exception":"[object] (Error(code: 0): Call to a member function toNotGiven() on false at /var/www/html/vendor/laravel-notification-channels/telegram/src/TelegramChannel.php:41)