Changed listener check to be more efficient.

This commit is contained in:
alwayscompiling
2022-07-10 20:16:52 -04:00
parent f98c80d200
commit 3f5ebdf175
+3 -5
View File
@@ -18,16 +18,14 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
@commands.Cog.listener()
async def on_message(self, proof_message: nextcord.Message):
"""Listener for message creation. Adds score and attachments to submission."""
for user_id, message_id in submission_messages.items():
if proof_message.author.id in submission_messages:
message_id = submission_messages[proof_message.author.id]
submission_message: nextcord.Message = await self.bot.get_channel(
highscores_data["submission_channel_id"]
).fetch_message(message_id)
# need check if correct user and correct channel
if (
proof_message.channel.id == highscores_data["submission_channel_id"]
and proof_message.author.id == user_id
):
if proof_message.channel.id == highscores_data["submission_channel_id"]:
embed = submission_message.embeds[0]
embed.add_field(name="Score", value=proof_message.content, inline=False)