mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge pull request #1839 from coder2020official/master
Fix bug with asyncwebhooks
This commit is contained in:
commit
625ae09573
@ -540,7 +540,7 @@ class TeleBot:
|
|||||||
from telebot.ext.sync import SyncWebhookListener
|
from telebot.ext.sync import SyncWebhookListener
|
||||||
except (NameError, ImportError):
|
except (NameError, ImportError):
|
||||||
raise ImportError("Please install uvicorn and fastapi in order to use `run_webhooks` method.")
|
raise ImportError("Please install uvicorn and fastapi in order to use `run_webhooks` method.")
|
||||||
self.webhook_listener = SyncWebhookListener(self, secret_token, listen, port, ssl_context, '/'+url_path)
|
self.webhook_listener = SyncWebhookListener(bot=self, secret_token=secret_token, host=listen, port=port, ssl_context=ssl_context, url_path='/'+url_path)
|
||||||
self.webhook_listener.run_app()
|
self.webhook_listener.run_app()
|
||||||
|
|
||||||
|
|
||||||
|
@ -2116,7 +2116,7 @@ class AsyncTeleBot:
|
|||||||
from telebot.ext.aio import AsyncWebhookListener
|
from telebot.ext.aio import AsyncWebhookListener
|
||||||
except (NameError, ImportError):
|
except (NameError, ImportError):
|
||||||
raise ImportError("Please install uvicorn and fastapi in order to use `run_webhooks` method.")
|
raise ImportError("Please install uvicorn and fastapi in order to use `run_webhooks` method.")
|
||||||
self.webhook_listener = AsyncWebhookListener(self, secret_token, listen, port, ssl_context, '/'+url_path, debug)
|
self.webhook_listener = AsyncWebhookListener(bot=self, secret_token=secret_token, host=listen, port=port, ssl_context=ssl_context, url_path='/'+url_path)
|
||||||
await self.webhook_listener.run_app()
|
await self.webhook_listener.run_app()
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ from typing import Optional
|
|||||||
|
|
||||||
class AsyncWebhookListener:
|
class AsyncWebhookListener:
|
||||||
def __init__(self, bot,
|
def __init__(self, bot,
|
||||||
secret_token: str, host: Optional[str]="127.0.0.1",
|
secret_token: str,
|
||||||
|
host: Optional[str]="127.0.0.1",
|
||||||
port: Optional[int]=443,
|
port: Optional[int]=443,
|
||||||
ssl_context: Optional[tuple]=None,
|
ssl_context: Optional[tuple]=None,
|
||||||
url_path: Optional[str]=None,
|
url_path: Optional[str]=None,
|
||||||
|
@ -21,7 +21,8 @@ from typing import Optional
|
|||||||
|
|
||||||
class SyncWebhookListener:
|
class SyncWebhookListener:
|
||||||
def __init__(self, bot,
|
def __init__(self, bot,
|
||||||
secret_token: str, host: Optional[str]="127.0.0.1",
|
secret_token: str,
|
||||||
|
host: Optional[str]="127.0.0.1",
|
||||||
port: Optional[int]=443,
|
port: Optional[int]=443,
|
||||||
ssl_context: Optional[tuple]=None,
|
ssl_context: Optional[tuple]=None,
|
||||||
url_path: Optional[str]=None,
|
url_path: Optional[str]=None,
|
||||||
|
Loading…
Reference in New Issue
Block a user