fix reference to confirmation message in `t/modify` when the message was never made.
This commit is contained in:
Tim Wilson 2020-09-03 12:31:09 -06:00 committed by GitHub
parent a60f87e2de
commit 00a05a21c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
bot.py
View File

@ -1182,6 +1182,7 @@ async def modify(context, *, content=""):
cmdName = cmdNames[str(reaction.emoji)]
doContinue = True
msg2 = None
if "remove" in cmds[str(reaction.emoji)]:
embed=discord.Embed(title="Are you sure you wish to remove{} {} transfer{}?".format(' and DELETE' if 'delete' in cmds[str(reaction.emoji)] else '', len(torrents), '' if len(torrents)==1 else 's'),description="**This action is irreversible!**",color=0xb51a00)
embed.set_footer(text="react ✅ to continue or ❌ to cancel")
@ -1218,11 +1219,13 @@ async def modify(context, *, content=""):
opEmoji = {i:j for i,j in zip(ops,opEmoji)}
await context.message.channel.send("{} Transfer{} {}".format(str(reaction.emoji),'s' if allOnly or len(torrents) > 1 else '', ops[cmd]))
await msg.clear_reactions()
if msg2 is not None:
await msg2.clear_reactions()
return
else:
await context.message.channel.send("❌ Cancelled!")
await msg.clear_reactions()
if msg2 is not None:
await msg2.clear_reactions()
return
@ -1244,6 +1247,7 @@ async def modify(context, *, content=""):
cmd = cmds[str(reaction.emoji)]
cmdName = cmdNames[str(reaction.emoji)]
msg2 = None
doContinue = True
if "remove" in cmds[str(reaction.emoji)]:
embed=discord.Embed(title="Are you sure you wish to remove{} {} transfer{}?".format(' and DELETE' if 'delete' in cmds[str(reaction.emoji)] else '', len(torrents), '' if len(torrents)==1 else 's'),description="**This action is irreversible!**",color=0xb51a00)
@ -1283,11 +1287,13 @@ async def modify(context, *, content=""):
opEmoji = {i:j for i,j in zip(ops,opEmoji)}
await context.message.channel.send("{} Transfer{} {}".format(str(reaction.emoji),'s' if allOnly or len(torrents) > 1 else '', ops[cmd]))
await msg.clear_reactions()
if msg2 is not None:
await msg2.clear_reactions()
return
else:
await context.message.channel.send("❌ Cancelled!")
await msg.clear_reactions()
if msg2 is not None:
await msg2.clear_reactions()
return