Skip to content
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

Can't send messages to supergroups using supergroup's @username #74

Closed
thesharp opened this issue Aug 4, 2016 · 1 comment
Closed

Comments

@thesharp
Copy link
Contributor

thesharp commented Aug 4, 2016

If you are trying to send a message to supergroup via it's @username instead of chat_id, botogram fails with this error:

16:34.42 -  WARNING  - Chat 0 is not available to your bot:
16:34.42 -  WARNING  - The chat with ID 0 doesn't exist
16:34.42 -  WARNING  - Update #979264137 processing aborted!

Last time it worked in 0.2.2 release. It's been broken since commit 9e142ea

Now if botogram detects string as chat_id it thinks that we are going to send our message to the telegram channel, which has slightly different Telegram API call, where we need to specify "id": 0, "type": "channel".

Because both supergroups and channels have string ids but different API calls, I can't think of any good workaround. The ugly thing would be to make a separate method for sending to supergroups by @username.

@pietroalbini
Copy link
Contributor

Thank you for this report! I didn't know you can reference supergroups with usernames, so I wrote that code assuming strings are channels.

This is a regression, and I'll make a point release when I have some spare time.

Because both supergroups and channels have string ids but different API calls, I can't think of any good workaround. The ugly thing would be to make a separate method for sending to supergroups by @username.

Well, you can get the ID for both channels and supergroups with getChat, so the fix for this issue is really simple.

@pietroalbini pietroalbini added this to the botogram 0.3.4 milestone Aug 4, 2016
pietroalbini pushed a commit that referenced this issue Aug 10, 2016
This is a bugfix release, which fixes the following things:

* Fix inability to send messages to supergroups by username, using the
  deprecated `botogram.Bot.send()` method (GH-74)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants