mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-10 20:12:52 +01:00
Corrected trailing whitespaces
This commit is contained in:
parent
be368f7d74
commit
ed6dd76ae8
1 changed files with 9 additions and 9 deletions
|
@ -37,9 +37,9 @@ class BotEventHandler:
|
||||||
commands and even arbitrary types.
|
commands and even arbitrary types.
|
||||||
|
|
||||||
Polling as well as webhook are supported.
|
Polling as well as webhook are supported.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
token (str): The bots token given by the @BotFather
|
token (str): The bots token given by the @BotFather
|
||||||
base_url (Optional[str]):
|
base_url (Optional[str]):
|
||||||
|
@ -48,7 +48,7 @@ class BotEventHandler:
|
||||||
workers (Optional[int]): Amount of threads in the thread pool for
|
workers (Optional[int]): Amount of threads in the thread pool for
|
||||||
functions decorated with @run_async
|
functions decorated with @run_async
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, token, base_url=None, broadcaster=None, workers=4):
|
def __init__(self, token, base_url=None, broadcaster=None, workers=4):
|
||||||
self.bot = Bot(token, base_url)
|
self.bot = Bot(token, base_url)
|
||||||
self.last_update_id = 0
|
self.last_update_id = 0
|
||||||
|
@ -66,10 +66,10 @@ class BotEventHandler:
|
||||||
|
|
||||||
def start_polling(self, poll_interval=1.0, timeout=10, network_delay=2):
|
def start_polling(self, poll_interval=1.0, timeout=10, network_delay=2):
|
||||||
"""
|
"""
|
||||||
Starts polling updates from Telegram.
|
Starts polling updates from Telegram.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
poll_interval (Optional[float]): Time to wait between polling
|
poll_interval (Optional[float]): Time to wait between polling
|
||||||
updates from Telegram in seconds. Default is 1.0
|
updates from Telegram in seconds. Default is 1.0
|
||||||
timeout (Optional[float]): Passed to Bot.getUpdates
|
timeout (Optional[float]): Passed to Bot.getUpdates
|
||||||
network_delay (Optional[float]): Passed to Bot.getUpdates
|
network_delay (Optional[float]): Passed to Bot.getUpdates
|
||||||
|
@ -87,11 +87,11 @@ class BotEventHandler:
|
||||||
network_delay))
|
network_delay))
|
||||||
|
|
||||||
self.running = True
|
self.running = True
|
||||||
|
|
||||||
# Start threads
|
# Start threads
|
||||||
broadcaster_thread.start()
|
broadcaster_thread.start()
|
||||||
event_handler_thread.start()
|
event_handler_thread.start()
|
||||||
|
|
||||||
# Return the update queue so the main thread can insert updates
|
# Return the update queue so the main thread can insert updates
|
||||||
return self.update_queue
|
return self.update_queue
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ class BotEventHandler:
|
||||||
self.update_queue.put(update)
|
self.update_queue.put(update)
|
||||||
self.last_update_id = update.update_id + 1
|
self.last_update_id = update.update_id + 1
|
||||||
current_interval = poll_interval
|
current_interval = poll_interval
|
||||||
|
|
||||||
sleep(current_interval)
|
sleep(current_interval)
|
||||||
except TelegramError as te:
|
except TelegramError as te:
|
||||||
# Put the error into the update queue and let the Broadcaster
|
# Put the error into the update queue and let the Broadcaster
|
||||||
|
|
Loading…
Reference in a new issue