mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 22:45:09 +01:00
update timerbot example
This commit is contained in:
parent
2875bae881
commit
8175fd7b53
1 changed files with 3 additions and 9 deletions
|
@ -18,7 +18,7 @@ Press Ctrl-C on the command line or send a signal to the process to stop the
|
|||
bot.
|
||||
"""
|
||||
|
||||
from telegram import Updater, JobQueue
|
||||
from telegram import Updater
|
||||
import logging
|
||||
|
||||
# Enable logging
|
||||
|
@ -65,8 +65,8 @@ def error(bot, update, error):
|
|||
def main():
|
||||
global job_queue
|
||||
|
||||
updater = Updater("TOKEN")
|
||||
job_queue = JobQueue(updater.bot, tick_interval=1)
|
||||
updater = Updater("148447715:AAFj2qskb3_sMMzlDhgTuoP7VAABNHpT0BU")
|
||||
job_queue = updater.job_queue
|
||||
|
||||
# Get the dispatcher to register handlers
|
||||
dp = updater.dispatcher
|
||||
|
@ -79,9 +79,6 @@ def main():
|
|||
# log all errors
|
||||
dp.addErrorHandler(error)
|
||||
|
||||
# start the job queue
|
||||
job_queue.start()
|
||||
|
||||
# Start the Bot
|
||||
updater.start_polling()
|
||||
|
||||
|
@ -90,8 +87,5 @@ def main():
|
|||
# start_polling() is non-blocking and will stop the bot gracefully.
|
||||
updater.idle()
|
||||
|
||||
# After that, also stop the job queue
|
||||
job_queue.stop()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue