diff --git a/.gitignore b/.gitignore index 6057905..bb05035 100755 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /venv/ /fun_and_admin_bot.egg-info/ /qodana.yaml +/.YMcache/ diff --git a/bot.py b/bot.py index a359118..ab11c40 100755 --- a/bot.py +++ b/bot.py @@ -74,7 +74,7 @@ async def _cog_opt(inter: disnake.ApplicationCommandInteraction, current: str, w @slash_cogs.error -async def cogs_error(inter, what_do): +async def cogs_error(inter: disnake.ApplicationCommandInteraction, what_do): await inter.response.send_message('Error', ephemeral=True) logger.error(f'User {inter.author} tries to use cogs func\n{what_do}\n') diff --git a/cogs/admin.py b/cogs/admin.py index 3c40696..e51ca5f 100644 --- a/cogs/admin.py +++ b/cogs/admin.py @@ -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) diff --git a/cogs/audio.py b/cogs/audio.py index 96a7b19..2569e4b 100644 --- a/cogs/audio.py +++ b/cogs/audio.py @@ -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: diff --git a/cogs/disabled/test.py b/cogs/disabled/test.py index 240ed3c..9959c02 100644 --- a/cogs/disabled/test.py +++ b/cogs/disabled/test.py @@ -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 diff --git a/cogs/general.py b/cogs/general.py index ea295d2..9e36b4a 100644 --- a/cogs/general.py +++ b/cogs/general.py @@ -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) diff --git a/requirements.txt b/requirements.txt index f2d3cdd..ff6e58f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ disnake[audio] psutil -pymediainfo -pyNaCl python-dotenv -ffmpeg-python \ No newline at end of file +setuptools \ No newline at end of file