Skip to content

Commit 440cffb

Browse files
committed
Add DM support
1 parent b929da7 commit 440cffb

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

bot/main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,20 @@ async def on_message(message):
112112
parsedDates = parseDates(today.year)
113113
if message.author == client.user:
114114
return
115+
116+
if message.guild is None and not message.author.bot:
117+
# Is DM
118+
target_channel_id = 1449013521005416459
119+
support_user_id = 524302018005827598
120+
target_channel = client.get_channel(target_channel_id)
121+
if target_channel:
122+
# Send the DM content to the channel
123+
await target_channel.send(f"DM from {message.author.display_name}: {message.content}")
124+
await message.channel.send("Message redirected!")
125+
else:
126+
await message.channel.send(f"Could not redirect message to <@{support_user_id}>, please contact them directly.")
127+
return
128+
115129
# Ignore all emojis
116130
newMessage = deEmojify(message.content).translate(str.maketrans('', '', string.punctuation)).strip()
117131

0 commit comments

Comments
 (0)