Update `cache_time` in native query answers so they are not cached anymore

pull/1/head
Hikari 2022-04-14 17:56:50 +00:00
parent c98a9f610b
commit c6b03249e8
No known key found for this signature in database
GPG Key ID: 5FA52ACBB2AD964D
2 changed files with 7 additions and 2 deletions

View File

@ -92,6 +92,7 @@ class Events(InlineUnit):
for res in result
):
logger.error("Got invalid type from inline handler. Refer to docs for more info") # fmt: skip
await instance.e500()
return
inline_result = []
@ -179,7 +180,7 @@ class Events(InlineUnit):
]
try:
await inline_query.answer(inline_result)
await inline_query.answer(inline_result, cache_time=0)
except Exception:
logger.exception(f"Exception when answering inline query with result from {cmd}") # fmt: skip
return

View File

@ -42,13 +42,15 @@ class HikkaDLMod(loader.Module):
strings = {"name": "HikkaDL"}
_connected = False
async def _wss(self) -> None:
async with websockets.connect("wss://hikka.hikariatama.ru/ws") as wss:
await wss.send(self.get("token"))
while True:
ans = json.loads(await wss.recv())
logger.debug(ans)
self._connected = True
if ans["event"] == "dlmod":
try:
msg = (
@ -100,9 +102,11 @@ class HikkaDLMod(loader.Module):
await self._wss()
except websockets.exceptions.ConnectionClosedError:
logger.debug("Token became invalid, revoking...")
self._connected = False
await self._get_token()
except Exception:
logger.debug("Socket disconnected, retry in 10 sec")
self._connected = False
await asyncio.sleep(10)