From 9b5f16d0c44b4df95c797d203363b00b2f9441b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Tue, 28 Jun 2022 23:44:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9D=97=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/game/weapon.py | 3 +-- plugins/errorhandler.py | 4 ++-- plugins/post.py | 3 ++- service/gacha.py | 2 +- service/game.py | 2 +- test/service/test_game.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/model/game/weapon.py b/model/game/weapon.py index a616aa47..4bc4ad93 100644 --- a/model/game/weapon.py +++ b/model/game/weapon.py @@ -6,8 +6,7 @@ from model.baseobject import BaseObject class WeaponInfo(BaseObject): - """ - 武器信息 + """武器信息 """ def __init__(self, item_id: int = 0, name: str = "", level: int = 0, main_item: Optional[GameItem] = None, diff --git a/plugins/errorhandler.py b/plugins/errorhandler.py index 1a0460b1..4507b543 100644 --- a/plugins/errorhandler.py +++ b/plugins/errorhandler.py @@ -7,10 +7,9 @@ import ujson from aiohttp import ClientConnectorError from genshin import InvalidCookies, GenshinException, TooManyRequests from httpx import ConnectTimeout -from pyrogram.errors import Forbidden from telegram import Update, ReplyKeyboardRemove from telegram.constants import ParseMode -from telegram.error import BadRequest, TimedOut +from telegram.error import BadRequest, TimedOut, Forbidden from telegram.ext import CallbackContext, ConversationHandler from config import config @@ -47,6 +46,7 @@ async def send_user_notification(update: Update, _: CallbackContext, text: str): def conversation_error_handler(func: Callable) -> Callable: """Conversation的错误处理修饰器 + 非常感谢 @Bibo-Joshi 提出的建议 """ diff --git a/plugins/post.py b/plugins/post.py index 03bc6442..88762d25 100644 --- a/plugins/post.py +++ b/plugins/post.py @@ -10,7 +10,8 @@ from telegram.helpers import escape_markdown from config import config from logger import Log from manager import listener_plugins_class -from model.apihelper import Hyperion, ArtworkImage +from model.apihelper.base import ArtworkImage +from model.apihelper.hyperion import Hyperion from plugins.base import BasePlugins from plugins.errorhandler import conversation_error_handler from service import BaseService diff --git a/service/gacha.py b/service/gacha.py index 246281e0..8bf407b4 100644 --- a/service/gacha.py +++ b/service/gacha.py @@ -1,4 +1,4 @@ -from model.apihelper import GachaInfo +from model.apihelper.gacha import GachaInfo from service.cache import RedisCache from service.repository import AsyncRepository diff --git a/service/game.py b/service/game.py index 56bd4e4b..076a2517 100644 --- a/service/game.py +++ b/service/game.py @@ -1,4 +1,4 @@ -from model.apihelper import Hyperion +from model.apihelper.hyperion import Hyperion from service.cache import RedisCache from service.repository import AsyncRepository diff --git a/test/service/test_game.py b/test/service/test_game.py index ef3d2378..64b755bd 100644 --- a/test/service/test_game.py +++ b/test/service/test_game.py @@ -1,7 +1,7 @@ import unittest from unittest import IsolatedAsyncioTestCase -from model.apihelper import Hyperion +from model.apihelper.hyperion import Hyperion class TestGame(IsolatedAsyncioTestCase):