From e25f24a25b6a24c7e5305d98064ff8e33db75e79 Mon Sep 17 00:00:00 2001 From: Ske Date: Sat, 14 Jul 2018 23:09:23 +0200 Subject: [PATCH] Ensure Tupperware import response matches with the sending user --- bot/pluralkit/commands.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bot/pluralkit/commands.py b/bot/pluralkit/commands.py index e7591b78..2405e1b3 100644 --- a/bot/pluralkit/commands.py +++ b/bot/pluralkit/commands.py @@ -526,7 +526,17 @@ async def import_tupperware(conn, message, args): await client.send_message(message.channel, embed=make_default_embed("Please reply to this message with `tul!list` (or the server equivalent).")) - tw_msg = await client.wait_for_message(author=tupperware_member, channel=message.channel, timeout=60.0) + # Check to make sure the Tupperware response actually belongs to the correct user + def ensure_account(tw_msg): + if not tw_msg.embeds: + return False + + if not tw_msg.embeds[0]["title"]: + return False + + return tw_msg.embeds[0]["title"].startswith("{}#{}".format(message.author.name, message.author.discriminator)) + + tw_msg = await client.wait_for_message(author=tupperware_member, channel=message.channel, timeout=60.0, check=ensure_account) if not tw_msg: return False, "Tupperware import timed out."