added logging

This commit is contained in:
bacon
2024-03-08 10:52:45 +03:00
parent fc18ade975
commit 7ad57f9fe8
7 changed files with 18 additions and 12 deletions

View File

@@ -75,7 +75,7 @@ class Admin(commands.Cog, name='Admin'):
]
)
@commands.has_permissions(administrator=True)
async def set_guest_role(self, inter, role):
async def set_guest_role(self, inter: disnake.ApplicationCommandInteraction, role):
await write_json(inter.guild.id, "guest_role", role.id)
await inter.response.send_message(f"Set up bot role to: `{role.name}`", ephemeral=True)
@@ -94,7 +94,7 @@ class Admin(commands.Cog, name='Admin'):
]
)
@commands.has_permissions(administrator=True)
async def slash_set_prefix(self, inter, prefix: str):
async def slash_set_prefix(self, inter: disnake.ApplicationCommandInteraction, prefix: str):
await write_json(inter.guild.id, "prefix", prefix)
await inter.response.send_message(f"Prefix set to: `{prefix}`", ephemeral=True)
@@ -107,7 +107,7 @@ class Admin(commands.Cog, name='Admin'):
]
)
@commands.has_permissions(administrator=True)
async def set_trigger_role(self, inter, role):
async def set_trigger_role(self, inter: disnake.ApplicationCommandInteraction, role):
await write_json(inter.guild.id, "tigger_role", role.id)
await inter.response.send_message(f"Role to trigger set to : `{role.name}`", ephemeral=True)
@@ -127,7 +127,7 @@ class Admin(commands.Cog, name='Admin'):
@set_bot_role.error
@set_trigger_role.error
@slash_set_prefix.error
async def set_prefix_error(self, inter, prefix):
async def set_prefix_error(self, inter: disnake.ApplicationCommandInteraction, prefix):
await inter.response.send_message("You don`t have permissions", ephemeral=True)
logger.error(prefix)
@@ -151,7 +151,7 @@ class Admin(commands.Cog, name='Admin'):
description="Set channel which iterate with bot",
)
async def set_bot_channel(self, inter, channel: str):
async def set_bot_channel(self, inter: disnake.ApplicationCommandInteraction, channel: str):
await write_json(inter.guild.id,
"channel",
disnake.utils.find(lambda d: d.name == channel, inter.guild.channels).id)

View File

@@ -23,7 +23,7 @@ class Audio(commands.Cog, name='Audio'):
before: VoiceState,
after: VoiceState):
if before.channel is None and not member.bot:
logger.info(f'Coneccted {member.name} to {member.voice}')
logger.info(f'Coneccted {member.name} to {after.channel.name}')
if any('Escape from Tarkov' in str(user.activity) for user in after.channel.members):
logger.info('Skip playing by Game')
else:

View File

@@ -1,5 +1,6 @@
import disnake
from disnake import Option
from disnake.ext import commands
from lib import logger
@@ -11,6 +12,12 @@ class Testing(commands.Cog, name='Testing'):
async def on_ready(self):
logger.info(f'Cog {__name__.split(".")[1]} is ready!.')
@commands.slash_command(name='play', description='play audio test from yandex.music', options=[
Option(name='search', description='seach track/artist')
])
async def play(self, inter: disnake.ApplicationCommandInteraction, audio):
pass
def setup(bot): # an extension must have a setup function
bot.add_cog(Testing(bot)) # adding a cog

View File

@@ -21,7 +21,7 @@ class General(commands.Cog):
Option("user", "Specify any user", OptionType.user),
]
)
async def info(self, inter, user=None):
async def info(self, inter: disnake.ApplicationCommandInteraction, user=None):
audio = None
user = user or inter.author
_user = DBReader(inter.guild.id)