Implement Submission.update and get/fetch message helper functions

Added and implemented helper functions for getting and fetching messages
given a payload's integer channel and message IDs.
Implemented Submission.votes list modifications and Submission.update in
 code (tested with real bot)
 Committed constants.py containing ReactionMarker used in models.py
This commit is contained in:
Xevion
2021-02-17 05:18:25 -06:00
parent 5c70a78798
commit 7427763b57
3 changed files with 25 additions and 25 deletions

View File

@@ -106,3 +106,11 @@ class ContestBot(commands.Bot):
for submission in submissions:
message: discord.PartialMessage = channel.get_partial_message(submission.id)
await message.add_reaction(self.get_emoji(constants.Emoji.UPVOTE))
def get_message(self, channel_id: int, message_id: int) -> discord.PartialMessage:
channel: discord.TextChannel = self.get_channel(channel_id)
return channel.get_partial_message(message_id)
async def fetch_message(self, channel_id: int, message_id: int) -> discord.Message:
channel: discord.TextChannel = self.get_channel(channel_id)
return await channel.fetch_message(message_id)