diff --git a/app/admin/__init__.py b/apps/admin/__init__.py similarity index 61% rename from app/admin/__init__.py rename to apps/admin/__init__.py index 9d573ca9..816679c6 100644 --- a/app/admin/__init__.py +++ b/apps/admin/__init__.py @@ -1,9 +1,9 @@ -from app.admin.cache import BotAdminCache -from app.admin.repositories import BotAdminRepository -from app.admin.service import BotAdminService -from utils.app.manager import listener_service +from utils.apps.manager import listener_service from utils.mysql import MySQL from utils.redisdb import RedisDB +from .cache import BotAdminCache +from .repositories import BotAdminRepository +from .services import BotAdminService @listener_service() diff --git a/app/admin/cache.py b/apps/admin/cache.py similarity index 100% rename from app/admin/cache.py rename to apps/admin/cache.py diff --git a/app/admin/models.py b/apps/admin/models.py similarity index 100% rename from app/admin/models.py rename to apps/admin/models.py diff --git a/app/admin/repositories.py b/apps/admin/repositories.py similarity index 100% rename from app/admin/repositories.py rename to apps/admin/repositories.py diff --git a/app/admin/service.py b/apps/admin/services.py similarity index 95% rename from app/admin/service.py rename to apps/admin/services.py index 438a5a37..c59370fb 100644 --- a/app/admin/service.py +++ b/apps/admin/services.py @@ -3,10 +3,10 @@ from typing import List from pymysql import IntegrityError from telegram import Bot -from app.admin.cache import BotAdminCache, GroupAdminCache -from app.admin.repositories import BotAdminRepository +from cache import BotAdminCache, GroupAdminCache from config import config from logger import Log +from repositories import BotAdminRepository class BotAdminService: diff --git a/app/cookies/__init__.py b/apps/cookies/__init__.py similarity index 83% rename from app/cookies/__init__.py rename to apps/cookies/__init__.py index 6fc7a63b..c526d388 100644 --- a/app/cookies/__init__.py +++ b/apps/cookies/__init__.py @@ -1,9 +1,9 @@ -from utils.app.manager import listener_service +from utils.apps.manager import listener_service from utils.mysql import MySQL from utils.redisdb import RedisDB from .cache import PublicCookiesCache from .repositories import CookiesRepository -from .service import CookiesService, PublicCookiesService +from .services import CookiesService, PublicCookiesService @listener_service() diff --git a/app/cookies/cache.py b/apps/cookies/cache.py similarity index 100% rename from app/cookies/cache.py rename to apps/cookies/cache.py diff --git a/app/cookies/error.py b/apps/cookies/error.py similarity index 100% rename from app/cookies/error.py rename to apps/cookies/error.py diff --git a/app/cookies/models.py b/apps/cookies/models.py similarity index 100% rename from app/cookies/models.py rename to apps/cookies/models.py diff --git a/app/cookies/repositories.py b/apps/cookies/repositories.py similarity index 100% rename from app/cookies/repositories.py rename to apps/cookies/repositories.py diff --git a/app/cookies/service.py b/apps/cookies/services.py similarity index 100% rename from app/cookies/service.py rename to apps/cookies/services.py diff --git a/app/game/__init__.py b/apps/game/__init__.py similarity index 59% rename from app/game/__init__.py rename to apps/game/__init__.py index 9e1a0333..08090792 100644 --- a/app/game/__init__.py +++ b/apps/game/__init__.py @@ -1,7 +1,7 @@ -from app.game.cache import GameStrategyCache -from app.game.service import GameStrategyService -from utils.app.manager import listener_service +from utils.apps.manager import listener_service from utils.redisdb import RedisDB +from .cache import GameStrategyCache +from .services import GameStrategyService @listener_service() diff --git a/app/game/cache.py b/apps/game/cache.py similarity index 100% rename from app/game/cache.py rename to apps/game/cache.py diff --git a/app/game/service.py b/apps/game/services.py similarity index 97% rename from app/game/service.py rename to apps/game/services.py index 24d9d571..0f98d0f8 100644 --- a/app/game/service.py +++ b/apps/game/services.py @@ -1,7 +1,7 @@ from typing import List, Optional -from app.game.cache import GameStrategyCache from model.apihelper.hyperion import Hyperion +from .cache import GameStrategyCache class GameStrategyService: diff --git a/app/quiz/__init__.py b/apps/quiz/__init__.py similarity index 100% rename from app/quiz/__init__.py rename to apps/quiz/__init__.py diff --git a/app/quiz/base.py b/apps/quiz/base.py similarity index 91% rename from app/quiz/base.py rename to apps/quiz/base.py index 02a9542b..516379de 100644 --- a/app/quiz/base.py +++ b/apps/quiz/base.py @@ -1,6 +1,6 @@ from typing import List -from app.quiz.models import Question, Answer +from .models import Question, Answer def CreatQuestionFromSQLData(data: tuple) -> List[Question]: diff --git a/app/quiz/cache.py b/apps/quiz/cache.py similarity index 100% rename from app/quiz/cache.py rename to apps/quiz/cache.py index d038d553..df35f082 100644 --- a/app/quiz/cache.py +++ b/apps/quiz/cache.py @@ -1,8 +1,8 @@ from typing import List import ujson - from app.quiz.models import Question, Answer + from utils.redisdb import RedisDB diff --git a/app/quiz/models.py b/apps/quiz/models.py similarity index 100% rename from app/quiz/models.py rename to apps/quiz/models.py diff --git a/app/quiz/repositories.py b/apps/quiz/repositories.py similarity index 92% rename from app/quiz/repositories.py rename to apps/quiz/repositories.py index 5b793294..59f2bca3 100644 --- a/app/quiz/repositories.py +++ b/apps/quiz/repositories.py @@ -1,7 +1,7 @@ from typing import List -from app.quiz.models import Question, Answer from utils.mysql import MySQL +from .models import Question, Answer class QuizRepository: diff --git a/app/quiz/service.py b/apps/quiz/services.py similarity index 93% rename from app/quiz/service.py rename to apps/quiz/services.py index 22a5e3d8..3e5e030d 100644 --- a/app/quiz/service.py +++ b/apps/quiz/services.py @@ -2,9 +2,9 @@ from typing import List import ujson -from app.quiz.cache import QuizCache -from app.quiz.models import Question -from app.quiz.repositories import QuizRepository +from .cache import QuizCache +from .models import Question +from .repositories import QuizRepository class QuizService: diff --git a/app/template/__init__.py b/apps/template/__init__.py similarity index 64% rename from app/template/__init__.py rename to apps/template/__init__.py index 8e2ce21f..714c0f24 100644 --- a/app/template/__init__.py +++ b/apps/template/__init__.py @@ -1,6 +1,6 @@ -from app.template.service import TemplateService from utils.aiobrowser import AioBrowser -from utils.app.manager import listener_service +from utils.apps.manager import listener_service +from .services import TemplateService @listener_service() diff --git a/app/template/service.py b/apps/template/services.py similarity index 100% rename from app/template/service.py rename to apps/template/services.py diff --git a/app/user/__init__.py b/apps/user/__init__.py similarity index 58% rename from app/user/__init__.py rename to apps/user/__init__.py index 1b5dca77..7b893be5 100644 --- a/app/user/__init__.py +++ b/apps/user/__init__.py @@ -1,7 +1,7 @@ -from app.user.repositories import UserRepository -from app.user.services import UserService -from utils.app.manager import listener_service +from utils.apps.manager import listener_service from utils.mysql import MySQL +from .repositories import UserRepository +from .services import UserService @listener_service() diff --git a/app/user/models.py b/apps/user/models.py similarity index 100% rename from app/user/models.py rename to apps/user/models.py diff --git a/app/user/repositories.py b/apps/user/repositories.py similarity index 100% rename from app/user/repositories.py rename to apps/user/repositories.py diff --git a/app/user/services.py b/apps/user/services.py similarity index 100% rename from app/user/services.py rename to apps/user/services.py diff --git a/app/wiki/__init__.py b/apps/wiki/__init__.py similarity index 59% rename from app/wiki/__init__.py rename to apps/wiki/__init__.py index 11849922..ed08a82b 100644 --- a/app/wiki/__init__.py +++ b/apps/wiki/__init__.py @@ -1,7 +1,7 @@ -from app.wiki.cache import WikiCache -from app.wiki.service import WikiService -from utils.app.manager import listener_service +from utils.apps.manager import listener_service from utils.redisdb import RedisDB +from .cache import WikiCache +from .services import WikiService @listener_service() diff --git a/app/wiki/cache.py b/apps/wiki/cache.py similarity index 100% rename from app/wiki/cache.py rename to apps/wiki/cache.py diff --git a/app/wiki/service.py b/apps/wiki/services.py similarity index 99% rename from app/wiki/service.py rename to apps/wiki/services.py index be6f92ff..85ef886d 100644 --- a/app/wiki/service.py +++ b/apps/wiki/services.py @@ -2,10 +2,10 @@ import asyncio import ujson -from app.wiki.cache import WikiCache from logger import Log from model.wiki.characters import Characters from model.wiki.weapons import Weapons +from .cache import WikiCache class WikiService: diff --git a/plugins/abyss.py b/plugins/abyss.py index 80ff78f3..0d9f3c74 100644 --- a/plugins/abyss.py +++ b/plugins/abyss.py @@ -3,13 +3,13 @@ from telegram import Update from telegram.constants import ChatAction from telegram.ext import CommandHandler, MessageHandler, filters, CallbackContext -from app.cookies.service import CookiesService -from app.template.service import TemplateService -from app.user import UserService -from app.user.repositories import UserNotFoundError +from apps.cookies.services import CookiesService +from apps.template.services import TemplateService +from apps.user import UserService +from apps.user.repositories import UserNotFoundError from logger import Log from plugins.base import BasePlugins -from utils.app.inject import inject +from utils.apps.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 diff --git a/plugins/admin.py b/plugins/admin.py index 07e5819c..71a7de21 100644 --- a/plugins/admin.py +++ b/plugins/admin.py @@ -2,9 +2,9 @@ from telegram import Update from telegram.error import BadRequest, Forbidden from telegram.ext import CallbackContext, CommandHandler -from app.admin import BotAdminService +from apps.admin import BotAdminService from logger import Log -from utils.app.inject import inject +from utils.apps.inject import inject from utils.decorators.admins import bot_admins_rights_check from utils.plugins.manager import listener_plugins_class diff --git a/plugins/base.py b/plugins/base.py index 927d87f6..5506eed3 100644 --- a/plugins/base.py +++ b/plugins/base.py @@ -5,9 +5,9 @@ from telegram import Update, ReplyKeyboardRemove from telegram.error import BadRequest from telegram.ext import CallbackContext, ConversationHandler, filters -from app.admin import BotAdminService +from apps.admin import BotAdminService from logger import Log -from utils.app.inject import inject +from utils.apps.inject import inject async def clean_message(context: CallbackContext, chat_id: int, message_id: int) -> bool: diff --git a/plugins/daily_note.py b/plugins/daily_note.py index fca622ff..0f377e77 100644 --- a/plugins/daily_note.py +++ b/plugins/daily_note.py @@ -7,13 +7,13 @@ from telegram.constants import ChatAction from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, filters, \ CallbackContext -from app.cookies.service import CookiesService -from app.template import TemplateService -from app.user import UserService -from app.user.repositories import UserNotFoundError +from apps.cookies.services import CookiesService +from apps.template.services import TemplateService +from apps.user.repositories import UserNotFoundError +from apps.user.services import UserService from logger import Log from plugins.base import BasePlugins -from utils.app.inject import inject +from utils.apps.inject import inject from utils.decorators.error import error_callable from utils.decorators.restricts import restricts from utils.helpers import get_genshin_client diff --git a/plugins/gacha/gacha.py b/plugins/gacha/gacha.py index baa8bb26..ceb309e6 100644 --- a/plugins/gacha/gacha.py +++ b/plugins/gacha/gacha.py @@ -5,12 +5,12 @@ from telegram import Update from telegram.constants import ChatAction from telegram.ext import filters, CommandHandler, MessageHandler, CallbackContext -from app.template import TemplateService +from apps.template import TemplateService from logger import Log from model.apihelper.gacha import GachaInfo from plugins.base import BasePlugins from plugins.gacha.wish import WishCountInfo, get_one -from utils.app.inject import inject +from utils.apps.inject import inject from utils.bot import get_all_args from utils.decorators.error import error_callable from utils.decorators.restricts import restricts diff --git a/plugins/help.py b/plugins/help.py index 7474973c..ad44daa3 100644 --- a/plugins/help.py +++ b/plugins/help.py @@ -3,10 +3,10 @@ from telegram.constants import ChatAction from telegram.error import BadRequest from telegram.ext import CommandHandler, CallbackContext -from app.template.service import TemplateService +from apps.template.services import TemplateService from config import config from logger import Log -from utils.app.inject import inject +from utils.apps.inject import inject from utils.decorators.error import error_callable from utils.decorators.restricts import restricts from utils.plugins.manager import listener_plugins_class diff --git a/plugins/ledger.py b/plugins/ledger.py index b44f5ac2..b4513686 100644 --- a/plugins/ledger.py +++ b/plugins/ledger.py @@ -8,13 +8,13 @@ from telegram import Update from telegram.constants import ChatAction from telegram.ext import CallbackContext, CommandHandler, MessageHandler, ConversationHandler, filters -from app.cookies import CookiesService -from app.template import TemplateService -from app.user import UserService -from app.user.repositories import UserNotFoundError +from apps.cookies.services import CookiesService +from apps.template.services import TemplateService +from apps.user.repositories import UserNotFoundError +from apps.user.services import UserService from logger import Log from plugins.base import BasePlugins -from utils.app.inject import inject +from utils.apps.inject import inject from utils.bot import get_all_args from utils.decorators.error import error_callable from utils.decorators.restricts import restricts diff --git a/plugins/sign.py b/plugins/sign.py index 2f620809..9b5b9ecd 100644 --- a/plugins/sign.py +++ b/plugins/sign.py @@ -5,12 +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 apps.cookies.services import CookiesService +from apps.user.repositories import UserNotFoundError +from apps.user.services import UserService from logger import Log from plugins.base import BasePlugins -from utils.app.inject import inject +from utils.apps.inject import inject from utils.decorators.error import error_callable from utils.decorators.restricts import restricts from utils.helpers import get_genshin_client diff --git a/plugins/strategy.py b/plugins/strategy.py index 2e430bdd..a99d8ad6 100644 --- a/plugins/strategy.py +++ b/plugins/strategy.py @@ -2,10 +2,10 @@ from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup from telegram.constants import ChatAction, ParseMode from telegram.ext import filters, ConversationHandler, CommandHandler, MessageHandler, CallbackContext -from app.game import GameStrategyService +from apps.game.services import GameStrategyService from logger import Log from plugins.base import BasePlugins -from utils.app.inject import inject +from utils.apps.inject import inject from utils.bot import get_all_args from utils.decorators.error import error_callable from utils.decorators.restricts import restricts diff --git a/plugins/uid.py b/plugins/uid.py index 51794962..e6c21439 100644 --- a/plugins/uid.py +++ b/plugins/uid.py @@ -6,13 +6,13 @@ from telegram import Update from telegram.constants import ChatAction from telegram.ext import CallbackContext, CommandHandler, MessageHandler, ConversationHandler, filters -from app.cookies.service import CookiesService -from app.template import TemplateService -from app.user import UserService -from app.user.repositories import UserNotFoundError +from apps.cookies.services import CookiesService +from apps.template.services import TemplateService +from apps.user.repositories import UserNotFoundError +from apps.user.services import UserService from logger import Log from plugins.base import BasePlugins -from utils.app.inject import inject +from utils.apps.inject import inject from utils.decorators.error import error_callable from utils.decorators.restricts import restricts from utils.helpers import url_to_file, get_genshin_client diff --git a/plugins/weapon.py b/plugins/weapon.py index 9063b081..d8bb93f8 100644 --- a/plugins/weapon.py +++ b/plugins/weapon.py @@ -2,12 +2,12 @@ from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup from telegram.constants import ChatAction from telegram.ext import filters, CommandHandler, MessageHandler, CallbackContext -from app.template import TemplateService -from app.wiki.service import WikiService +from apps.template.services import TemplateService +from apps.wiki.services import WikiService from logger import Log from metadata.shortname import weaponToName from plugins.base import BasePlugins -from utils.app.inject import inject +from utils.apps.inject import inject from utils.bot import get_all_args from utils.decorators.error import error_callable from utils.decorators.restricts import restricts diff --git a/plugins/wiki.py b/plugins/wiki.py index dafac1a7..3664cea2 100644 --- a/plugins/wiki.py +++ b/plugins/wiki.py @@ -1,9 +1,9 @@ from telegram import Update from telegram.ext import CommandHandler, CallbackContext -from app.wiki.service import WikiService +from apps.wiki.services import WikiService from plugins.base import BasePlugins -from utils.app.inject import inject +from utils.apps.inject import inject from utils.decorators.admins import bot_admins_rights_check from utils.decorators.error import error_callable from utils.plugins.manager import listener_plugins_class diff --git a/utils/app/inject.py b/utils/apps/inject.py similarity index 99% rename from utils/app/inject.py rename to utils/apps/inject.py index 8ec0537f..e471369c 100644 --- a/utils/app/inject.py +++ b/utils/apps/inject.py @@ -1,9 +1,10 @@ import inspect from functools import wraps +from utils.app.manager import ServiceDict + from logger import Log from model.types import Func -from utils.app.manager import ServiceDict def get_injections(func: Func): diff --git a/utils/app/manager.py b/utils/apps/manager.py similarity index 100% rename from utils/app/manager.py rename to utils/apps/manager.py diff --git a/utils/decorators/admins.py b/utils/decorators/admins.py index 2aff1c2c..d3aad2c6 100644 --- a/utils/decorators/admins.py +++ b/utils/decorators/admins.py @@ -1,8 +1,8 @@ from functools import wraps from typing import Callable -from app.admin import BotAdminService -from utils.app.inject import inject +from apps.admin.services import BotAdminService +from utils.apps.inject import inject def bot_admins_rights_check(func: Callable) -> Callable: diff --git a/utils/helpers.py b/utils/helpers.py index da90695a..43781bbb 100644 --- a/utils/helpers.py +++ b/utils/helpers.py @@ -8,8 +8,8 @@ import httpx from genshin import Client, types from httpx import UnsupportedProtocol -from app.cookies.service import CookiesService -from app.user import UserService +from apps.cookies.services import CookiesService +from apps.user.services import UserService from logger import Log from model.base import RegionEnum