danneu / telegram-chatgpt-bot

a Telegram ChatGPT bot that supports text prompts and two-way voice memos
33 stars 8 forks source link

Add group chat support #3

Open danneu opened 1 year ago

danneu commented 1 year ago

The bot isn't very nice to use in group chats.

Telegram's rules for when bots receive messages in group chats are confusing (https://core.telegram.org/bots/faq#what-messages-will-my-bot-get). Since I never use bots nor group chats on Telegram, I'm not sure how it should work.

Currently, the bot supports /ai command prompts like /ai What is the meaning of life? in group chats, but I realize it's not the right/intended way to build a bot because of:

  1. Only the last bot to send a message in the group chat will receive an untargeted command like /ai instead of /ai@some_bot
  2. Targeted commands (/ai@some_bot) are painful to write. Telegram clearly wants you to just click on them from the command menu which doesn't let you provide an argument.
  3. Commands with arguments (/ai {text}) aren't the intended way to impl commands. Telegram's UI works against this sort of usage.

I'm not sure of the intended way for bots to interact with group chats.

I know that bots are guaranteed to receive your message if you reply to them in a group chat, so I think that's the way to go.

But one issue is that you can't reply to a bot that isn't on screen. Maybe I should implement a /hi command that makes the bot say something in chat so that you can easily respond to it?