Verstecke "Error while getting Updates" und Logger-Fix für Python <= 3.5
This commit is contained in:
parent
a8f267ded0
commit
d1f722ff0d
10
bot.py
10
bot.py
@ -340,6 +340,10 @@ def run_job(bot, job=None):
|
||||
check_feed(bot, key)
|
||||
|
||||
|
||||
def onerror(bot, update, error):
|
||||
logger.error(error)
|
||||
|
||||
|
||||
# Main function
|
||||
def main():
|
||||
# Setup the updater and show bot info
|
||||
@ -364,6 +368,12 @@ def main():
|
||||
for handler in handlers:
|
||||
updater.dispatcher.add_handler(handler)
|
||||
|
||||
# Hide "Error while getting Updates" because it's not our fault
|
||||
updater.logger.addFilter((lambda log: not log.msg.startswith('Error while getting Updates:')))
|
||||
|
||||
# Fix for Python <= 3.5
|
||||
updater.dispatcher.add_error_handler(onerror)
|
||||
|
||||
updater.job_queue.run_repeating(
|
||||
run_job,
|
||||
interval=60.0,
|
||||
|
Reference in New Issue
Block a user