Created
January 31, 2020 18:33
-
-
Save amiryousefi/2c83874c188e1cf3a68c3acb7f94bcc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TodoistBot: | |
# all other functions | |
# . | |
# . | |
# . | |
# handler for buttons | |
def button(self, bot, update): | |
query = update.callback_query | |
# general handler for messages | |
def general_handler(self, bot, update): | |
chat_id = update.message.chat_id | |
text = update.message.text | |
def main(self): | |
updater = self.updater | |
dp = updater.dispatcher | |
# Add command handlers | |
dp.add_handler(CommandHandler('projects', self.projects)) | |
# other commands will goes here | |
# Add callback handlers for buttons | |
updater.dispatcher.add_handler(CallbackQueryHandler(self.button)) | |
# general message handler | |
updater.dispatcher.add_handler(MessageHandler(Filters.all, self.general_handler)) | |
updater.start_polling() | |
updater.idle() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment