[x] The error is in the library's code, and not in my own.
[x] I have searched for this issue before posting it and there isn't a duplicate.
[x] I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip and triggered the bug in the latest version.
Code that causes the issue
@client.on(events.ChatAction(chats=main_id))
async def normal_handler(event):
global one, pin
if event.new_pin:
pin = await event.get_pinned_message()
Traceback
ERROR:telethon.client.updates:Unhandled exception on normal_handler
Traceback (most recent call last):
File "D:\Python\lib\site-packages\telethon\client\updates.py", line 431, in _dispatch_update
await callback(event)
File "D:\Darts\hello.py", line 22, in normal_handler
pin = await event.get_pinned_message()
File "D:\Python\lib\site-packages\telethon\events\chataction.py", line 264, in get_pinned_message
r = await self._client(functions.channels.GetMessagesRequest(
File "D:\Python\lib\site-packages\telethon\client\users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
File "D:\Python\lib\site-packages\telethon\client\users.py", line 37, in _call
await r.resolve(self, utils)
File "D:\Python\lib\site-packages\telethon\tl\functions\channels.py", line 780, in resolve
self.channel = utils.get_input_channel(await client.get_input_entity(self.channel))
File "D:\Python\lib\site-packages\telethon\utils.py", line 263, in get_input_channel
_raise_cast_fail(entity, 'InputChannel')
File "D:\Python\lib\site-packages\telethon\utils.py", line 138, in _raise_cast_fail
raise TypeError('Cannot cast {} to any kind of {}.'.format(
TypeError: Cannot cast InputPeerChat to any kind of InputChannel.
This bug was reproduced on my PC and heroku cloud, but on my friend's PC this code works well.
It doesn't depend on the chat.
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip
and triggered the bug in the latest version.Code that causes the issue
Traceback
This bug was reproduced on my PC and heroku cloud, but on my friend's PC this code works well. It doesn't depend on the chat.