Answer the question
In order to leave comments, you need to log in
What should I do if I'm trying to temporarily mute a member and I get an error from Discord.py?
@bot.command(pass_context=True)
@commands.has_permissions(administrator=True)
async def замутить(ctx, member: discord.Member, time: int, reason):
channel = bot.get_channel(939121803324981275)
muterole = discord.utils.get(ctx.guild.roles, id = 942028190715617340)
emb = discord.Embed(color=344462)
emb.add_field(name="✅ Muted", value='Пользователь {} был замьючен!'.format(member.mention))
emb.add_field(name="Модератор", value = ctx.message.author.mention, inline = False)
emb.add_field(name="Причина", value = reason, inline = False)
await member.add_roles(muterole)
await asyncio.sleep(time * 60)
await member.remove_roles(muterole)
await channel.send(embed = emb)
@bot.command(pass_context=True)
@commands.has_permissions(administrator=True)
async def размутить(ctx, member: discord.Member):
channel = bot.get_channel(939121803324981275)
muterole = discord.utils.get(ctx.guild.roles, id = 942028190715617340)
emb = discord.Embed(color=344462)
emb.add_field(name="✅ UnMuted", value='Пользователь {} был размьючен!'.format(member.mention))
emb.add_field(name="Модератор", value = ctx.message.author.mention, inline = False)
await member.remove_roles(muterole)
await channel.send(embed = emb)
Ignoring exception in command замутить:
Traceback (most recent call last):
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 467, in _actual_conversion
return converter(argument)
ValueError: invalid literal for int() with base 10: '1m'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
await self.prepare(ctx)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 552, in transform
return await self.do_conversion(ctx, converter, argument, param)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 505, in do_conversion
return await self._actual_conversion(ctx, converter, argument, param)
File "C:\Users\pasha\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 476, in _actual_conversion
raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "int" failed for parameter "time".
Answer the question
In order to leave comments, you need to log in
You are probably passing the time to the parameters incorrectly.
Try:
Mutate F1azy 1 Spam
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question