looking for some solutions? You are welcome.

SOLVED: Discord Temporary mute Went Wrong

bos gamer:

I was making a temporary Mute command for my discord but I don't know what command should i use, No errors where given.Its an unexpected result,Also if u can tell me how to add a reason it would be great!.The command is below.

@bot.command(pass_context=True, name="tempmute")
@has_permissions(mute_members=True)
async def tempmute(ctx, *, target: Member):
if target.server_permissions.administrator:
    await bot.say("Target is an admin")
else:
    try:
        await bot.mute(target)
        await bot.say('{} got muted by {}'.format(target.mention, message.author))
    except Exception:
        await bot.say("Something went wrong")

@tempmute.error
async def tempmute_error(error, ctx):
if isinstance(error, CheckFailure):
     await bot.send_message(ctx.message.channel, "You do not have permissions")
elif isinstance(error, BadArgument):
    await bot.send_message(ctx.message.channel, "Could not identify target")
else:
    raise error

but the command neither mutes or temporary mutes the target nor sends any error, it just says "something went wrong". Also i can't find a command in which i can get the member who called the command in line wait bot.say('{} got muted by {}'.format(target.mention, message.author)) message.author What should i write instead of that to get the member who called the command to mute the target



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent