Changed listener check to be more efficient.
This commit is contained in:
@@ -18,16 +18,14 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
|
|||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_message(self, proof_message: nextcord.Message):
|
async def on_message(self, proof_message: nextcord.Message):
|
||||||
"""Listener for message creation. Adds score and attachments to submission."""
|
"""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(
|
submission_message: nextcord.Message = await self.bot.get_channel(
|
||||||
highscores_data["submission_channel_id"]
|
highscores_data["submission_channel_id"]
|
||||||
).fetch_message(message_id)
|
).fetch_message(message_id)
|
||||||
|
|
||||||
# need check if correct user and correct channel
|
# need check if correct user and correct channel
|
||||||
if (
|
if proof_message.channel.id == highscores_data["submission_channel_id"]:
|
||||||
proof_message.channel.id == highscores_data["submission_channel_id"]
|
|
||||||
and proof_message.author.id == user_id
|
|
||||||
):
|
|
||||||
|
|
||||||
embed = submission_message.embeds[0]
|
embed = submission_message.embeds[0]
|
||||||
embed.add_field(name="Score", value=proof_message.content, inline=False)
|
embed.add_field(name="Score", value=proof_message.content, inline=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user