Advertisement
kopyl

Untitled

Feb 9th, 2023
996
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.10 KB | None | 0 0
  1. ---------------------------------------------------------------------------
  2. KeyError                                  Traceback (most recent call last)
  3. File ~/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pyrogram/methods/advanced/resolve_peer.py:62, in ResolvePeer.resolve_peer(self, peer_id)
  4.      61 try:
  5. ---> 62     return await self.storage.get_peer_by_id(peer_id)
  6.      63 except KeyError:
  7.  
  8. File ~/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pyrogram/storage/sqlite_storage.py:148, in SQLiteStorage.get_peer_by_id(self, peer_id)
  9.     147 if r is None:
  10. --> 148     raise KeyError(f"ID not found: {peer_id}")
  11.     150 return get_input_peer(*r)
  12.  
  13. KeyError: 'ID not found: -100...'
  14.  
  15. During handling of the above exception, another exception occurred:
  16.  
  17. ValueError                                Traceback (most recent call last)
  18. Cell In[185], line 8
  19.       6 for chat in chats.chats:
  20.       7     if chat.title == "Заметки 100":
  21. ----> 8         await client.send_message(
  22.       9             int(f"-100{chat.id}"),
  23.      10             "test message",
  24.      11         )
  25.  
  26. File ~/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pyrogram/methods/messages/send_message.py:128, in SendMessage.send_message(self, chat_id, text, parse_mode, entities, disable_web_page_preview, disable_notification, reply_to_message_id, schedule_date, protect_content, reply_markup)
  27.      46 """Send text messages.
  28.     47
  29.     48 .. include:: /_includes/usable-by/users-bots.rst
  30.   (...)
  31.    121                 ]))
  32.    122 """
  33.     124 message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
  34.     126 r = await self.invoke(
  35.     127     raw.functions.messages.SendMessage(
  36. --> 128         peer=await self.resolve_peer(chat_id),
  37.     129         no_webpage=disable_web_page_preview or None,
  38.     130         silent=disable_notification or None,
  39.     131         reply_to_msg_id=reply_to_message_id,
  40.     132         random_id=self.rnd_id(),
  41.     133         schedule_date=utils.datetime_to_timestamp(schedule_date),
  42.     134         reply_markup=await reply_markup.write(self) if reply_markup else None,
  43.     135         message=message,
  44.     136         entities=entities,
  45.     137         noforwards=protect_content
  46.     138     )
  47.     139 )
  48.     141 if isinstance(r, raw.types.UpdateShortSentMessage):
  49.     142     peer = await self.resolve_peer(chat_id)
  50.  
  51. File ~/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pyrogram/methods/advanced/resolve_peer.py:89, in ResolvePeer.resolve_peer(self, peer_id)
  52.      86         except KeyError:
  53.      87             raise PeerIdInvalid
  54. ---> 89 peer_type = utils.get_peer_type(peer_id)
  55.      91 if peer_type == "user":
  56.      92     await self.fetch_peers(
  57.      93         await self.invoke(
  58.      94             raw.functions.users.GetUsers(
  59.    (...)
  60.     102         )
  61.     103     )
  62.  
  63. File ~/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pyrogram/utils.py:246, in get_peer_type(peer_id)
  64.     243 elif 0 < peer_id <= MAX_USER_ID:
  65.     244     return "user"
  66. --> 246 raise ValueError(f"Peer id invalid: {peer_id}")
  67.  
  68. ValueError: Peer id invalid: -100...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement