TeamUltroid / Ultroid

Advanced Multi-Featured Telegram UserBot, Built in Python Using Telethon lib.
https://ultroid.tech
GNU Affero General Public License v3.0
2.83k stars 7.92k forks source link

[BUG REPORT] Cannot cast NoneType to any kind of Peer. #390

Closed Exekutori closed 1 year ago

Exekutori commented 2 years ago

Contact Details

@Shad0wReal

What happened?

A bug happened! When i do .help and click on Plugin/some other buttons it gives me back an error. See below 👍 awfawf

Version

0.7

Hosted On

Vps

Relevant logs output

pyUltLogs [ERROR] : Cannot cast NoneType to any kind of Peer.
Traceback (most recent call last):
  File "/home/Ultroid/pyUltroid/_misc/_assistant.py", line 77, in wrapper
    await func(event)
  File "/home/Ultroid/plugins/_inline.py", line 175, in help_func
    await ult.edit(text, buttons=page_num(count, key), link_preview=False)
  File "/home/Ultroid/venv/lib/python3.8/site-packages/telethon/events/callbackquery.py", line 341, in edit
    return await self._client.edit_message(
  File "/home/Ultroid/venv/lib/python3.8/site-packages/telethon/client/messages.py", line 1227, in edit_message
    entity = await self.get_input_entity(entity)
  File "/home/Ultroid/venv/lib/python3.8/site-packages/telethon/client/users.py", line 470, in get_input_entity
    peer = utils.get_peer(peer)
  File "/home/Ultroid/venv/lib/python3.8/site-packages/telethon/utils.py", line 997, in get_peer
    _raise_cast_fail(peer, 'Peer')
  File "/home/Ultroid/venv/lib/python3.8/site-packages/telethon/utils.py", line 138, in _raise_cast_fail
    raise TypeError('Cannot cast {} to any kind of {}.'.format(
TypeError: Cannot cast NoneType to any kind of Peer.

Acknowledgement

New-dev0 commented 2 years ago

@Shad0wGlitch Does this happen in one 2 one chat?

If yes, then try in saved messages or in public group

Exekutori commented 2 years ago

yes on a chat with a friend.. I will try as you said but it does me also in private groups...

I will try

Exekutori commented 2 years ago

Tried, same problem.

Oh and a second problem; I reinstalled Ultroid and i got this error:

11/19/2022, 16:57:16 | pyUltLogs [ERROR] : Could not find the input entity for PeerChannel(channel_id=1568054469) (PeerChannel). Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.
Traceback (most recent call last):
  File "/home/ubot/Ultroid/pyUltroid/startup/funcs.py", line 218, in autopilot
    chat = await ultroid_bot.get_entity(channel)
  File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 314, in get_entity
    inputs.append(await self.get_input_entity(x))
  File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 499, in get_input_entity
    raise ValueError(
ValueError: Could not find the input entity for PeerChannel(channel_id=1568054469) (PeerChannel).

I already got Ultroid before, and i fixed this error with a simple restart.. Now it's not working (i got the ID with Kotatogram)

TAMILVIP007 commented 2 years ago

@Shad0wGlitch Maybe u deleted ur .session file too it catches user info

rooted-cyber commented 2 years ago

Tried, same problem.

Oh and a second problem; I reinstalled Ultroid and i got this error:

11/19/2022, 16:57:16 | pyUltLogs [ERROR] : Could not find the input entity for PeerChannel(channel_id=1568054469) (PeerChannel). Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.
Traceback (most recent call last):
  File "/home/ubot/Ultroid/pyUltroid/startup/funcs.py", line 218, in autopilot
    chat = await ultroid_bot.get_entity(channel)
  File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 314, in get_entity
    inputs.append(await self.get_input_entity(x))
  File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 499, in get_input_entity
    raise ValueError(
ValueError: Could not find the input entity for PeerChannel(channel_id=1568054469) (PeerChannel).

I already got Ultroid before, and i fixed this error with a simple restart.. Now it's not working (i got the ID with Kotatogram)

change redis and try

Exekutori commented 2 years ago

@Shad0wGlitch Maybe u deleted ur .session file too it catches user info

Np, i reinstalled i had a problem with pip and i don't know why, but i recreated the venv and now works..

change redis and try

Also, I solved this problem by having the bot create the group and then copying the ID. And after restart it.

Another point is that the .help buttons works only in public groups and I only mean EXCLUSIVELY in public groups, neither saved messages nor private chats ...