so I was making a mute and unmute command to timeout members and remove the timeout. The timeout command works properly with user.timeout(time, reason)
but when trying to do user.remove_timeout(reason)
it gives an error. here is the code and error.
@tree.command(name="unmute", description="unmutes a member")
async def unmute(interaction, user: Member):
if interaction.guild.me.guild_permissions.moderate_members:
if interaction.user.guild_permissions.moderate_members:
await user.remove_timeout()
await interaction.response.send_message(f"{user.mention} has been unmuted successfully!")
The error is
Cannot access member "remove_timeout" for type "Member"
Member "remove_timeout" is unknown
You can use .edit() and set timed_out_until
to None
to remove the timeout.
So your code would look like:
@tree.command(name="unmute", description="unmutes a member")
async def unmute(interaction, user: Member):
if interaction.guild.me.guild_permissions.moderate_members:
if interaction.user.guild_permissions.moderate_members:
await user.edit(timed_out_until=None)
await interaction.response.send_message(f"{user.mention} has been unmuted successfully!")