spits out raw item string if not found in languages.json

This commit is contained in:
iou1name 2018-06-16 12:49:08 -04:00
parent 41a61117cc
commit 4c5fc3d98b

View File

@ -110,15 +110,22 @@ class WarBot(irc.IRCClient):
minLvl = info["minEnemyLevel"]
maxLvl = info["maxEnemyLevel"]
credits = info["missionReward"].get("credits")
items = info["missionReward"].get("items", [])
if items:
items = [self.languages[item.lower()]["value"] for item in items]
cItems = info["missionReward"].get("countedItems")
if cItems:
for item in cItems:
itemStr = f"({item['ItemCount']}) "
items_raw = info["missionReward"].get("items", [])
items = []
for item in items_raw:
try:
items.append(self.languages[item.lower()]["value"])
except KeyError:
items.append(item)
cItems = info["missionReward"].get("countedItems", [])
for item in cItems:
itemStr = f"({item['ItemCount']}) "
try:
itemStr += self.languages[item["ItemType"].lower()]["value"]
items.append(itemStr)
except KeyError:
itemStr += item["ItemType"]
items.append(itemStr)
expire = int(alert["Expiry"]["$date"]["$numberLong"])
expire = int(expire/1000)