WIP: libbot 4.0.0 adoption
This commit is contained in:
@@ -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)
|
||||
|
@@ -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(
|
||||
|
10
cogs/data.py
10
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=["Користувачі"]
|
||||
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user