-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new parameter getupdates_error_handler
to Bot.run function
#112
base: master
Are you sure you want to change the base?
Conversation
getupdates_error_handler
to Bot.run function
@@ -2309,7 +2311,7 @@ | |||
if updater := self._updater: | |||
startup_functions.append(self.get_me) | |||
startup_functions.append(updater.setup) | |||
operation_coroutine.append(updater.start_polling()) | |||
operation_coroutine.append(updater.start_polling(getupdates_error_handler=getupdates_error_handler)) |
Check warning
Code scanning / Prospector (reported by Codacy)
Undefined variable 'getupdates_error_handler' (undefined-variable) Warning
await self.bot.update_queue.put(update) | ||
self._last_offset = updates[-1].update_id | ||
|
||
return True | ||
|
||
def getupdates_error(exc: Any) -> bool: | ||
def default_getupdates_error_handler(exc: Any) -> bool: |
Check warning
Code scanning / Pylint (reported by Codacy)
Missing function docstring Warning
@@ -60,7 +61,7 @@ | |||
|
|||
self.__stop_worker_event = asyncio.Event() | |||
|
|||
async def start_polling(self): | |||
async def start_polling(self, getupdates_error_handler: Callable[[Any], bool] = None): |
Check warning
Code scanning / Pylint (reported by Codacy)
Missing method docstring Warning
@@ -110,11 +114,15 @@ | |||
try: | |||
work_task = asyncio.create_task(work_coroutine()) | |||
|
|||
done = (await asyncio.wait([work_task, wait_stop_task], return_when=asyncio.FIRST_COMPLETED))[0] | |||
done = ( | |||
await asyncio.wait([work_task, wait_stop_task], return_when=asyncio.FIRST_COMPLETED) |
Check warning
Code scanning / Pylint (reported by Codacy)
Line too long (104/100) Warning
if not self.current_offset or update.update_id > self.current_offset: | ||
if ( | ||
not self.current_offset or | ||
update.update_id > self.current_offset # This is due to a bug sometimes caused by the Bale servers. |
Check warning
Code scanning / Pylint (reported by Codacy)
Line too long (128/100) Warning
@@ -110,11 +114,15 @@ | |||
try: | |||
work_task = asyncio.create_task(work_coroutine()) | |||
|
|||
done = (await asyncio.wait([work_task, wait_stop_task], return_when=asyncio.FIRST_COMPLETED))[0] | |||
done = ( | |||
await asyncio.wait([work_task, wait_stop_task], return_when=asyncio.FIRST_COMPLETED) |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Line too long (104/100) Warning
if not self.current_offset or update.update_id > self.current_offset: | ||
if ( | ||
not self.current_offset or | ||
update.update_id > self.current_offset # This is due to a bug sometimes caused by the Bale servers. |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Line too long (128/100) Warning
@@ -60,7 +61,7 @@ | |||
|
|||
self.__stop_worker_event = asyncio.Event() | |||
|
|||
async def start_polling(self): | |||
async def start_polling(self, getupdates_error_handler: Callable[[Any], bool] = None): |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Missing function or method docstring Warning
@@ -2309,7 +2311,7 @@ | |||
if updater := self._updater: | |||
startup_functions.append(self.get_me) | |||
startup_functions.append(updater.setup) | |||
operation_coroutine.append(updater.start_polling()) | |||
operation_coroutine.append(updater.start_polling(getupdates_error_handler=getupdates_error_handler)) |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Line too long (112/100) Warning
@@ -2309,7 +2311,7 @@ | |||
if updater := self._updater: | |||
startup_functions.append(self.get_me) | |||
startup_functions.append(updater.setup) | |||
operation_coroutine.append(updater.start_polling()) | |||
operation_coroutine.append(updater.start_polling(getupdates_error_handler=getupdates_error_handler)) |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Undefined variable 'getupdates_error_handler' Warning
…dler` so that the updater continues.
getupdates_error_handler
to Bot.run functionupdate_id
default_getupdates_error_handler
so that the updater continues.