mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Disabled long polling. There's now a 5 seconds delay between each check
This commit is contained in:
parent
c8eae01878
commit
4caaea2dc3
1 changed files with 4 additions and 3 deletions
|
@ -40,8 +40,8 @@ class Bot:
|
||||||
for u in self.updates:
|
for u in self.updates:
|
||||||
loop.create_task(self.parse_update(u))
|
loop.create_task(self.parse_update(u))
|
||||||
self.updates = list()
|
self.updates = list()
|
||||||
# Wait 1 second between two requests, allowing the parsing of updates.
|
# Wait 5 seconds between two requests, allowing the parsing of updates.
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(5)
|
||||||
|
|
||||||
async def update_bot_data(self):
|
async def update_bot_data(self):
|
||||||
"""Update self.user_data with the latest information from /getMe."""
|
"""Update self.user_data with the latest information from /getMe."""
|
||||||
|
@ -51,7 +51,8 @@ class Bot:
|
||||||
async def get_updates(self):
|
async def get_updates(self):
|
||||||
"""Get the latest updates from the Telegram API with /getUpdates."""
|
"""Get the latest updates from the Telegram API with /getUpdates."""
|
||||||
try:
|
try:
|
||||||
data = await self.api_request("getUpdates", offset=self.offset, timeout=300)
|
# TODO: Fix long polling
|
||||||
|
data = await self.api_request("getUpdates", offset=self.offset)
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
return
|
return
|
||||||
for update in data:
|
for update in data:
|
||||||
|
|
Loading…
Reference in a new issue