1

I receive a message with any new updates but I would like to receive one for a specific channel.


@app.on_message(Filters.chat("mychannel"))
def from_pyrogramchat(client, message):
   print("New message in @mychannel")

https://github.com/pyrogram/pyrogram

thanks!

Tibebes. M
  • 6,940
  • 5
  • 15
  • 36
holly
  • 43
  • 8
  • 1
    well. that's the correct filter and it should work. could it be the case that you have another handler and that's getting triggered - not this one? – Tibebes. M Jun 04 '20 at 22:11
  • i dont think so? because if I change from (Filters.chat("mychannel")) to (Filters.channel) it works ...works for all channels tho obv – holly Jun 04 '20 at 23:22

1 Answers1

0

you can create a new Filter that filters message from a particular channel

@Client.on_message(Filters.channel & Filters.create(lambda c,m: m.chat.id == -1001234567890))
async def foo(c, m):
    print(m)

reference - pyrogram doc

Alen Paul Varghese
  • 1,278
  • 14
  • 27