Вот сама ошибка
Ignoring exception in slash command 'mute':
Traceback (most recent call last):
File "C:\Users\Artem\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 681, in invoke
await call_param_func(self.callback, inter, self.cog, kwargs)
File "C:\Users\Artem\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\params.py", line 827, in call_param_func
return await maybe_coroutine(safe_call, function, kwargs)
File "C:\Users\Artem\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\utils.py", line 580, in maybe_coroutine
return await value
File "c:\VirenBot Discord\dsbot.py", line 277, in mute
if member == inter.message.author:
AttributeError: 'ApplicationCommandInteraction' object has no attribute 'message'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Artem\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\interaction_bot_base.py", line 1262, in process_application_commands
await app_command.invoke(interaction)
File "C:\Users\Artem\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 690, in invoke
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'ApplicationCommandInteraction' object has no attribute 'message'
Вот код
# Мут
def to_time(string):
date_types = {
"s": 1,
"m": 60,
"h": 60*60,
"d": 60*60*24,
"w": 60*60*24*7,
"M": 60*60*24*30,
"y": 60*60*24*365,
}
letter = string[-1]
if letter not in date_types:
return
try:
i = int(string[:-1])
return i * date_types[letter]
except Exception:
return
@bot.slash_command(description="Выдать мут пользователю")
@commands.has_permissions(administrator=True)
async def mute(inter: disnake.CommandInteraction, member: disnake.Member = None, time: str = None, reason='Не указана'):
if member == inter.message.author:
await inter.response.send_message('Вы не можете замутить сами себя.')
else:
if time is None:
await inter.response.send_message(f"{inter.author.mention}, укажите время на сколько вы хотите выдать мут человеку!")
else:
await member.timeout(duration=to_time(time))
mute2 = disnake.Embed(title = f"Мут", description=f"**Привет **{member.mention}** тебе выдали мут на сервере: **{inter.guild.name}** \n\nАдминистратор = {inter.author.mention}\n\nПричина = {reason}*n\nМинут = {time}**")
await member.send(embed = mute2)
mute1 = disnake.Embed(title = f"Мут", description=f"**Мут был выдан = {member.mention}\n\nАдминистратор = {inter.author.mention}\n\nПричина = **{reason}\n\n**Минут = **{time}")
await inter.response.send_message(embed = mute1)