Updated localization and moved some commands

This commit is contained in:
bacon
2024-03-09 18:54:26 +03:00
parent 3bd30239ae
commit 01db1c254d
9 changed files with 89 additions and 82 deletions

22
bot.py
View File

@@ -6,7 +6,7 @@ import disnake
from dotenv import load_dotenv
from disnake import OptionType, Option, Localized
from disnake.ext import commands
from __init__ import version_info as ver, __version__
from __init__ import __version__
from lib.CogsPrep import work_with_cogs, cog_list
from lib.Comands import determine_prefix
from lib.Logger import logger
@@ -44,15 +44,15 @@ async def on_ready():
logger.info('Bot started')
logger.info(f'Disnake version {disnake.__version__}')
logger.info(f'We have logged in as {bot.user}')
logger.info(f'Version of bot is - v{__version__}-{ver.releaselevel}')
logger.info(f'Version of bot is - v{__version__}')
@bot.slash_command(
name="cog",
name='cog',
options=[
Option(
'cog',
description="specify cog",
name=Localized('cog', key="COG".lower()),
description=Localized("cog file", key="COG_FILE"),
type=OptionType.string
)
]
@@ -69,7 +69,7 @@ async def slash_cogs(inter: disnake.ApplicationCommandInteraction):
pass
@slash_cogs.sub_command(description=Localized("Enables Cog", key="ENABLES_COG"))
@slash_cogs.sub_command(description=Localized("Enables Cog", key="ENABLE_COG"))
async def enable(inter: disnake.ApplicationCommandInteraction, cog: str):
"""
@@ -82,7 +82,7 @@ async def enable(inter: disnake.ApplicationCommandInteraction, cog: str):
await inter.response.send_message(f'Cog {cog} is enabled', ephemeral=True)
@slash_cogs.sub_command(description='Disables Cog')
@slash_cogs.sub_command(description=Localized("Disables Cog", key="DISABLE_COG"))
async def disable(inter: disnake.ApplicationCommandInteraction, cog: str):
"""
@@ -95,7 +95,7 @@ async def disable(inter: disnake.ApplicationCommandInteraction, cog: str):
await inter.response.send_message(f'Cog {cog} is disabled', ephemeral=True)
@slash_cogs.sub_command(description='Loads Cog')
@slash_cogs.sub_command(description=Localized("Loads Cog", key="LOAD_COG"))
async def load(inter: disnake.ApplicationCommandInteraction, cog: str):
"""
@@ -108,7 +108,7 @@ async def load(inter: disnake.ApplicationCommandInteraction, cog: str):
await inter.response.send_message(f'Cog {cog} is loaded', ephemeral=True)
@slash_cogs.sub_command(description='Unloads Cog')
@slash_cogs.sub_command(description=Localized("Unload Cog", key="UNLOAD_COG"))
async def unload(inter: disnake.ApplicationCommandInteraction, cog: str):
"""
@@ -121,7 +121,7 @@ async def unload(inter: disnake.ApplicationCommandInteraction, cog: str):
await inter.response.send_message(f'Cog {cog} is unload', ephemeral=True)
@slash_cogs.sub_command(description='Reloads Cog')
@slash_cogs.sub_command(description=Localized("Reloads Cog", key="RELOAD_COG"))
async def reload(inter: disnake.ApplicationCommandInteraction, cog: str):
"""
@@ -154,7 +154,7 @@ async def _cog_opt(inter: disnake.ApplicationCommandInteraction, current: str):
@slash_cogs.error
async def cogs_error(inter: disnake.ApplicationCommandInteraction):
await inter.response.send_message('Error', ephemeral=True)
await inter.response.send_message(Localized("Error", key="EROR"), ephemeral=True)
logger.error(f'User {inter.author} tries to use cogs func')