Skip to content

[400 BOT_METHOD_INVALID] - The method can't be used by bots (caused by "messages.GetDialogs" #18

@pierluigizagaria

Description

@pierluigizagaria

Thank you for the bot.
I'm trying to set it up by using a bot account. After entering the bot token in the first step, this is what I get from the trace.

Traceback (most recent call last):
  File "D:\Files\Code\python\PyWardBot\app\main.py", line 1208, in <module>
    for dialog in user.get_dialogs():
                  ^^^^^^^^^^^^^^^^^^
  File "D:\Files\Code\python\PyWardBot\venv\Lib\site-packages\pyrogram\sync.py", line 42, in async_to_sync_gen
    item, done = loop.run_until_complete(anext(agen))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "D:\Files\Code\python\PyWardBot\venv\Lib\site-packages\pyrogram\sync.py", line 36, in anext
    return await agen.__anext__(), False
           ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Files\Code\python\PyWardBot\venv\Lib\site-packages\pyrogram\methods\chats\get_dialogs.py", line 58, in get_dialogs
    r = await self.invoke(
        ^^^^^^^^^^^^^^^^^^
  File "D:\Files\Code\python\PyWardBot\venv\Lib\site-packages\pyrogram\methods\advanced\invoke.py", line 94, in invoke
    r = await session.invoke(
        ^^^^^^^^^^^^^^^^^^^^^
  File "D:\Files\Code\python\PyWardBot\venv\Lib\site-packages\pyrogram\session\session.py", line 399, in invoke
    return await self.send(query, timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Files\Code\python\PyWardBot\venv\Lib\site-packages\pyrogram\session\session.py", line 367, in send
    RPCError.raise_it(result, type(data))
  File "D:\Files\Code\python\PyWardBot\venv\Lib\site-packages\pyrogram\errors\rpc_error.py", line 91, in raise_it
    raise getattr(
pyrogram.errors.exceptions.bad_request_400.BotMethodInvalid: Telegram says: [400 BOT_METHOD_INVALID] - The method can't be used by bots (caused by "messages.GetDialogs")

I've tried using a user account and everything worked fine. Probably some telegram api changes caused this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions