I have a Discord bot and I'd like to know how I can create a confirmation for my purgeroles command. Here's the command currently:
@client.command(aliases = ['delroles', 'deleteroles', 'cleanseroles'])
async def purgeroles(ctx):
embed=discord.Embed(title="Purging (deleting) roles...")
embedcomplete=discord.Embed(title="All possible roles have been purged (deleted)!")
if (not ctx.author.guild_permissions.manage_roles):
await ctx.reply("Error: User is missing permission `Manage Roles`")
return
await ctx.reply(embed=embed)
for role in ctx.guild.roles:
try:
await role.delete()
except:
pass
await ctx.reply(embed=embedcomplete)
I don't want the bot to just delete all of the roles on command, in case someone runs the command by accident. Is there anyway I can make the bot wait until the author says a message to confirm whether or not the bot should continue?
You can use
wait_forfor this type of stuff.