Reputation: 129
I'm new using python and telegram-bot
I'm trying to found a way to send messages using python-telegram-bot when I received a message without uses:
requests.post(
'https://api.telegram.org/bot<token>/sendMessage?chat_id=<id>&text=Hello World!')
Flow:
Message arrived on channel A then send a new message to channel B (Message receveid on Channel A).
I only found reply_text. Is there other way to do it ?
Thanks !
Upvotes: 0
Views: 4147
Reputation: 9619
reply_text
won't work because it will send the message back to channel A. You would need bot.send_message where you can set the target channel with chat_id
. A simple example:
def update_message_to_channel_B(update: object, context: CallbackContext) -> None:
context.bot.send_message(chat_id=CHANNEL_B_ID, text='Message receveid on Channel A')
And add the handler:
dispatcher.add_handler(MessageHandler(Filters.text, update_message_to_channel_B))
Upvotes: 1