Search code examples
pythonpython-decoratorspyrogram

Invert the action of an decorator in python


I'm working on Program, api application to python of telegram, in version 2, filter edited has replaced with a decorator of his own, @clinet.on_edited_message, the problem is that I want to invert is action, and get only not edited messages, with filter is easy, add ~ in the beginning, but how do I do that in a decorator? thanks


Solution

  • As the Release Notes for Version 2 describe, @app.on_edited_message() only filters edited messages. If you want non-edited messages, use @app.on_message() instead.