Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Keystone Season Achievements (#49)
Browse files Browse the repository at this point in the history
* Keystone Season Achievements

* Switching difficulty order
  • Loading branch information
JamesIves authored Dec 23, 2018
1 parent 8c87e75 commit 64b39ca
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 42 deletions.
28 changes: 16 additions & 12 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ async def on_message(message):
info['name'], info['realm'], region.upper(), info['ilvl']),
inline=True)
msg.add_field(
name='Keystone Achievements',
value='**`Master(+15)`:** `%s`\n**`Conqueror(+10)`:** `%s` \n**`Challenger(+5)`:** `%s`' % (
info['keystone_master'], info['keystone_conqueror'],
info['keystone_challenger']),
name='Keystone Achievements (Season 1)',
value='**`Conqueror (+10)`:** `%s`\n**`Master (+15)`:** `%s` \n' % (
info['keystone_season_conqueror'], info['keystone_season_master']),
inline=True)
msg.add_field(
name='Uldir',
Expand Down Expand Up @@ -138,7 +137,7 @@ async def on_message(message):
title='%s' % (info['name']),
colour=discord.Colour(info['class_colour']),
url='%s' % (info['armory']),
description='%s %s %s %s' % (
description='%s %s %s %s (BFA)' % (
info['level'], info['faction'], info['spec'], info['class_type']))
msg.set_thumbnail(
url='https://render-%s.worldofwarcraft.com/character/%s?_%s' % (
Expand Down Expand Up @@ -224,20 +223,25 @@ async def on_message(message):

@client.event
async def on_ready():
if WOW_CLIENT_ID == '' or WOW_CLIENT_SECRET == '':
if WOW_CLIENT_ID is None or WOW_CLIENT_ID == '' or WOW_CLIENT_SECRET is None or WOW_CLIENT_SECRET == '':
print('Missing World of Warcraft Client ID/Secret. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details')
quit()

if WOW_REGION == '':
if WOW_REGION is None or WOW_REGION == '':
print('Missing World of Warcraft player region. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details')
quit()

if LOCALE == '':
if LOCALE is None or LOCALE == '':
print('Missing locale. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details')

if DISCORD_BOT_TOKEN == '':
print('Missing Discord bot token. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details')
quit()

else:
print('Launch Succesful! The bot is now listening for commands...')


client.run(DISCORD_BOT_TOKEN)
if DISCORD_BOT_TOKEN is None or DISCORD_BOT_TOKEN == '':
print('Missing Discord bot token. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details')
quit()

else:
client.run(DISCORD_BOT_TOKEN)
15 changes: 9 additions & 6 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@

"""Dictionary of constants used throughout the application."""

# Achievement Constants
AC_KEYSTONE_MASTER = 11162
AC_KEYSTONE_CONQUEROR = 11185
AC_KEYSTONE_CHALLENGER = 11184
# Mythic Keystone Achievement Constants
AC_SEASON_KEYSTONE_CONQUEROR = 13079
AC_SEASON_KEYSTONE_MASTER = 13080

# Raid Achievement Constants
AC_AOTC_UD = 12536
AC_CE_UD = 12535

# PVP Achievement Constants
AC_ARENA_CHALLENGER = 2090
AC_ARENA_RIVAL = 2093
AC_ARENA_DUELIST = 2092
AC_ARENA_GLADIATOR = 2091
AC_AOTC_UD = 12536
AC_CE_UD = 12535
AC_HIGH_WARLORD = 5356
AC_CHAMPION = 5353
AC_FIRST_SERGEANT = 5349
Expand Down
14 changes: 6 additions & 8 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,20 @@ def test_for_achievement_progress(self):
input_data_horde_sample = {
"achievements": {
"achievementsCompleted": [11611, 11162, 11185, 11184, 2090, 2093,
2092, 2091, 11194, 11581, 11195, 11874, 5356, 5353, 5349, 11191, 11192, 11874, 12110, 12111, 12536, 12535]
2092, 2091, 11194, 11581, 11195, 11874, 5356, 5353, 5349, 11191, 11192, 11874, 12110, 12111, 12536, 12535, 13079]
}
}

input_data_alliance_sample = {
"achievements": {
"achievementsCompleted": [11611, 11162, 11185, 11184, 2090, 2093,
2092, 2091, 11194, 11581, 11195, 11874, 5343, 5339, 5334, 11192, 11874, 11875, 12110, 12536]
2092, 2091, 11194, 11581, 11195, 11874, 5343, 5339, 5334, 11192, 11874, 11875, 12110, 12536, 13079, 13080]
}
}

expected_horde_data = {
'keystone_master': 'Completed',
'keystone_conqueror': 'Completed',
'keystone_challenger': 'Completed',
'keystone_season_master': 'In Progress',
'keystone_season_conqueror': 'Completed',
'arena_challenger': 'Completed',
'arena_rival': 'Completed',
'arena_duelist': 'Completed',
Expand All @@ -150,9 +149,8 @@ def test_for_achievement_progress(self):
}

expected_alliance_data = {
'keystone_master': 'Completed',
'keystone_conqueror': 'Completed',
'keystone_challenger': 'Completed',
'keystone_season_master': 'Completed',
'keystone_season_conqueror': 'Completed',
'arena_challenger': 'Completed',
'arena_rival': 'Completed',
'arena_duelist': 'Completed',
Expand Down
26 changes: 10 additions & 16 deletions wow.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ def character_achievements(achievement_data, faction):
achievements = achievement_data['achievements']

# Return In Progress or empty unless they are found.
keystone_master = 'In Progress'
keystone_conqueror = 'In Progress'
keystone_challenger = 'In Progress'
keystone_season_master = 'In Progress'
keystone_season_conqueror = 'In Progress'
arena_challenger = 'In Progress'
arena_rival = 'In Progress'
arena_duelist = 'In Progress'
Expand All @@ -86,14 +85,11 @@ def character_achievements(achievement_data, faction):
rbg_1500 = 'In Progress'
ud_feat = ''

if AC_KEYSTONE_MASTER in achievements['achievementsCompleted']:
keystone_master = 'Completed'
if AC_SEASON_KEYSTONE_MASTER in achievements['achievementsCompleted']:
keystone_season_master = 'Completed'

if AC_KEYSTONE_CONQUEROR in achievements['achievementsCompleted']:
keystone_conqueror = 'Completed'

if AC_KEYSTONE_CHALLENGER in achievements['achievementsCompleted']:
keystone_challenger = 'Completed'
if AC_SEASON_KEYSTONE_CONQUEROR in achievements['achievementsCompleted']:
keystone_season_conqueror = 'Completed'

if AC_ARENA_CHALLENGER in achievements['achievementsCompleted']:
arena_challenger = 'Completed'
Expand Down Expand Up @@ -146,9 +142,8 @@ def character_achievements(achievement_data, faction):
rbg_1500 = 'Completed'

achievement_list = {
'keystone_master': keystone_master,
'keystone_conqueror': keystone_conqueror,
'keystone_challenger': keystone_challenger,
'keystone_season_master': keystone_season_master,
'keystone_season_conqueror': keystone_season_conqueror,
'arena_challenger': arena_challenger,
'arena_rival': arena_rival,
'arena_duelist': arena_duelist,
Expand Down Expand Up @@ -393,9 +388,8 @@ async def character_info(name, realm, query, region):
region, realm, name),
'thumb': info['thumbnail'],
'ilvl': info['items']['averageItemLevelEquipped'],
'keystone_master': achievements['keystone_master'],
'keystone_conqueror': achievements['keystone_conqueror'],
'keystone_challenger': achievements['keystone_challenger'],
'keystone_season_master': achievements['keystone_season_master'],
'keystone_season_conqueror': achievements['keystone_season_conqueror'],
'ud_feat': achievements['ud_feat'],
'uldir': progression['uldir']
}
Expand Down

0 comments on commit 64b39ca

Please sign in to comment.