Deepsource fixes

pull/1/head
hikari.ftg 2022-03-28 11:06:47 +00:00
parent 3089669a1e
commit ef864a25ec
5 changed files with 19 additions and 17 deletions

View File

@ -32,7 +32,7 @@ class BotInteractions(InlineUnit):
return self.fsm.get(str(user), False) return self.fsm.get(str(user), False)
async def _bot_message_answer( async def _bot_message_answer( # skipcq: PYL-E0213
mod, mod,
text: str = None, text: str = None,
message: AiogramMessage = None, message: AiogramMessage = None,

View File

@ -11,16 +11,14 @@
# 🌐 https://www.gnu.org/licenses/agpl-3.0.html # 🌐 https://www.gnu.org/licenses/agpl-3.0.html
from aiogram import Bot, Dispatcher from aiogram import Bot, Dispatcher
from aiogram.utils.exceptions import Unauthorized, TerminatedByOtherGetUpdates
import time import time
import asyncio import asyncio
from telethon.errors.rpcerrorlist import InputUserDeactivatedError from telethon.errors.rpcerrorlist import InputUserDeactivatedError
from telethon.utils import get_display_name from telethon.utils import get_display_name
from aiogram.utils.exceptions import Unauthorized, TerminatedByOtherGetUpdates
from .gallery import Gallery from .gallery import Gallery
from .form import Form from .form import Form
from .bot_interaction import BotInteractions from .bot_interaction import BotInteractions

View File

@ -37,12 +37,12 @@ class TokenObtainment(InlineUnit):
uid = utils.rand(6) uid = utils.rand(6)
username = f"hikka_{uid}_bot" username = f"hikka_{uid}_bot"
for msg in { for msg in [
f"👩‍🎤 Hikka Userbot of {self._name}", f"👩‍🎤 Hikka Userbot of {self._name}",
username, username,
"/setuserpic", "/setuserpic",
username, username,
}: ]:
m = await conv.send_message(msg) m = await conv.send_message(msg)
r = await conv.get_response() r = await conv.get_response()
@ -154,7 +154,7 @@ class TokenObtainment(InlineUnit):
# Enable inline mode or change its # Enable inline mode or change its
# placeholder in case it is not set # placeholder in case it is not set
for msg in { for msg in [
"/setinline", "/setinline",
button.text, button.text,
"HikkaQuery", "HikkaQuery",
@ -163,7 +163,7 @@ class TokenObtainment(InlineUnit):
"Enabled", "Enabled",
"/setuserpic", "/setuserpic",
button.text, button.text,
}: ]:
m = await conv.send_message(msg) m = await conv.send_message(msg)
r = await conv.get_response() r = await conv.get_response()

View File

@ -2,6 +2,7 @@ from aiogram.types import Message as AiogramMessage, InlineQuery as AiogramInlin
class InlineCall: class InlineCall:
"""Modified version of original Aiogram CallbackQuery"""
def __init__(self): def __init__(self):
self.delete = None self.delete = None
self.unload = None self.unload = None
@ -10,16 +11,19 @@ class InlineCall:
class InlineUnit: class InlineUnit:
"""InlineManager extension type. For internal use only"""
def __init__(self): def __init__(self):
pass """Made just for type specification"""
class BotMessage(AiogramMessage): class BotMessage(AiogramMessage):
"""Modified version of original Aiogram Message"""
def __init__(self): def __init__(self):
super().__init__() super().__init__()
class InlineQuery: class InlineQuery:
"""Modified version of original Aiogram InlineQuery"""
def __init__(self, inline_query: AiogramInlineQuery) -> None: def __init__(self, inline_query: AiogramInlineQuery) -> None:
self.inline_query = inline_query self.inline_query = inline_query

View File

@ -82,7 +82,7 @@ function finish_login() {
credentials: "include" credentials: "include"
}) })
.then(response => response.text()) .then(response => response.text())
.then(function (response) { .then((response) => {
window.expanse = true; window.expanse = true;
if(response == "0") { if(response == "0") {
setTimeout(() => { setTimeout(() => {
@ -97,7 +97,7 @@ function finish_login() {
window.location.href = "/"; window.location.href = "/";
}, response == "0" ? 10000 : 1500); }, response == "0" ? 10000 : 1500);
}) })
.catch(function () { .catch(() => {
error_state(); error_state();
error_message("Login confirmation error"); error_message("Login confirmation error");
}); });
@ -108,7 +108,7 @@ function tg_code() {
method: "POST", method: "POST",
body: `${_tg_pass}\n${_phone}\n${_2fa_pass}` body: `${_tg_pass}\n${_phone}\n${_2fa_pass}`
}) })
.then(function (response) { .then((response) => {
if (!response.ok) { if (!response.ok) {
if (response.status == 403) { if (response.status == 403) {
error_state(); error_state();
@ -186,7 +186,7 @@ function process_next() {
return; return;
} }
_api_id = parseInt(api_id); _api_id = parseInt(api_id, 10);
switch_block("api_hash"); switch_block("api_hash");
return; return;
@ -206,7 +206,7 @@ function process_next() {
body: _api_hash + _api_id, body: _api_hash + _api_id,
credentials: "include" credentials: "include"
}) })
.then(function (response) { .then((response) => {
if (!response.ok) { if (!response.ok) {
error_state(); error_state();
error_message("Error occured while saving credentials") error_message("Error occured while saving credentials")
@ -214,7 +214,7 @@ function process_next() {
switch_block("phone"); switch_block("phone");
} }
}) })
.catch(function () { .catch(() => {
error_state(); error_state();
error_message("Error occured while saving credentials") error_message("Error occured while saving credentials")
}); });
@ -235,7 +235,7 @@ function process_next() {
body: _phone, body: _phone,
credentials: "include" credentials: "include"
}) })
.then(function (response) { .then((response) => {
if (!response.ok) { if (!response.ok) {
error_state(); error_state();
error_message("Code send failed"); error_message("Code send failed");
@ -257,7 +257,7 @@ function process_next() {
}) })
} }
}) })
.catch(function () { .catch(() => {
error_state(); error_state();
error_message("Code send failed"); error_message("Code send failed");
}); });