1

This is a continuation of this short forum (How forward message to other contact with telethon).

Problem

I replaced entity with the group id for GC A and it works since I type something in GC B the bot forwards it to GC A however, when I message GC A the bot still forwards the messages to GC A which I don't want, I just want it to not react.

await client.forward_messages(entity, event.message)

The bot forwards every new message because the event type is new messages so I was thinking, is there a way to filter it so that it only triggers when there are new messages on a specific group?

@client.on(events.NewMessage)
async def main(event):

Solutions Ive tried

Looking at the documentation (https://docs.telethon.dev/en/latest/modules/client.html#telethon.client.messages.MessageMethods.forward_messages) there is an example with the argument "from_chat". So I placed the group id of GC B but it doesn't work.

await client.forward_messages(chat, message_id, from_chat)

I also tried making the argument look like this to copy the examples better but It does not work

await client.forward_messages(entity("group ID"), event.message, from_chat("group_id"))

1 Answers1

0

For me worked this code:

@client.on(events.NewMessage(chats = FROM_CHANNEL_ID))
async def main(event):
await event.forward_to(TO_CHAT_ID)

Try it, may it will work for you to.

PRIHLOP
  • 1,441
  • 1
  • 16
  • 16