Skip to content

Commit

Permalink
Updated to v1.5
Browse files Browse the repository at this point in the history
Re-added wrong pokemon feature

Added support for the other two types of Wormadam (Sandy and Trash)

Fixed issue with Nidoran male and female since the hint uses the unicode symbols ♂ and ♀

Removed the if p!h is on cooldown feature - probably unnecessary with the wrong pokemon feature added back

Bot not finding Bulbasaur hopefully fixed this time - changed parsing method of the pokemon_string array
  • Loading branch information
sterling-tenn committed Jan 31, 2021
1 parent 5a7eee3 commit 210c52f
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@
Bastiodon
Burmy
Wormadam
Sandy Wormadam
Trash Wormadam
Mothim
Combee
Vespiquen
Expand Down Expand Up @@ -1015,23 +1017,31 @@ async def on_message(message):

#search if the message contains one of these phrases
is_hint = findall('The pokémon is ',message.content)
is_wrong = findall('That is the wrong pokémon!',message.content)
is_correct = findall('Congratulations',message.content)

if is_hint:
solution = solve(message.content)
#try all possible solutions - fix for short name pokemon by brute force
for i in range(0,len(solution)):
post(text_channel, data = {'content': 'p!c '+ solution[i].strip()}, headers = header)
sleep(3)

#hardcode Nidoran since the hint uses the unicode symbols ♂ and ♀
if solution[i].strip() == "Nidoran ♂" or solution[i].strip() == "Nidoran ♀":
post(text_channel, data = {'content': 'p!c Nidoran'}, headers = header)
#everything else
else:
post(text_channel, data = {'content': 'p!c '+ solution[i].strip()}, headers = header)
sleep(3)

elif is_wrong:
post(text_channel, data = {'content':'p!h'}, headers = header)

elif is_correct:
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
split = message.content.split(">! ")
print("[",current_time,"]",split[1])
loopBool = True
except Exception:
#post(text_channel, data = {'content':'p!h'}, headers = header)
pass

#spams a "." every 3 seconds
Expand All @@ -1041,12 +1051,12 @@ async def loop():
channel = client.get_channel(channel_id)
post(text_channel, data = {'content':'.'}, headers = header)

@client.event
async def on_reaction_add(reaction, user):
#if p!h is on cooldown
if reaction.emoji == '⌛':
loopBool = False
sleep(10)
post(text_channel, data = {'content':'p!h'}, headers = header)
#@client.event
#async def on_reaction_add(reaction, user):
# #if p!h is on cooldown
# if reaction.emoji == '⌛':
# loopBool = False
# sleep(5)
# post(text_channel, data = {'content':'p!h'}, headers = header)

client.run(bot_token)

0 comments on commit 210c52f

Please sign in to comment.