diff --git a/classes/holo_user.py b/classes/holo_user.py index 3c72daf..0488bee 100644 --- a/classes/holo_user.py +++ b/classes/holo_user.py @@ -3,7 +3,7 @@ from typing import Any, Union, Dict from bson import ObjectId from discord import User, Member -from libbot import config_get +from libbot.utils import config_get from errors import UserNotFoundError from modules.database import col_warnings, sync_col_users, sync_col_warnings, col_users diff --git a/cogs/admin.py b/cogs/admin.py index d305ff7..50f9866 100644 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -13,8 +13,7 @@ from discord import ( ) from discord import utils as ds_utils from discord.ext import commands -from libbot import config_get -from libbot.sync import config_get as sync_config_get +from libbot.utils import config_get from classes.holo_bot import HoloBot from enums import Color @@ -117,7 +116,7 @@ class Admin(commands.Cog): @slash_command( name="clear", description="Видалити деяку кількість повідомлень в каналі", - guild_ids=[sync_config_get("guild")], + guild_ids=[config_get("guild")], ) @option("amount", description="Кількість") @option("user", description="Користувач", default=None) @@ -182,7 +181,7 @@ class Admin(commands.Cog): @slash_command( name="reboot", description="Перезапустити бота", - guild_ids=[sync_config_get("guild")], + guild_ids=[config_get("guild")], ) async def reboot_cmd(self, ctx: ApplicationContext) -> None: await ctx.defer(ephemeral=True) diff --git a/cogs/custom_channels.py b/cogs/custom_channels.py index 56746c6..a8e5d66 100644 --- a/cogs/custom_channels.py +++ b/cogs/custom_channels.py @@ -6,8 +6,7 @@ from discord import utils as ds_utils from discord.abc import GuildChannel from discord.commands import SlashCommandGroup from discord.ext import commands -from libbot import config_get -from libbot.sync import config_get as sync_config_get +from libbot.utils import config_get from classes.holo_bot import HoloBot from classes.holo_user import HoloUser @@ -35,7 +34,7 @@ class CustomChannels(commands.Cog): @custom_channel_group.command( name="get", description="Отримати персональний текстовий канал", - guild_ids=[sync_config_get("guild")], + guild_ids=[config_get("guild")], ) @option("name", description="Назва каналу") @option("reactions", description="Дозволити реакції") @@ -122,7 +121,7 @@ class CustomChannels(commands.Cog): @custom_channel_group.command( name="edit", description="Змінити параметри особистого каналу", - guild_ids=[sync_config_get("guild")], + guild_ids=[config_get("guild")], ) @option("name", description="Назва каналу") @option("reactions", description="Дозволити реакції") @@ -167,7 +166,7 @@ class CustomChannels(commands.Cog): @custom_channel_group.command( name="remove", description="Відібрати канал, знищуючи його, та частково повернути кошти", - guild_ids=[sync_config_get("guild")], + guild_ids=[config_get("guild")], ) @option("confirm", description="Підтвердження операції") async def custom_channel_remove_cmd( diff --git a/cogs/data.py b/cogs/data.py index e5a68f2..f2c8d84 100644 --- a/cogs/data.py +++ b/cogs/data.py @@ -9,9 +9,7 @@ from discord import ApplicationContext, Embed, File, option, Role, TextChannel from discord import utils as ds_utils from discord.commands import SlashCommandGroup from discord.ext import commands -from libbot import config_get -from libbot.sync import config_get as sync_config_get -from libbot.sync import json_write as sync_json_write +from libbot.utils import config_get, json_write from classes.holo_bot import HoloBot from classes.holo_user import HoloUser @@ -31,7 +29,7 @@ class Data(commands.Cog): @data.command( name="export", description="Експортувати дані", - guild_ids=[sync_config_get("guild")], + guild_ids=[config_get("guild")], ) @option( "kind", description="Тип даних, які треба експортувати", choices=["Користувачі"] @@ -94,14 +92,14 @@ class Data(commands.Cog): } ) - sync_json_write(users, Path(f"tmp/{uuid}")) + json_write(users, Path(f"tmp/{uuid}")) await ctx.respond(file=File(Path(f"tmp/{uuid}"), filename="users.json")) @data.command( name="migrate", description="Мігрувати всіх користувачів до бази", - guild_ids=[sync_config_get("guild")], + guild_ids=[config_get("guild")], ) @option( "kind", description="Тип даних, які треба експортувати", choices=["Користувачі"] diff --git a/cogs/fun.py b/cogs/fun.py index f317114..98ff382 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -2,8 +2,7 @@ import logging from discord import ApplicationContext, Embed, User, option, slash_command from discord.ext import commands -from libbot import config_get -from libbot.sync import config_get as sync_config_get +from libbot.utils import config_get from classes.holo_bot import HoloBot from modules.utils_sync import guild_name @@ -19,12 +18,12 @@ class Fun(commands.Cog): @slash_command( name="action", description="Провести над користувачем РП дію", - guild_ids=[sync_config_get("guild")], + guild_ids=[config_get("guild")], ) @option( "type", description="Тип дії, яку хочете провести з користувачем", - choices=sync_config_get("actions").keys(), + choices=config_get("actions").keys(), ) @option("user", description="Користувач") async def action_cmd(self, ctx: ApplicationContext, type: str, user: User) -> None: diff --git a/cogs/logger.py b/cogs/logger.py index c6fabbf..b80eec3 100644 --- a/cogs/logger.py +++ b/cogs/logger.py @@ -3,7 +3,7 @@ from typing import Dict, Any, Union from discord import Member, Message, TextChannel from discord import utils as ds_utils from discord.ext import commands -from libbot import config_get +from libbot.utils import config_get from classes.holo_bot import HoloBot from modules.database import col_users diff --git a/cogs/utility.py b/cogs/utility.py index a454392..3cab98c 100644 --- a/cogs/utility.py +++ b/cogs/utility.py @@ -3,7 +3,7 @@ from logging import Logger from discord import Activity, ActivityType from discord.ext import commands -from libbot import config_get +from libbot.utils import config_get from classes.holo_bot import HoloBot diff --git a/main.py b/main.py index 5beb79d..6a1a038 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ from logging import Logger from pathlib import Path from discord import LoginFailure, Intents -from libbot.sync import config_get as sync_config_get +from libbot.utils import config_get from classes.holo_bot import HoloBot from modules.scheduler import scheduler @@ -38,7 +38,7 @@ def main() -> None: client.load_extension("cogs") try: - client.run(sync_config_get("bot_token", "bot")) + client.run(config_get("bot_token", "bot")) except LoginFailure as exc: logger.error("Provided bot token is invalid: %s", exc) except KeyboardInterrupt: diff --git a/modules/database.py b/modules/database.py index 8d2d0ae..f78d61a 100644 --- a/modules/database.py +++ b/modules/database.py @@ -1,12 +1,12 @@ from typing import Dict, Any from async_pymongo import AsyncClient, AsyncCollection, AsyncDatabase -from libbot.sync import config_get as sync_config_get +from libbot.utils import config_get from pymongo import MongoClient from pymongo.synchronous.collection import Collection from pymongo.synchronous.database import Database -db_config: Dict[str, Any] = sync_config_get("database") +db_config: Dict[str, Any] = config_get("database") con_string: str = ( "mongodb://{0}:{1}/{2}".format( diff --git a/requirements.txt b/requirements.txt index d3ef55d..cdebadf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,6 @@ requests>=2.32.2 aiofiles~=24.1.0 apscheduler>=3.10.0 async_pymongo==0.1.11 -libbot[speed,pycord]==3.3.1 +libbot[speed,pycord]==4.0.0 ujson~=5.10.0 WaifuPicsPython==0.2.0 \ No newline at end of file