Skip to content

Add new parameter getupdates_error_handler to Bot.run function#112

Open
kian-ahmadian wants to merge 4 commits into
masterfrom
dev
Open

Add new parameter getupdates_error_handler to Bot.run function#112
kian-ahmadian wants to merge 4 commits into
masterfrom
dev

Conversation

@kian-ahmadian

@kian-ahmadian kian-ahmadian commented Jul 7, 2024

Copy link
Copy Markdown
Member
  • Add new parameter getupdates_error_handler to Bot.run function
  • Add explanation for checking update_id
  • Modify the return value of the function default_getupdates_error_handler so that the updater continues.
  • Update docs

@kian-ahmadian kian-ahmadian self-assigned this Jul 7, 2024
@kian-ahmadian kian-ahmadian added bale bug 🐛 Something isn't working (for bale servers) updater section PRs related to the updater section. labels Jul 7, 2024
@kian-ahmadian kian-ahmadian requested a review from codaliza July 7, 2024 12:34
@kian-ahmadian kian-ahmadian changed the title Add new parameter getupdates_error_handler to Bot.run function Add new parameter getupdates_error_handler to Bot.run function Jul 7, 2024
Comment thread bale/_bot.py
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)

Undefined variable 'getupdates_error_handler' (undefined-variable)
Comment thread bale/_updater.py
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

Missing function docstring
Comment thread bale/_updater.py
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

Missing method docstring
Comment thread bale/_updater.py

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)

Line too long (104/100)
Comment thread bale/_updater.py
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)

Line too long (128/100)
Comment thread bale/_updater.py

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)

Line too long (104/100)
Comment thread bale/_updater.py
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)

Line too long (128/100)
Comment thread bale/_updater.py
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

Missing function or method docstring
Comment thread bale/_bot.py
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)

Line too long (112/100)
Comment thread bale/_bot.py
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'

Undefined variable 'getupdates_error_handler'
@kian-ahmadian kian-ahmadian linked an issue Jul 7, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bale bug 🐛 Something isn't working (for bale servers) updater section PRs related to the updater section.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add new parameter getupdates_error_handler to Bot.run function موقف شدن بات بعد از چند روز !

3 participants