+ 1
Help me to make a command
I need help to make a tempute command for my discord bot I have tried to amke but fail so can somebody help me to make the code or pls give the code with a hard explanation Am asking for the explanation only to understand
6 Réponses
0
Can you post the code you have? At least the part for your command. I can see what went wrong and I'll be able to tell you how to fix it.
0
Ok
0
@client.command()
def tempmute(ctx, member: discord.Member, time: int, d, *, reason=None):
guild = ctx.guild
for role in guild.roles:
if role.name == "Muted":
await member.add_roles(role)
embed = discord.Embed(title="muted!", description=f"{member.mention} has been tempmuted ", colour=discord.Colour.light_gray())
embed.add_field(name="reason:", value=reason, inline=False)
embed.add_field(name="time left for the mute:", value=f"{time}{d}", inline=False)
await ctx.send(embed=embed)
if d == "s":
await asyncio.sleep(time)
if d == "m":
await asyncio.sleep(time*60)
if d == "h":
await asyncio.sleep(time*60*60)
if d == "d":
await asyncio.sleep(time*60*60*24)
await member.remove_roles(role)
embed = discord.Embed(title="unmute (temp) ", description=f"unmuted -{member.mention} ", colour=discord.Colour.l
0
This is the code
0
STEVE SONY Are you testing this on a new client? Or your main account? If it's on your main account, it won't work as admins will always have post permission. I'll get to the code in a minute.
0
Ok