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"] minLvl = info["minEnemyLevel"]
maxLvl = info["maxEnemyLevel"] maxLvl = info["maxEnemyLevel"]
credits = info["missionReward"].get("credits") credits = info["missionReward"].get("credits")
items = info["missionReward"].get("items", []) items_raw = info["missionReward"].get("items", [])
if items: items = []
items = [self.languages[item.lower()]["value"] for item in items] for item in items_raw:
cItems = info["missionReward"].get("countedItems") try:
if cItems: items.append(self.languages[item.lower()]["value"])
for item in cItems: except KeyError:
itemStr = f"({item['ItemCount']}) " items.append(item)
cItems = info["missionReward"].get("countedItems", [])
for item in cItems:
itemStr = f"({item['ItemCount']}) "
try:
itemStr += self.languages[item["ItemType"].lower()]["value"] 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(alert["Expiry"]["$date"]["$numberLong"])
expire = int(expire/1000) expire = int(expire/1000)