@commands.slash_command(name="mute", description="Замьютить пользователя")
@commands.has_permissions(mute_members=True)
async def mute(self, inter, member, duration = "Навсегда", reason: str = "Не указана"):
time_converter = {
"d": 86400,
"h": 3600,
"m": 60,
"s": 1
}
if member == inter.author:
await inter.send("Вы не можете себя замьютить", ephemeral=True)
return
if member == None:
await inter.send("Укажите пользователя", ephemeral=True)
return
if duration.endswith("d"):
await inter.response.defer()
duration = int(duration[:-1]) * time_converter["d"]
await member.timeout(reason=reason, until=duration)
logembed = disnake.Embed(description=f"**`{member.name}` Был замьючен!**", color=0x4d4d4d)
logembed.add_field(name="Пользователь", value=member.mention, inline=False)
logembed.add_field(name="Модератор", value=inter.author.mention, inline=False)
logembed.add_field(name="Время", value=disnake.utils.format_dt(duration, style='R'), inline=False)
logembed.add_field(name="Причина", value=f"`{reason}`", inline=False)
logembed.set_image(url=member.avatar.url)
logembed.set_footer(text=f"log {datetime.datetime.now().strftime('%Y-%m-%d %H:%M')}")
channel = inter.guild.get_channel(1234567)
await channel.send(embed=logembed)
embed = disnake.Embed(description=f"**`{member.name}` был замьючен**", color=0x4d4d4d)
await inter.send(embed=embed)
memberembed = disnake.Embed(description=f"Вы были замьючены модератором {inter.author.mention}", color=0x4d4d4d)
memberembed.add_field(name="Время", value=disnake.utils.format_dt(duration, style='R'), inline=False)
memberembed.add_field(name="Причина", value=f"`{reason}`", inline=False)
memberembed.set_image(url=inter.author.avatar.url)
await member.send(embed=memberembed)
Вывод: disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'timeout'
Ну типа я не уверен что вообще проблема в совмещении str с int ._.