Runs bot in long-polling mode in a main loop. This allows the bot to retrieve Updates automagically and notify listeners and message handlers accordingly. Warning: Do not call this function more than once! Always gets updates. .. note:: Instal
(self, non_stop: bool=True, skip_pending=False, interval: int=0, timeout: int=20,
request_timeout: Optional[int]=None, allowed_updates: Optional[List[str]]=None,
none_stop: Optional[bool]=None, restart_on_change: Optional[bool]=False, path_to_watch: Optional[str]=None)
| 270 | self.event_observer.start() |
| 271 | |
| 272 | async def polling(self, non_stop: bool=True, skip_pending=False, interval: int=0, timeout: int=20, |
| 273 | request_timeout: Optional[int]=None, allowed_updates: Optional[List[str]]=None, |
| 274 | none_stop: Optional[bool]=None, restart_on_change: Optional[bool]=False, path_to_watch: Optional[str]=None): |
| 275 | """ |
| 276 | Runs bot in long-polling mode in a main loop. |
| 277 | This allows the bot to retrieve Updates automagically and notify listeners and message handlers accordingly. |
| 278 | |
| 279 | Warning: Do not call this function more than once! |
| 280 | |
| 281 | Always gets updates. |
| 282 | |
| 283 | .. note:: |
| 284 | |
| 285 | Install watchdog and psutil before using restart_on_change option. |
| 286 | |
| 287 | :param non_stop: Do not stop polling when an ApiException occurs. |
| 288 | :type non_stop: :obj:`bool` |
| 289 | |
| 290 | :param skip_pending: skip old updates |
| 291 | :type skip_pending: :obj:`bool` |
| 292 | |
| 293 | :param interval: Delay between two update retrivals |
| 294 | :type interval: :obj:`int` |
| 295 | |
| 296 | :param timeout: Request connection timeout |
| 297 | :type timeout: :obj:`int` |
| 298 | |
| 299 | :param request_timeout: Timeout in seconds for get_updates(Defaults to None) |
| 300 | :type request_timeout: :obj:`int` |
| 301 | |
| 302 | :param allowed_updates: A list of the update types you want your bot to receive. |
| 303 | For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. |
| 304 | See util.update_types for a complete list of available update types. |
| 305 | Specify an empty list to receive all update types except chat_member (default). |
| 306 | If not specified, the previous setting will be used. |
| 307 | |
| 308 | Please note that this parameter doesn't affect updates created before the call to the get_updates, |
| 309 | so unwanted updates may be received for a short period of time. |
| 310 | :type allowed_updates: :obj:`list` of :obj:`str` |
| 311 | |
| 312 | :param none_stop: Deprecated, use non_stop. Old typo, kept for backward compatibility. |
| 313 | :type none_stop: :obj:`bool` |
| 314 | |
| 315 | :param restart_on_change: Restart a file on file(s) change. Defaults to False. |
| 316 | :type restart_on_change: :obj:`bool` |
| 317 | |
| 318 | :param path_to_watch: Path to watch for changes. Defaults to current directory |
| 319 | :type path_to_watch: :obj:`str` |
| 320 | |
| 321 | :return: |
| 322 | """ |
| 323 | if none_stop is not None: |
| 324 | logger.warning('The parameter "none_stop" is deprecated. Use "non_stop" instead.') |
| 325 | non_stop = none_stop |
| 326 | |
| 327 | if skip_pending: |
| 328 | await self.skip_updates() |
| 329 |
nothing calls this directly
no test coverage detected