sjardim wrote a comment+100 XP
4mos ago
Jeffrey's Larabits: Ep 51, Build Your First Telegram Bot In Record Time
This is one for the must useful Larabits ever! I think I'll use it on a scheduling app I am planning. Thank you, Jeffrey!
sjardim liked a comment+100 XP
4mos ago
Jeffrey's Larabits: Ep 51, Build Your First Telegram Bot In Record Time
Quick note! At 13:07, we use the Bot's chat id to compare it to the authorized user id. Technically, this works for a private chat with the Bot. However, we should handle the possibility of group chats and channels by instead fetching the user directly. It's more clear that way, anyhow.
Use $bot->user()->id instead of $bot->chat()->id.
if ($bot->user()->id !== config('nutgram.authorized_user') {
$bot->sendMessage('You are not authorized to use this bot.');
}