Skip to content

Commit

Permalink
Discord Update: Allow overriding the display name via a DM
Browse files Browse the repository at this point in the history
  • Loading branch information
InfusOnWoW authored and mrbuds committed Dec 14, 2024
1 parent c4085bd commit 3713269
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/scripts/discordupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ def handleHistoryMessage(self, message):
else:
commitMsgPrint("Ignoring user, because they don't have the right role:", message.author.name)

async def parseDMChannel(self, channel):
messages = [message async for message in channel.history(limit=1)]
if messages:
return messages[0]
return None

# New method of parsing reactions to a singular message
async def parseReactions(self, channel, msgId):
message = await channel.fetch_message(msgId)
Expand All @@ -131,6 +137,10 @@ async def parseReactions(self, channel, msgId):
if isinstance(user, discord.member.Member):
if self.hasRightRole(user.roles):
self.messagePerAuthor[user.id] = user.display_name
msg = await self.parseDMChannel(user)
if msg:
self.messagePerAuthor[user.id] = msg.content
commitMsgPrint("Using DM message:", user.display_name, "=>", msg.content)
else:
commitMsgPrint("Ignoring User (missing role): ", user.display_name)
self.writeFile()
Expand Down

0 comments on commit 3713269

Please sign in to comment.