Skip to content

ForwardMessages and CopyMessages wrong returns and schema #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jackchevalley opened this issue Mar 4, 2025 · 0 comments
Open

ForwardMessages and CopyMessages wrong returns and schema #714

jackchevalley opened this issue Mar 4, 2025 · 0 comments

Comments

@jackchevalley
Copy link

I was using ForwardMessages and CopyMessages and I noticed that if one of the message_ids is not delivered, the whole request returns 400 ok: false, failed to send message.

The test I have made:
I create a channel
I sent 5 messages in my channel with IDs 5, 6, 7, 8 ,9
I deleted message with ID 7
I sent forwardMessages with message_ids = [5, 6, 7, 8, 9]

I obtained ad answer
400, {'ok': False, 'error_code': 400, 'description': 'Bad Request: failed to send message #1 with the error message "Message was not forwarded"'}
Even if the messages 5,6,8,9 have been sent successfully, only message 7 has not.

I tried inserting an ID that does not exists in the channel (222222) with message_ids = [5, 6, 8, 9, 222222]
This time (message not existing at all, not deleted), the 222222 was simply skipped as said in docs "If some of the specified messages can't be found or forwarded, they are skipped".

At this point another issue opens, how should I map results with original message ids ?
In the case of [5, 6, 8, 9, 222222], the 222222 ID does not exists and it's skipped so the answer will be 1 element shorter than the original.
How should I know from that which message was skipped ?
I can no longer map with enumeration the results to the original message IDs since one of the elements has been skipped and I don't know which.

Please update the return schema, a good solution could be that it returns ok: false if every message has not been delivered.
Otherwise it returns a list of the messages including info about the message and original message.
{'ok': true, 'results': [{'ok': false, 'from_message_id': 7, 'description': 'message has not been sent...'}, {'ok': true, 'from_message_id': 8, ....}, ....]}

If it's not possibile to attach the original message id, at least do not skip results and return sorted by the IDs so that we can map it using enumerate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant