fixed team delete confirm

This commit is contained in:
Sakimori 2023-04-01 00:13:00 -04:00
parent b598e9aa5e
commit 16654ed3ff

View file

@ -598,9 +598,6 @@ class DeleteTeamCommand(Command):
name = "deleteteam" name = "deleteteam"
template = "m;deleteteam [name]" template = "m;deleteteam [name]"
description = "Allows you to delete the team with the provided name. You'll get an embed with a confirmation to prevent accidental deletions. Hit the 👍 and your team will be deleted.. Requires team ownership. If you are the owner and the bot is telling you it's not yours, contact xvi and xie can assist." description = "Allows you to delete the team with the provided name. You'll get an embed with a confirmation to prevent accidental deletions. Hit the 👍 and your team will be deleted.. Requires team ownership. If you are the owner and the bot is telling you it's not yours, contact xvi and xie can assist."
async def execute(self, msg, command, flags):
team_name = command.strip()
@client.tree.command() @client.tree.command()
@ -2278,11 +2275,11 @@ async def team_delete_confirm(channel, team, owner):
await checkmsg.add_reaction("👎") await checkmsg.add_reaction("👎")
def react_check(payload): def react_check(payload):
return payload.user_id == message.author.id and payload.message_id == checkmsg.id return payload.user_id == owner.id and payload.message_id == checkmsg.id
try: try:
payload = await client.wait_for('raw_reaction_add', timeout=20.0, check=react_check) payload = await client.wait_for('raw_reaction_add', timeout=20.0, check=react_check)
if react.emoji.name == "👍": if payload.emoji.name == "👍":
await channel.send("Step back, this could get messy.") await channel.send("Step back, this could get messy.")
if db.delete_team(team): if db.delete_team(team):
await asyncio.sleep(2) await asyncio.sleep(2)
@ -2291,7 +2288,7 @@ async def team_delete_confirm(channel, team, owner):
await asyncio.sleep(2) await asyncio.sleep(2)
await channel.send("Huh. Didn't quite work. Tell xvi next time you see xer.") await channel.send("Huh. Didn't quite work. Tell xvi next time you see xer.")
return return
elif react.emoji.name == "👎": elif payload.emoji.name == "👎":
await channel.send("Message received. Pumping brakes, turning this car around.") await channel.send("Message received. Pumping brakes, turning this car around.")
return return
except asyncio.TimeoutError: except asyncio.TimeoutError: