|
19 | 19 | #
|
20 | 20 | bot = commands.Bot(command_prefix='!') #
|
21 | 21 | TOKEN = os.getenv('DISCORD_TOKEN') #
|
22 |
| -VERSION = "a0.1" # |
| 22 | +VERSION = "v0.1-alpha" # |
23 | 23 | ACTIVITY = discord.Game("!help") #
|
24 | 24 | #
|
25 | 25 | #########################################
|
@@ -80,45 +80,41 @@ async def on_message(message):
|
80 | 80 |
|
81 | 81 | return
|
82 | 82 |
|
| 83 | + |
| 84 | + elif 'happy birthday' in message.content.lower(): |
| 85 | + """ |
| 86 | + Lets the bot say happy birthday whenever a user says it |
| 87 | + """ |
| 88 | + |
| 89 | + print("Wishing someone a happy birthday!") |
| 90 | + await message.channel.send('Happy Birthday! 🎈🎉🎂') |
| 91 | + |
| 92 | + await bot.process_commands(message) |
| 93 | + |
| 94 | + |
83 | 95 | if 'im' in message.content.lower() or 'i\'m' in message.content.lower() or 'i am' in message.content.lower():
|
84 | 96 | """
|
85 | 97 | Lets the bot tell the famous "Hi x! I'm dad!" joke
|
86 | 98 | """
|
87 | 99 |
|
88 | 100 | user_message = message.content.split()
|
89 |
| - ways_to_say_i_am = ["im", "i'm", "i am"] |
90 |
| - print("Dad joke incoming!") |
| 101 | + |
| 102 | + ways_to_say_i_am = [' im', ' i\'m'] |
91 | 103 |
|
92 | 104 | for i in range(len(user_message)):
|
93 |
| - if len(user_message) - i < 2: |
94 |
| - print("False alarm, user message too short!") |
95 |
| - break |
96 |
| - |
97 |
| - elif user_message[i].lower() in ways_to_say_i_am: |
98 |
| - response = "Hi " + " ".join(user_message[i + 1:]) + "! I'm dad!" |
99 |
| - print(response) |
100 |
| - await message.channel.send(response) |
101 |
| - break |
102 |
| - |
103 |
| - elif len(user_message) - i < 3: |
104 |
| - print("False alarm, user message too short!") |
105 |
| - break |
106 |
| - |
107 |
| - elif user_message[i].lower() + " " + user_message[i + 1].lower() in ways_to_say_i_am: |
108 |
| - response = "Hi " + " ".join(user_message[i + 2:]) + "! I'm dad!" |
109 |
| - print(response) |
110 |
| - await message.channel.send(response) |
111 |
| - break |
| 105 | + if (' ' + user_message[i].lower() in ways_to_say_i_am): |
112 | 106 |
|
113 |
| - elif 'happy birthday' in message.content.lower(): |
114 |
| - """ |
115 |
| - Lets the bot say happy birthday whenever a user says it |
116 |
| - """ |
| 107 | + print("Dad joke incoming!") |
117 | 108 |
|
118 |
| - print("Wishing someone a happy birthday!") |
119 |
| - await message.channel.send('Happy Birthday! 🎈🎉🎂') |
| 109 | + if len(user_message) - i < 2: |
| 110 | + print("False alarm, user message too short!") |
| 111 | + break |
120 | 112 |
|
121 |
| - await bot.process_commands(message) |
| 113 | + else: |
| 114 | + response = "Hi " + " ".join(user_message[i + 1:]) + "! I'm dad!" |
| 115 | + print(response) |
| 116 | + await message.channel.send(response) |
| 117 | + break |
122 | 118 |
|
123 | 119 |
|
124 | 120 | @bot.command(name = '99', help = 'Responds with a random Brooklyn 99 quote.')
|
|
0 commit comments