mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Refactor action confirmations
This commit is contained in:
parent
073d534419
commit
138c0b7f8c
4 changed files with 37 additions and 36 deletions
|
|
@ -208,17 +208,13 @@ async def system_fronthistory(ctx: CommandContext):
|
|||
async def system_delete(ctx: CommandContext):
|
||||
system = await ctx.ensure_system()
|
||||
|
||||
await ctx.reply(
|
||||
"Are you sure you want to delete your system? If so, reply to this message with the system's ID (`{}`).".format(
|
||||
system.hid))
|
||||
|
||||
msg = await ctx.client.wait_for_message(author=ctx.message.author, channel=ctx.message.channel, timeout=60.0 * 5)
|
||||
if msg and msg.content.lower() == system.hid.lower():
|
||||
await db.remove_system(ctx.conn, system_id=system.id)
|
||||
return CommandSuccess("System deleted.")
|
||||
else:
|
||||
delete_confirm_msg = "Are you sure you want to delete your system? If so, reply to this message with the system's ID (`{}`).".format(system.hid)
|
||||
if not await ctx.confirm_text(ctx.message.author, ctx.message.channel, system.hid, delete_confirm_msg):
|
||||
return CommandError("System deletion cancelled.")
|
||||
|
||||
await db.remove_system(ctx.conn, system_id=system.id)
|
||||
return CommandSuccess("System deleted.")
|
||||
|
||||
|
||||
async def system_frontpercent(ctx: CommandContext):
|
||||
system = await ctx.ensure_system()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue