Skip to content

Instantly share code, notes, and snippets.

@agasiev
Created March 28, 2018 12:56
Show Gist options
  • Save agasiev/a1845e1cd71993b5693e9e778fae8137 to your computer and use it in GitHub Desktop.
Save agasiev/a1845e1cd71993b5693e9e778fae8137 to your computer and use it in GitHub Desktop.
class ButtonFilter(BaseFilter):
def __init__(self, __texts, __button_name):
super().__init__()
self._texts = __texts
self._button_name = __button_name
def filter(self, message):
try:
return message.text.strip().lower() == self._texts.get(self._button_name).strip().lower()
except Exception as e:
print("ButtonFilter except:", e)
logger.exception("ButtonHandler exc")
logger.exception(e)
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment