refractor lib code

This commit is contained in:
2022-08-22 03:23:25 +03:00
parent e1b782c2cb
commit 89707a7e9a
4 changed files with 16 additions and 14 deletions

View File

@@ -4,7 +4,7 @@ import disnake
from disnake import Option, OptionType, Colour
from disnake.ext import commands
from lib.Comands import read_json, set_prefix, write_json
from lib.Comands import read_json, write_json
from lib.DB import fill_bd, prepare_db, work_with_db, read_db
@@ -106,7 +106,7 @@ class General(commands.Cog):
@commands.command(name="set_prefix")
@commands.has_permissions(administrator=True)
async def command_set_prefix(self, ctx, prefix: str):
await set_prefix(ctx.guild.id, prefix)
await write_json(ctx.guild.id, "prefix", prefix)
await ctx.reply(f"Prefix set to: `{prefix}`")
@commands.guild_only()
@@ -119,7 +119,7 @@ class General(commands.Cog):
)
@commands.has_permissions(administrator=True)
async def slash_set_prefix(self, inter, prefix: str):
await set_prefix(inter.guild.id, prefix)
await write_json(inter.guild.id, "prefix", prefix)
await inter.response.send_message(f"Prefix set to: `{prefix}`", ephemeral=True)
@commands.guild_only()
@@ -152,7 +152,7 @@ class General(commands.Cog):
@set_trigger_role.error
@slash_set_prefix.error
async def set_prefix_error(self, inter, prefix):
await inter.response.send_message('You don`t have permissions', ephemeral=True)
await inter.response.send_message("You don`t have permissions", ephemeral=True)
def setup(bot): # an extension must have a setup function