Skip to content

Commit 7d4bd89

Browse files
committed
Improve happy birthday feature
1 parent 27124cb commit 7d4bd89

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
.env
2-
logs/
2+
*.log

logs/.keep

Whitespace-only changes.

protobot.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,14 @@ async def on_message(message):
130130
Lets the bot say happy birthday whenever a user says it
131131
"""
132132

133-
await message.channel.send('Happy Birthday! 🎈🎉🎂')
134-
135-
await bot.process_commands(message)
133+
mentions = message.mentions
134+
author = message.author.name + "(" + str(message.author.id) + ")"
135+
logging.info(f"{author} wished happy birthday to {len(mentions)} user(s).")
136+
for recipient in mentions:
137+
await message.channel.send(f"Happy Birthday <@{recipient.id}>! 🎈🎉🎂")
136138

137139

138-
if 'im' in message.content.lower() or 'i\'m' in message.content.lower() or 'i am' in message.content.lower():
140+
elif 'im' in message.content.lower() or 'i\'m' in message.content.lower() or 'i am' in message.content.lower():
139141
"""
140142
Lets the bot tell the famous "Hi x! I'm dad!" joke
141143
"""
@@ -156,4 +158,6 @@ async def on_message(message):
156158
break
157159

158160

159-
bot.run(TOKEN)
161+
await bot.process_commands(message)
162+
163+
bot.run(TOKEN)

0 commit comments

Comments
 (0)