-
Notifications
You must be signed in to change notification settings - Fork 117
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
'Bot.SendMessage' does not support target channel username #160
Comments
Hi! Thank you for raising the issue! A few things things to note here:
Regarding how to "fix" the issue (and why it hasnt been/isnt planned to be):
As you can see - I've put in some thought into this issue already 😅. And given the advantages of using IDs over usernames, I think it makes more sense to save ourselves the trouble and stick to IDs for now. If you really need to do actions via username, you can use the TL;DR - this is a known "issue" and not likely to be fixed, as I believe it would result in fighting Go's typesystem more than anything else. Use |
I definitely need to update the doc generation to remove the mention of the channelusername though; that seems to be causing more confusion than anything else! |
I can see your concerns, but the lib loses the full capability of telegram bot api, such as when I want the bot to send message to channel instead of chat ID. Maybe we can have some minor fix in the lib without breaking much. 1)Accept 2)Change the signature to add an optional
It saves us from populating many values in the params map if I have to use I hope it helps. |
You can use the channel ID instead - you don't HAVE to use usernames to interact with channels.
This removes all the advantages of using a typesafe language; these things should be caught at compile time, not at runtime. This would also be a BIG breaking change which I don't think is justifiable.
I find that using variadic arguments to denote "optional" parameters is a codesmell; if I had done that for all the other optional parameters, we would not have any type safety in the library. Your suggestion also seems to be adding unnecessary complexity and friction points where I don't think any is needed. Finally, this only handles the sending of If your concern is really just using |
Description of the problem / feature request
This is the method signature of 'SendMessage' function of Bot:
And the description of 'chatId' input parameter:
We have no way to pass channel username (which is a string), but only chat ID is supported.
Feature requests
Fix the generation tool to generate correct 'SendMessage' implementation code that accepts 'chatId' as integer or string.
The text was updated successfully, but these errors were encountered: