Skip to content

Telegram::getBots() returning empty array #1155

Open
@ihaswn

Description

@ihaswn

PHP version

8.0

irazasyed/telegram-bot-sdk version

v3.14.0

Laravel version (if any)

11

Code To Reproduce the bug

hi, i want to get a bot name from token, i made this method in TelegramService Class:

public static function getBotNameByToken($token)
    {
        $bot_name = null;
        $bots = Telegram::getBots();

        foreach (array_keys($bots) as $name) {
            if (Telegram::bot($name)->getAccessToken() == $token) {
                $bot_name = $name;
                break;
            }
        }

        return $bot_name;
    }

the problem is Telegram::getBots() is returning an empty array, it used to work but suddenly its just returning empty, i registered a few bots in the telegram.php config file, and when i do Telegram::bot('bot_name') its working, but they will not get included in getBots method anymore, why is that??

Error stacktrace (if any)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions