Answer the question
In order to leave comments, you need to log in
How do I get the mute message to be sent immediately after I mute a member of Discord.py?
Here is the code:
@bot.command(pass_context=True)
@commands.has_permissions(administrator=True)
async def mut(ctx, member: discord.Member, time: int, reason):
channel = bot.get_channel(944939327664836618)
muterole = discord.utils.get(ctx.guild.roles, id = 942028190715617340)
emb = discord.Embed(color=0x9b59b6)
emb.add_field(name="✅ Muted", value='User {} has been muted!'.format( member.mention))
emb.add_field(name="Moderator", value = ctx.message.author.mention, inline = False)
emb.add_field(name="Time", value = {time}, inline = False)
emb .add_field(name="Reason", value = reason, inline = False)
await member.add_roles(muterole)
await asyncio.sleep(time)
await member.remove_roles(muterole)
await channel.send(embed = emb)
channel = bot.get_channel(939121803324981275)
await channel.send(f"{member.mention} was muted")
@bot. command(pass_context=True)
@commands.has_permissions(administrator=True)
async def unmuted(ctx, member: discord.Member):
channel = bot.get_channel(944939327664836618)
muterole = discord.utils.get(ctx.guild.roles, id = 942028190715617340)
emb = discord.Embed(color=0x9b59b6)
emb.add_field(name="✅ UnMuted", value='User {} has been muted!'.format(member.mention))
emb.add_field(name=" Moderator", value = ctx.message.author.mention,inline=False)
await member.remove_roles(muterole)
await channel.send(embed = emb)
I need that after I mute a member, a message is instantly sent that the member has been muted.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question