eternnoir / pyTelegramBotAPI

Python Telegram bot api.
GNU General Public License v2.0
8.11k stars 2.03k forks source link

how do i respond to messages from business_message_handler? #2257

Closed MatLumin closed 6 months ago

MatLumin commented 6 months ago

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using? 4.17.0
  2. What OS are you using? ubuntu
  3. What version of python are you using? 3.11.9

assume i have a code like this

@bot.business_message_handler(func=lambda m:m.text=="say meow")
def say_mewo(msg):
    bot.send_message(msg.chat.id, "meow");

i expect it to respond to incoming messages inside the chat its connected to by "business connection" like this 20240508_085512 but instead ; it responds in its own chat with user;

how do i make it respond in business connected chat?

some extra notes: +bot is has business mode support enabled +the account which bot is connected to has premium subscription +bot has the can_reply permission

Badiboy commented 6 months ago

Try to get business_connection_id from Message and use it in business_connection_id of send_message...