Help me to make a command | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

24th Aug 2021, 3:19 PM
STEVE SONY
STEVE SONY - avatar
6 Answers
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.
24th Aug 2021, 11:22 PM
Benjamin Rogers
Benjamin Rogers - avatar
0
Ok
24th Aug 2021, 11:51 PM
STEVE SONY
STEVE SONY - avatar
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
24th Aug 2021, 11:51 PM
STEVE SONY
STEVE SONY - avatar
0
This is the code
24th Aug 2021, 11:51 PM
STEVE SONY
STEVE SONY - avatar
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.
25th Aug 2021, 12:39 AM
Benjamin Rogers
Benjamin Rogers - avatar
0
Ok
25th Aug 2021, 2:01 PM
STEVE SONY
STEVE SONY - avatar