voidbar / forwardgram

Forward messages from multiple Telegram channels to one of your own!
153 stars 185 forks source link

Unify the message before sending out #9

Open kenmaxnejp opened 4 years ago

kenmaxnejp commented 4 years ago

Hi, thanks for providing this great script. Idon't want to forward all messages, just want to forward some messages with keyword "EURUSD" or "USDJPY", and because different channels has their own way to present the same thing, I have to unify the format before sending out. For example I got a message from channel A: Sell EURUSD stoploss 1.123 takeprofit 1.223 And I got a message with different format from channel B: SELL USDJPY STOPLOSS: 1.111 TAKEPROFIT 1.333 And I need to send the following message to the channel: Sell EURUSD with stoploss at 1.123 and takeprofit at 1.223 Sell USDJPY with stoploss at 1.111 and takeprofit at 1.333 Where should I edit the code? Many thanks!

JuanMiguelPR commented 4 years ago

RE are the answer.

kenmaxnejp commented 4 years ago

Hi jmgv098, Thanks. Actually I am new for Python, I guess I should use RE to modify either this line: @client.on(events.NewMessage(chats=input_channels_entities)) Or this line? await client.forward_messages(output_channel_entity, event.message)

BilboSwiss commented 4 years ago

Hi did you found a solution to edit the message? I need this also for editing Signals to send it to my Metatrader! Regards

csulit commented 2 years ago

@kenmaxnejp I found a solution use this await client.send_message(output_channel, message=event.message.raw_text) you can manipulate the raw_text provided by event.message and re-assign to another variable if you will transform the text.