🔧 修复部分插件依赖无法找到的问题

This commit is contained in:
洛水居室 2022-07-31 16:17:27 +08:00
parent 980244a704
commit dcadbf14b1
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 15 additions and 3 deletions

View File

@ -10,6 +10,8 @@ from app.user.repositories import UserNotFoundError
from logger import Log
from plugins.base import BasePlugins
from utils.app.inject import inject
from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts
from utils.helpers import get_genshin_client, url_to_file
from utils.plugins.manager import listener_plugins_class
@ -19,7 +21,8 @@ class Abyss(BasePlugins):
"""深渊数据查询"""
@inject
def __init__(self, user_service: UserService, cookies_service: CookiesService, template_service: TemplateService):
def __init__(self, user_service: UserService = None, cookies_service: CookiesService = None,
template_service: TemplateService = None):
self.template_service = template_service
self.cookies_service = cookies_service
self.user_service = user_service
@ -87,7 +90,8 @@ class Abyss(BasePlugins):
abyss_data["most_played_list"].append(temp)
return abyss_data
@inject
@restricts
@error_callable
async def command_start(self, update: Update, context: CallbackContext) -> None:
user = update.effective_user
message = update.message

View File

@ -5,9 +5,12 @@ from genshin import Game, GenshinException, AlreadyClaimed, Client
from telegram import Update
from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, filters, CallbackContext
from app.cookies.service import CookiesService
from app.user import UserService
from app.user.repositories import UserNotFoundError
from logger import Log
from plugins.base import BasePlugins
from utils.app.inject import inject
from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts
from utils.helpers import get_genshin_client
@ -20,6 +23,11 @@ class Sign(BasePlugins):
CHECK_SERVER, COMMAND_RESULT = range(10400, 10402)
@inject
def __init__(self, user_service: UserService = None, cookies_service: CookiesService = None):
self.cookies_service = cookies_service
self.user_service = user_service
@classmethod
def create_handlers(cls):
sign = cls()