diff --git a/gw2rpc/character.py b/gw2rpc/character.py index b2353aa..e730e16 100644 --- a/gw2rpc/character.py +++ b/gw2rpc/character.py @@ -9,7 +9,8 @@ 6: "Elementalist", 7: "Mesmer", 8: "Necromancer", - 9: "Revenant" + 9: "Revenant", + 10: "Jade Bot" } RACES = {0: "Asura", 1: "Charr", 2: "Human", 3: "Norn", 4: "Sylvari", 5: "Jade Bot"} @@ -49,21 +50,31 @@ class Character: def __init__(self, mumble_data, query_guild=True): self.__mumble_data = mumble_data self.name = mumble_data["name"] - self.race = RACES[mumble_data["race"]] + try: + self.race = RACES[mumble_data["race"]] + except KeyError: + self.race = "" self.__api_info = None if query_guild and api._authenticated: self.__api_info = api.get_character(self.name) self.profession = self.get_elite_spec() - self.profession_icon = "prof_{}".format( - self.profession.lower().replace(" ", "")) + if self.profession: + self.profession_icon = "prof_{}".format( + self.profession.lower().replace(" ", "")) + else: + self.profession = "" + self.profession_icon = "gw2rpclogo" self.guild_tag = self._get_guild_tag() def get_elite_spec(self): if self.__mumble_data["spec"] not in ELITESPECS.keys(): # Meaning that its a core class, fall back - return PROFESSIONS[self.__mumble_data["profession"]] + try: + return PROFESSIONS[self.__mumble_data["profession"]] + except KeyError: + return None else: return ELITESPECS[self.__mumble_data["spec"]] diff --git a/gw2rpc/gw2rpc.py b/gw2rpc/gw2rpc.py index 4e5214b..6124011 100644 --- a/gw2rpc/gw2rpc.py +++ b/gw2rpc/gw2rpc.py @@ -29,7 +29,7 @@ def resource_path(relative_path): base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__))) return os.path.join(base_path, relative_path) -VERSION = 2.53 +VERSION = 2.54 HEADERS = {'User-Agent': 'GW2RPC v{}'.format(VERSION)} GW2RPC_BASE_URL = "https://gw2rpc.info/api/v2/" @@ -374,7 +374,7 @@ def get_region(): return "" def get_closest_poi(map_info, continent_info): - #region = map_info.get("region_name") + ##region = map_info.get("region_name") region = map_info.get("region_id") if config.disable_pois: return None @@ -490,7 +490,7 @@ def update_mumble_links(): if not config.hide_commander_tag and is_commander: small_image = "commander_tag" details = "{}: {}".format(_("Commander"), details) - elif character.race == "Jade Bot": + elif character.race == "Jade Bot" or character.profession == "Jade Bot": small_image = "jade_bot" else: small_image = character.profession_icon @@ -754,7 +754,7 @@ def check_for_running_rpc(): self.sdk.close() time.sleep(self.interval) except Exception as e: - log.critical("GW2RPC has crashed", exc_info=e) + log.critical(f"GW2RPC v{VERSION} has crashed", exc_info=e) create_msgbox( "GW2 Rich Presence has crashed.\nPlease check your " "log file and report this to the author!",