diff --git a/SpriteBot.py b/SpriteBot.py index ff4d715..8eba181 100644 --- a/SpriteBot.py +++ b/SpriteBot.py @@ -2506,11 +2506,11 @@ async def addSpeciesForm(self, msg, args): await msg.channel.send(msg.author.mention + " {0} already exists!".format(species_name)) return - count = len(self.tracker) - new_idx = "{:04d}".format(count) + new_id_int = max([int(i) for i in self.tracker.keys()]) + 1 + new_idx = "{:04d}".format(new_id_int) self.tracker[new_idx] = TrackerUtils.createSpeciesNode(species_name) - await msg.channel.send(msg.author.mention + " Added #{0:03d}: {1}!".format(count, species_name)) + await msg.channel.send(msg.author.mention + " Added #{0:03d}: {1}!".format(new_id_int, species_name)) else: if species_idx is None: await msg.channel.send(msg.author.mention + " {0} doesn't exist! Create it first!".format(species_name)) @@ -2540,9 +2540,9 @@ async def addSpeciesForm(self, msg, args): if species_name == "Missingno_": canon = False - count = len(species_dict.subgroups) - new_count = "{:04d}".format(count) - species_dict.subgroups[new_count] = TrackerUtils.createFormNode(form_name, canon) + new_id_int = max([int(i) for i in species_dict.subgroups.keys()]) + 1 + new_idx = "{:04d}".format(new_id_int) + species_dict.subgroups[new_idx] = TrackerUtils.createFormNode(form_name, canon) await msg.channel.send(msg.author.mention + " Added #{0:03d}: {1} {2}!".format(int(species_idx), species_name, form_name))