forwardgram icon indicating copy to clipboard operation
forwardgram copied to clipboard

Unify the message before sending out

Open kenmaxnejp opened this issue 4 years ago • 4 comments

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!

kenmaxnejp avatar Nov 26 '19 17:11 kenmaxnejp

RE are the answer.

JuanMiguelPR avatar Nov 26 '19 17:11 JuanMiguelPR

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)

kenmaxnejp avatar Nov 27 '19 23:11 kenmaxnejp

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

BilboSwiss avatar Mar 03 '20 18:03 BilboSwiss

@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.

csulit avatar Jun 03 '22 19:06 csulit