some code changes
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import logging
|
||||
from asyncio import sleep
|
||||
|
||||
import disnake
|
||||
@@ -6,8 +5,9 @@ from disnake import Option, OptionType
|
||||
|
||||
from disnake.ext import commands, tasks
|
||||
|
||||
from lib.Comands import read_json, write_json
|
||||
from lib.DB import fill_bd, prepare_db, work_with_db
|
||||
from lib import read_json, write_json
|
||||
from lib import fill_bd, prepare_db, work_with_db
|
||||
from lib import logger
|
||||
|
||||
|
||||
class Admin(commands.Cog, name='Admin'):
|
||||
@@ -22,7 +22,7 @@ class Admin(commands.Cog, name='Admin'):
|
||||
await fill_bd(g.name, g.id, g.bot, g.nick, g.guild.id)
|
||||
|
||||
self.activity.start()
|
||||
logging.info(f'Cog {__name__.split(".")[1]} is ready!.')
|
||||
logger.info(f'Cog {__name__.split(".")[1]} is ready!.')
|
||||
|
||||
@tasks.loop(seconds=20)
|
||||
async def activity(self):
|
||||
@@ -63,7 +63,7 @@ class Admin(commands.Cog, name='Admin'):
|
||||
role = disnake.utils.get(member.guild.roles, id=guest_role)
|
||||
else:
|
||||
role = disnake.utils.get(member.guild.roles, id=bot_role)
|
||||
logging.info(f"Adding to {member} role {role}")
|
||||
logger.info(f"Adding to {member} role {role}")
|
||||
await member.add_roles(role)
|
||||
|
||||
@commands.slash_command(
|
||||
@@ -137,7 +137,9 @@ class Admin(commands.Cog, name='Admin'):
|
||||
Option("seconds", "specify max duration", OptionType.integer, required=True),
|
||||
]
|
||||
)
|
||||
async def set_time(self, inter, seconds: commands.Range[5, 30]):
|
||||
async def set_time(self,
|
||||
inter: disnake.ApplicationCommandInteraction,
|
||||
seconds: commands.Range[5, 30]):
|
||||
await write_json(inter.guild.id, "seconds", seconds)
|
||||
await inter.response.send_message(f"Change max audio duration to {seconds} sec", ephemeral=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user