diff --git a/apps/wiki/services.py b/apps/wiki/services.py index 42bfa9b..911ef68 100644 --- a/apps/wiki/services.py +++ b/apps/wiki/services.py @@ -12,9 +12,7 @@ class WikiService: def __init__(self, cache: WikiCache): self._cache = cache - """ - Redis 在这里的作用是作为持久化 - """ + """Redis 在这里的作用是作为持久化""" self.weapons = Weapons() self.characters = Characters() self._characters_list = [] diff --git a/jobs/sign.py b/jobs/sign.py index fe2fd4e..5bc0f83 100644 --- a/jobs/sign.py +++ b/jobs/sign.py @@ -79,20 +79,20 @@ class SignJob: text = "签到失败了呜呜呜 ~ 服务器连接超时 服务器熟啦 ~ " sign_db.status = SignStatusEnum.TIMEOUT_ERROR except BaseException as exc: - Log.error(f"执行自动签到时发生错误", exc) + Log.error(f"执行自动签到时发生错误 用户UID[{user_id}]", exc) continue if sign_db.chat_id < 0: text = f"NOTICE {sign_db.user_id}\n\n{text}" try: await context.bot.send_message(sign_db.chat_id, text, parse_mode=ParseMode.HTML) except BadRequest as exc: - Log.error(f"执行自动签到时发生错误", exc) + Log.error(f"执行自动签到时发生错误 用户UID[{user_id}]", exc) sign_db.status = SignStatusEnum.BAD_REQUEST except Forbidden as exc: - Log.error(f"执行自动签到时发生错误", exc) + Log.error(f"执行自动签到时发生错误 用户UID[{user_id}]", exc) sign_db.status = SignStatusEnum.FORBIDDEN except BaseException as exc: - Log.error(f"执行自动签到时发生错误", exc) + Log.error(f"执行自动签到时发生错误 用户UID[{user_id}]", exc) continue sign_db.time_updated = datetime.datetime.now() await self.sign_service.update(sign_db) diff --git a/models/apihelper/playercards.py b/models/apihelper/playercards.py index 10782ce..27d3886 100644 --- a/models/apihelper/playercards.py +++ b/models/apihelper/playercards.py @@ -146,7 +146,7 @@ class PlayerCardsAPI: consts = characters_data["Consts"] if 'talentIdList' in avatar_data: talent_id_list = avatar_data["talentIdList"] - for index, value in enumerate(talent_id_list): + for index, _ in enumerate(talent_id_list): talent_list.append(Talent(talent_id_list[index], icon=consts[index])) element = characters_data["Element"] diff --git a/models/gacha/banner.py b/models/gacha/banner.py deleted file mode 100644 index 159c65e..0000000 --- a/models/gacha/banner.py +++ /dev/null @@ -1,67 +0,0 @@ -from enum import Enum - -from models.gacha.common import ItemParamData - - -class BannerType(Enum): - STANDARD = 1 - EVENT = 2 - WEAPON = 3 - - -class GachaBanner: - def __init__(self): - self.gachaType: int = 0 - self.scheduleId: int = 0 - self.prefabPath: str = "" - self.previewPrefabPath: str = "" - self.titlePath: str = "" - self.costItemId = 0 - self.costItemAmount = 1 - self.costItemId10 = 0 - self.costItemAmount10 = 10 - self.beginTime: int = 0 - self.endTime: int = 0 - self.sortId: int = 0 - self.rateUpItems4 = {} - self.rateUpItems5 = {} - self.fallbackItems3 = {11301, 11302, 11306, 12301, 12302, 12305, 13303, 14301, 14302, 14304, 15301, 15302, - 15304} - self.fallbackItems4Pool1 = {1014, 1020, 1023, 1024, 1025, 1027, 1031, 1032, 1034, 1036, 1039, 1043, 1044, 1045, - 1048, 1053, 1055, 1056, 1064} - self.fallbackItems4Pool2 = {11401, 11402, 11403, 11405, 12401, 12402, 12403, 12405, 13401, 13407, 14401, 14402, - 14403, 14409, 15401, 15402, 15403, 15405} - self.fallbackItems5Pool1 = {1003, 1016, 1042, 1035, 1041} - self.fallbackItems5Pool2 = {11501, 11502, 12501, 12502, 13502, 13505, 14501, 14502, 15501, 15502} - self.removeC6FromPool = False - self.autoStripRateUpFromFallback = True - self.weights4 = {{1, 510}, {8, 510}, {10, 10000}} - self.weights5 = {{1, 75}, {73, 150}, {90, 10000}} - self.poolBalanceWeights4 = {{1, 255}, {17, 255}, {21, 10455}} - self.poolBalanceWeights5 = {{1, 30}, {147, 150}, {181, 10230}} - self.eventChance4 = 50 - self.eventChance5 = 50 - self.bannerType = BannerType.STANDARD - self.rateUpItems1 = {} - self.rateUpItems2 = {} - self.eventChance = -1 - self.costItem = 0 - - def getGachaType(self): - return self.gachaType - - def getCost(self, numRolls: int): - """ - 获取消耗的Item - :param numRolls: - :return: - """ - if numRolls == 1: - return ItemParamData() - elif numRolls == 10: - return ItemParamData(self.costItemId10 if self.costItemId10 > 0 else self.getCostItem(), - self.costItemAmount10) - return ItemParamData() - - def getCostItem(self): - return self.costItem if self.costItem > 0 else self.costItemId diff --git a/models/gacha/common.py b/models/gacha/common.py deleted file mode 100644 index a52af7e..0000000 --- a/models/gacha/common.py +++ /dev/null @@ -1,4 +0,0 @@ -class ItemParamData: - def __init__(self, item_id: int = 0, count: int = 0): - self.id: int = item_id - self.count: int = count diff --git a/models/gacha/manager.py b/models/gacha/manager.py deleted file mode 100644 index d14c10e..0000000 --- a/models/gacha/manager.py +++ /dev/null @@ -1,7 +0,0 @@ -class GachaManager: - - def __init__(self): - pass - - def DoPulls(self, player_id: int, gacha_type: int, times: int): - pass diff --git a/plugins/errorhandler.py b/plugins/errorhandler.py index cc5e57d..1718056 100644 --- a/plugins/errorhandler.py +++ b/plugins/errorhandler.py @@ -19,10 +19,8 @@ except KeyError as error: async def error_handler(update: object, context: CallbackContext) -> None: - """ - 记录错误并发送消息通知开发人员。 - Log the error and send a telegram message to notify the developer. - """ + """记录错误并发送消息通知开发人员。 Log the error and send a telegram message to notify the developer.""" + Log.error(msg="处理函数时发生异常:", exc_info=context.error) if notice_chat_id is None: diff --git a/plugins/post.py b/plugins/post.py index ea87024..a6e4f7b 100644 --- a/plugins/post.py +++ b/plugins/post.py @@ -73,9 +73,9 @@ class Post(BasePlugins): if post_handler_data is None: post_handler_data = PostHandlerData() context.chat_data["post_handler_data"] = post_handler_data - text = "✿✿ヽ(°▽°)ノ✿ 你好! %s ,\n" \ + text = f"✿✿ヽ(°▽°)ノ✿ 你好! {user.username} ,\n" \ "只需复制URL回复即可 \n" \ - "退出投稿只需回复退出" % (user["username"]) + "退出投稿只需回复退出" reply_keyboard = [['退出']] await message.reply_text(text, reply_markup=ReplyKeyboardMarkup(reply_keyboard, True, True)) return self.CHECK_POST diff --git a/utils/helpers.py b/utils/helpers.py index 77a243f..21b56e8 100644 --- a/utils/helpers.py +++ b/utils/helpers.py @@ -84,7 +84,7 @@ def region_server(uid: Union[int, str]) -> RegionEnum: elif isinstance(uid, str): region = REGION_MAP.get(str(uid)[0]) else: - raise TypeError(f"UID variable type error") + raise TypeError("UID variable type error") if region: return region else: