code cleanup

This commit is contained in:
bacon
2024-03-08 11:50:31 +03:00
parent 3cea8ca2a9
commit 961b260887
6 changed files with 19 additions and 73 deletions

View File

@@ -32,12 +32,12 @@ class Audio(commands.Cog, name='Audio'):
_role = await read_json(member.guild.id, 'tigger_role')
# Read audio from DB
audio_db = await read_db(member.guild.id, member.id, 'defaulttracks')
audio: list = []
if audio_db is not None:
audio = audio_db.split(', ')
else:
from lib.Comands import list_files
audio = await list_files()
for _a in ListGenerator('audio'):
audio.append(_a.name)
if audio_db is not None:
logger.info('Play audio from DB')

View File

@@ -5,7 +5,7 @@ import psutil
from disnake.ext import commands
from __init__ import version_info as ver
from lib import determine_prefix, determine_time
from lib import determine_prefix
from lib import logger
@@ -19,7 +19,7 @@ class BotInfo(commands.Cog, name='Bot Info'):
@commands.slash_command(name="info_bot",
description='Shows general info about bot') # this is for making a command
async def info_bot(self, inter):
async def info_bot(self, inter: disnake.ApplicationCommandInteraction):
_pid = os.getpid()
_process = psutil.Process(_pid)
emb = disnake.Embed(
@@ -31,11 +31,10 @@ class BotInfo(commands.Cog, name='Bot Info'):
f"CPU Usage: {_process.cpu_percent()}%\n"
f'Bot ping: {round(self.bot.latency * 1000)}\n'
f'Prefix: `{determine_prefix(self.bot, inter)}\n`'
f"Max audio duration: {determine_time(inter)} sec\n"
)
emb.add_field(name="Bot info:", value="Bot owner: <@386629192743256065>\n"
f"Bot version: {ver.major}.{ver.minor}.{ver.micro}-{ver.releaselevel}")
emb.set_footer(text="Information requested by: {}".format(inter.author.display_name))
emb.set_footer(text=f"Information requested by: {inter.author.display_name}")
await inter.response.send_message(embed=emb, ephemeral=True)