From 2bc6ef90226885f5f1154bbb958d8aba8e7211aa Mon Sep 17 00:00:00 2001 From: Rilliat Date: Mon, 25 Aug 2025 01:50:10 +0300 Subject: [PATCH] =?UTF-8?q?refactored=20too=20many=20=D0=BE=D0=B4=D0=B8?= =?UTF-8?q?=D0=BD=D0=B0=D0=BA=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE=20=D0=B3=D0=BE?= =?UTF-8?q?=D0=B2=D0=BD=D0=BE=D0=BA=D0=BE=D0=B4=D0=B0=20=D0=BC=D0=B0=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=D0=BF=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- heroku/modules/heroku_web.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/heroku/modules/heroku_web.py b/heroku/modules/heroku_web.py index 16bb25e..31b7a94 100644 --- a/heroku/modules/heroku_web.py +++ b/heroku/modules/heroku_web.py @@ -268,9 +268,7 @@ class HerokuWebMod(loader.Module): ) return - reply_markup = [ - {"text": self.strings("enter_code"), "input": self.strings("login_code"), "handler": self.inline_code_handler, "args": (client, phone, user,)}, - ] + reply_markup = {"text": self.strings("enter_code"), "input": self.strings("login_code"), "handler": self.inline_code_handler, "args": (client, phone, user,)} await utils.answer( call, @@ -280,11 +278,12 @@ class HerokuWebMod(loader.Module): ) async def inline_code_handler(self, call, data, client, phone, user): + _code_markup = {"text": self.strings("enter_code"), "input": self.strings("login_code"), "handler": self.inline_code_handler, "args": (client, phone, user,)} if not data or len(data) != 5: await utils.answer( call, self.strings("invalid_code"), - reply_markup={"text": self.strings("enter_code"), "input": self.strings("login_code"), "handler": self.inline_code_handler, "args": (client, phone, user,)}, + reply_markup=_code_markup, always_allow=[user.id] ) return @@ -293,7 +292,7 @@ class HerokuWebMod(loader.Module): await utils.answer( call, "Код должен состоять только из цифр. Повторите попытку.", - reply_markup={"text": self.strings("enter_code"), "input": self.strings("login_code"), "handler": self.inline_code_handler, "args": (client, phone, user,)}, + reply_markup=_code_markup, always_allow=[user.id] ) return @@ -323,13 +322,10 @@ class HerokuWebMod(loader.Module): ) return except PhoneCodeInvalidError: - reply_markup = [ - {"text": self.strings("enter_code"), "input": self.strings("login_code"), "handler": self.inline_code_handler, "args": (client, phone, user,)}, - ] await utils.answer( call, self.strings("invalid_code"), - reply_markup=reply_markup, + reply_markup=_code_markup, always_allow=[user.id] ) return @@ -345,11 +341,12 @@ class HerokuWebMod(loader.Module): async def inline_2fa_handler(self, call, data, client, phone, user): + _2fa_markup = {"text": self.strings("enter_2fa"), "input": self.strings("your_2fa"), "handler": self.inline_2fa_handler, "args": (client, phone, user,)} if not data: await utils.answer( call, self.strings("invalid_password"), - reply_markup={"text": self.strings("enter_2fa"), "input": self.strings("your_2fa"), "handler": self.inline_2fa_handler, "args": (client, phone, user,)}, + reply_markup=_2fa_markup, always_allow=[user.id] ) return @@ -360,7 +357,7 @@ class HerokuWebMod(loader.Module): await utils.answer( call, self.strings("invalid_password"), - reply_markup={"text": self.strings("enter_2fa"), "input": self.strings("your_2fa"), "handler": self.inline_2fa_handler, "args": (client, phone, user,)}, + reply_markup=_2fa_markup, always_allow=[user.id] ) return