Okteto fixes

pull/1/head
hikari.ftg 2022-04-07 16:41:15 +00:00
parent f19c40bbef
commit 817eda537b
3 changed files with 11 additions and 8 deletions

View File

@ -28,12 +28,12 @@ class HelpMod(loader.Module):
"single_mod_header": "📼 <b>{}</b>:", "single_mod_header": "📼 <b>{}</b>:",
"single_cmd": "\n▫️ <code>{}{}</code> 👉🏻 ", "single_cmd": "\n▫️ <code>{}{}</code> 👉🏻 ",
"undoc_cmd": "🦥 No docs", "undoc_cmd": "🦥 No docs",
"all_header": "👓 <b>{} mods available, {} hidden:</b>", "all_header": "🌘 <b>{} mods available, {} hidden:</b>",
"mod_tmpl": "\n{} <code>{}</code>", "mod_tmpl": "\n{} <code>{}</code>",
"first_cmd_tmpl": ": ( {}", "first_cmd_tmpl": ": ( {}",
"cmd_tmpl": " | {}", "cmd_tmpl": " | {}",
"no_mod": "🚫 <b>Specify module to hide</b>", "no_mod": "🚫 <b>Specify module to hide</b>",
"hidden_shown": "🌘 <b>{} modules hidden, {} module shown:</b>\n{}\n{}", "hidden_shown": "🌘 <b>{} modules hidden, {} modules shown:</b>\n{}\n{}",
"ihandler": "\n🎹 <code>{}</code> 👉🏻 ", "ihandler": "\n🎹 <code>{}</code> 👉🏻 ",
"undoc_ihandler": "🦥 No docs", "undoc_ihandler": "🦥 No docs",
"joined": "🌘 <b>Joined the</b> <a href='https://t.me/hikka_talks'>support chat</a>", "joined": "🌘 <b>Joined the</b> <a href='https://t.me/hikka_talks'>support chat</a>",

View File

@ -48,11 +48,11 @@ class OktetoMod(loader.Module):
"""Creates queue to Webpage bot to reset Okteto polling after app goes to sleep""" """Creates queue to Webpage bot to reset Okteto polling after app goes to sleep"""
while True: while True:
try: try:
if "OKTETO_URI" not in os.environ: if not self._db.get("hikka", "okteto_uri", False):
await asyncio.sleep(self._env_wait_interval) await asyncio.sleep(self._env_wait_interval)
continue continue
uri = os.environ["OKTETO_URI"] uri = self._db.get("hikka", "okteto_uri")
current_queue = ( current_queue = (
await self._client( await self._client(
GetScheduledHistoryRequest( GetScheduledHistoryRequest(
@ -87,8 +87,8 @@ class OktetoMod(loader.Module):
async def watcher(self, message: Message) -> None: async def watcher(self, message: Message) -> None:
if ( if (
not getattr(message, "raw_text", False) not getattr(message, "raw_text", False)
or "OKTETO_URI" not in os.environ or not self._db.get("hikka", "okteto_uri", False)
or os.environ["OKTETO_URI"] not in message.raw_text or self._db.get("hikka", "okteto_uri") not in message.raw_text
and "Link previews was updated successfully" not in message.raw_text and "Link previews was updated successfully" not in message.raw_text
or utils.get_chat_id(message) != 169642392 or utils.get_chat_id(message) != 169642392
): ):

View File

@ -153,11 +153,14 @@ class Web:
return web.Response() return web.Response()
async def okteto(self, request): async def okteto(self, request):
if "OKTETO_URI" in os.environ: if any(cl[2].get("hikka", "okteto_uri", False) for cl in self.client_data.values()):
return web.Response(status=418) return web.Response(status=418)
text = await request.text() text = await request.text()
os.environ["OKTETO_URI"] = text
for client_uid in self.client_data:
self.client_data[client_uid][2].set("hikka", "okteto_uri", text)
return web.Response(body="URI_SAVED") return web.Response(body="URI_SAVED")
async def tg_code(self, request): async def tg_code(self, request):