Working on #13
This commit is contained in:
16
cogs/data.py
16
cogs/data.py
@@ -7,13 +7,15 @@ from discord import ApplicationContext, Embed, File, option
|
||||
from discord import utils as ds_utils
|
||||
from discord.commands import SlashCommandGroup
|
||||
from discord.ext import commands
|
||||
from libbot import config_get
|
||||
from libbot.pycord.classes import PycordBot
|
||||
from libbot.sync import config_get as sync_config_get
|
||||
from libbot.sync import json_write as sync_json_write
|
||||
|
||||
from classes.holo_user import HoloUser
|
||||
from enums.colors import Color
|
||||
from modules.database import col_users
|
||||
from modules.utils import config_get
|
||||
from modules.utils_sync import config_get_sync, guild_name, json_write_sync
|
||||
from modules.utils_sync import guild_name
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -27,7 +29,7 @@ class Data(commands.Cog):
|
||||
@data.command(
|
||||
name="export",
|
||||
description="Експортувати дані",
|
||||
guild_ids=[config_get_sync("guild")],
|
||||
guild_ids=[sync_config_get("guild")],
|
||||
)
|
||||
@option(
|
||||
"kind", description="Тип даних, які треба експортувати", choices=["Користувачі"]
|
||||
@@ -91,16 +93,14 @@ class Data(commands.Cog):
|
||||
}
|
||||
)
|
||||
|
||||
json_write_sync(users, str(Path(f"tmp/{uuid}")))
|
||||
sync_json_write(users, Path(f"tmp/{uuid}"))
|
||||
|
||||
await ctx.respond(
|
||||
file=File(str(Path(f"tmp/{uuid}")), filename="users.json")
|
||||
)
|
||||
await ctx.respond(file=File(Path(f"tmp/{uuid}"), filename="users.json"))
|
||||
|
||||
@data.command(
|
||||
name="migrate",
|
||||
description="Мігрувати всіх користувачів до бази",
|
||||
guild_ids=[config_get_sync("guild")],
|
||||
guild_ids=[sync_config_get("guild")],
|
||||
)
|
||||
@option(
|
||||
"kind", description="Тип даних, які треба експортувати", choices=["Користувачі"]
|
||||
|
Reference in New Issue
Block a user