diff --git a/commandListener.py b/commandListener.py index c0fa588..f9a80ae 100644 --- a/commandListener.py +++ b/commandListener.py @@ -1009,7 +1009,7 @@ async def shutdown(self, ctx: Context): # TODO: Test commands @Cog.listener() async def on_command_error(self, ctx: Context, error): - # pylint: disable=no-self-use + # pylint: disable=no-self-use, no-else-return if isinstance(error, MissingRequiredArgument): await ctx.send(f"Missing argument. See: `{CMD}help {ctx.command}`") return diff --git a/event.py b/event.py index 8241f85..5d79a73 100644 --- a/event.py +++ b/event.py @@ -80,6 +80,7 @@ def additional_role_count(self) -> int: return len(self.roleGroups["Additional"]) def changeSize(self, new_size): + # pylint: disable=too-many-statements if new_size == self.platoon_size: return None @@ -344,7 +345,7 @@ def addAdditionalRole(self, name: str) -> str: emoji = cfg.ADDITIONAL_ROLE_EMOJIS[self.additional_role_count] # Create role - newRole = Role(name, emoji, True) + newRole = Role(name, emoji, show_name=True) # Add role to additional roles self.roleGroups["Additional"].addRole(newRole) @@ -555,21 +556,21 @@ def toJson(self, brief_output=False) -> Dict[str, Any]: data["roleGroups"] = roleGroupsData return data - def fromJson(self, eventID, data, emojis, manual_load=False): + def fromJson(self, eventID, data: dict, emojis, manual_load=False): self.id = int(eventID) self.setTitle(data.get("title", TITLE)) time = datetime.datetime.strptime(data.get("time", "00:00"), "%H:%M") self.setTime(time) self.setTerrain(data.get("terrain", TERRAIN)) - self.faction = data.get("faction", FACTION) - self.port = data.get("port", cfg.PORT_DEFAULT) - self.description = data.get("description", DESCRIPTION) - self.mods = data.get("mods", MODS) + self.faction = str(data.get("faction", FACTION)) + self.port = int(data.get("port", cfg.PORT_DEFAULT)) + self.description = str(data.get("description", DESCRIPTION)) + self.mods = str(data.get("mods", MODS)) if not manual_load: - self.color = data.get("color", COLOR) - self.messageIDList = data.get("messageIDList", 0) - self.platoon_size = data.get("platoon_size", PLATOON_SIZE) - self.sideop = data.get("sideop", False) + self.color = int(data.get("color", COLOR)) + self.messageIDList = list(data.get("messageIDList", [0])) + self.platoon_size = str(data.get("platoon_size", PLATOON_SIZE)) + self.sideop = bool(data.get("sideop", False)) # TODO: Handle missing roleGroups groups: List[str] = [] for groupName, roleGroupData in data["roleGroups"].items():