mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-16 04:45:27 +00:00
🐛 修复兼容问题
使代码兼容 `python 3.8`
This commit is contained in:
parent
d570ad9e0b
commit
fa849d3192
@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, File
|
||||
from telegram import File, InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||
from telegram.constants import ChatAction, ParseMode
|
||||
from telegram.ext import CallbackContext, ConversationHandler, filters
|
||||
from telegram.helpers import escape_markdown
|
||||
@ -119,7 +119,7 @@ class ArtifactRate(Plugin.Conversation, BasePlugin.Conversation):
|
||||
await query.edit_message_text("数据错误")
|
||||
return ConversationHandler.END
|
||||
|
||||
def get_callback_data(callback_query_data: str) -> tuple[str, int]:
|
||||
def get_callback_data(callback_query_data: str) -> Tuple[str, int]:
|
||||
_data = callback_query_data.split("|")
|
||||
_key_name = _data[1]
|
||||
try:
|
||||
|
@ -1,11 +1,12 @@
|
||||
import os
|
||||
import re
|
||||
from typing import Dict
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from pyppeteer import launch
|
||||
from telegram import Update
|
||||
from telegram.constants import ChatAction
|
||||
from telegram.ext import filters, CommandHandler, MessageHandler, CallbackContext
|
||||
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, filters
|
||||
|
||||
from core.baseplugin import BasePlugin
|
||||
from core.plugin import Plugin, handler
|
||||
@ -71,7 +72,7 @@ class Gacha(Plugin, BasePlugin):
|
||||
logger.info(f"用户 {user.full_name}[{user.id}] 抽卡模拟器命令请求 || 参数 {gacha_name}")
|
||||
# 用户数据储存和处理
|
||||
gacha_id: str = gacha_info["gacha_id"]
|
||||
user_gacha: dict[str, WishCountInfo] = context.user_data.get("gacha")
|
||||
user_gacha: Dict[str, WishCountInfo] = context.user_data.get("gacha")
|
||||
if user_gacha is None:
|
||||
user_gacha = context.user_data["gacha"] = {}
|
||||
user_gacha_count: WishCountInfo = user_gacha.get(gacha_id)
|
||||
|
@ -1,19 +1,26 @@
|
||||
from typing import Union, List, Any, Tuple
|
||||
from typing import Any, List, Tuple, Union
|
||||
|
||||
from enkanetwork import (
|
||||
EnkaNetworkAPI,
|
||||
Equipments,
|
||||
EquipmentsType,
|
||||
EquipmentsStats,
|
||||
Stats,
|
||||
CharacterInfo,
|
||||
Assets,
|
||||
DigitType, EnkaServerError, Forbidden, UIDNotFounded, VaildateUIDError, HTTPException, StatsPercentage,
|
||||
EnkaNetworkResponse, )
|
||||
CharacterInfo,
|
||||
DigitType,
|
||||
EnkaNetworkAPI,
|
||||
EnkaNetworkResponse,
|
||||
EnkaServerError,
|
||||
Equipments,
|
||||
EquipmentsStats,
|
||||
EquipmentsType,
|
||||
Forbidden,
|
||||
HTTPException,
|
||||
Stats,
|
||||
StatsPercentage,
|
||||
UIDNotFounded,
|
||||
VaildateUIDError,
|
||||
)
|
||||
from pydantic import BaseModel
|
||||
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, InputMediaPhoto
|
||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, InputMediaPhoto, Update
|
||||
from telegram.constants import ChatAction
|
||||
from telegram.ext import CommandHandler, filters, CallbackContext, MessageHandler, CallbackQueryHandler
|
||||
from telegram.ext import CallbackContext, CallbackQueryHandler, CommandHandler, MessageHandler, filters
|
||||
|
||||
from core.baseplugin import BasePlugin
|
||||
from core.plugin import Plugin, handler
|
||||
@ -87,7 +94,9 @@ class PlayerCards(Plugin, BasePlugin):
|
||||
return
|
||||
if len(args) == 1:
|
||||
character_name = roleToName(args[0])
|
||||
logger.info(f"用户 {user.full_name}[{user.id}] 角色卡片查询命令请求 || character_name[{character_name}] uid[{uid}]")
|
||||
logger.info(
|
||||
f"用户 {user.full_name}[{user.id}] 角色卡片查询命令请求 || character_name[{character_name}] uid[{uid}]"
|
||||
)
|
||||
else:
|
||||
logger.info(f"用户 {user.full_name}[{user.id}] 角色卡片查询命令请求")
|
||||
buttons = []
|
||||
@ -124,7 +133,7 @@ class PlayerCards(Plugin, BasePlugin):
|
||||
user = callback_query.from_user
|
||||
message = callback_query.message
|
||||
|
||||
async def get_player_card_callback(callback_query_data: str) -> tuple[str, int, int]:
|
||||
async def get_player_card_callback(callback_query_data: str) -> Tuple[str, int, int]:
|
||||
_data = callback_query_data.split("|")
|
||||
_user_id = int(_data[1])
|
||||
_uid = int(_data[2])
|
||||
|
Loading…
Reference in New Issue
Block a user