Forichok / TelegramOnlineSpy

Simple telegram online spy logger bot
Mozilla Public License 2.0
374 stars 81 forks source link

telethon.errors.rpcerrorlist.BotMethodInvalidError #13

Open firexx opened 2 years ago

firexx commented 2 years ago

i add me as user with add command like /add +4917699999999 myname

(here ist a fake mobile number, but i used existing) then after i /start logging i get in the console the exception throwed

Unhandled exception on start
Traceback (most recent call last):
  File "/home/ak/.local/lib/python3.6/site-packages/telethon/client/users.py", line 525, in _get_entity_from_string
    functions.contacts.GetContactsRequest(0))).users:
  File "/home/ak/.local/lib/python3.6/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/home/ak/.local/lib/python3.6/site-packages/telethon/client/users.py", line 79, in _call
    result = await future
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetContactsRequest)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ak/.local/lib/python3.6/site-packages/telethon/client/updates.py", line 454, in _dispatch_update
    await callback(event)
  File "spy.py", line 137, in start
    account = await client.get_entity(contact.id)
  File "/home/ak/.local/lib/python3.6/site-packages/telethon/client/users.py", line 330, in get_entity
    result.append(await self._get_entity_from_string(x))
  File "/home/ak/.local/lib/python3.6/site-packages/telethon/client/users.py", line 529, in _get_entity_from_string
    raise ValueError('Cannot get entity by phone number as a '
ValueError: Cannot get entity by phone number as a bot (try using integer IDs, not strings)
firexx commented 2 years ago

on first start it is wrong to request bots token, with the owner phone number it is work. if you on first strat provide the information the ticket can be closed

giammi56 commented 2 years ago

you need to use your own phone number