You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
message = await client.get_messages(spam_lists[list_name]['chat_id'], ids=message_id)
for i in range(0, len(groups), bulk_size):
bulk = groups[i:i + bulk_size]
for group in bulk:
retries = 0
while retries < 3:
try:
await fetch_chat_info(client, group) # Manual polling
await client.get_entity(PeerChannel(group))
await client.forward_messages(group, message)
spam_lists[list_name]['last_sent'][group] = datetime.now(italy_tz).isoformat()
break
except ValueError:
logging.warning(f"Group {group} not accessible. Skipping.")
break
except errors.RPCError as e:
logging.error(f"Error sending message to group {group}: {e}")
retries += 1
await asyncio.sleep(2)
if retries == 3:
logging.error(f"Failed to send message to group {group} after 3 retries.")
await asyncio.sleep(delay / 1000)
Expected behavior
I am expecting to see the message forwarded.
Actual behavior
In the logs I get the "Invalid object ID for a chat" error because it didn't found the identity for the gruop via chat_id.
If I'm forwarding a message in the group manually then the code is executed perfectly.
Traceback
2024-07-18T17:29:29.664509+00:00 app[worker.1]: ERROR:root:Error sending message to group -1229581945: Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead (caused by ForwardMessagesRequest)
2024-07-18T17:29:31.746386+00:00 app[worker.1]: ERROR:root:Error sending message to group -1229581945: Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead (caused by ForwardMessagesRequest)
2024-07-18T17:29:33.833484+00:00 app[worker.1]: ERROR:root:Error sending message to group -1229581945: Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead (caused by ForwardMessagesRequest)
2024-07-18T17:29:35.836516+00:00 app[worker.1]: ERROR:root:Failed to send message to group -1229581945 after 3 retries.
2024-07-18T17:29:36.275161+00:00 app[worker.1]: ERROR:root:Error sending message to group -1177688883: Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead (caused by ForwardMessagesRequest)
2024-07-18T17:29:38.356095+00:00 app[worker.1]: ERROR:root:Error sending message to group -1177688883: Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead (caused by ForwardMessagesRequest)
2024-07-18T17:29:40.611554+00:00 app[worker.1]: ERROR:root:Error sending message to group -1177688883: Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead (caused by ForwardMessagesRequest)
2024-07-18T17:29:42.612171+00:00 app[worker.1]: ERROR:root:Failed to send message to group -1177688883 after 3 retries.
Telethon version
1.36
Python version
3.12.4
Operating system (including distribution name and version)
Linux (Hosted on heroku)
Other details
I am developing a userbot that among the other things spams its advertise in over 100 groups every 4-6 hour so I cannot have the possibility to interact manually with each group...
I also saw this post (#4345) but I don't know how I can implement it in my code, I'm kinda new on Python and Telethon, sorry in advance.
Checklist
The error is in the library's code, and not in my own.
I have searched for this issue before posting it and there isn't an open duplicate.
I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.
The text was updated successfully, but these errors were encountered:
Code that causes the issue
Expected behavior
I am expecting to see the message forwarded.
Actual behavior
In the logs I get the "Invalid object ID for a chat" error because it didn't found the identity for the gruop via chat_id.
If I'm forwarding a message in the group manually then the code is executed perfectly.
Traceback
Telethon version
1.36
Python version
3.12.4
Operating system (including distribution name and version)
Linux (Hosted on heroku)
Other details
I am developing a userbot that among the other things spams its advertise in over 100 groups every 4-6 hour so I cannot have the possibility to interact manually with each group...
I also saw this post (#4345) but I don't know how I can implement it in my code, I'm kinda new on Python and Telethon, sorry in advance.
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.The text was updated successfully, but these errors were encountered: