Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to a member function toNotGiven() on not TelegramSenderContract #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Samoylenko666
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants