diff options
| author | 2020-03-29 17:02:20 -0700 | |
|---|---|---|
| committer | 2020-03-29 17:07:32 -0700 | |
| commit | 0c6a5a1da30fb22f3e10400fe99bc90d77926e5d (patch) | |
| tree | f21fef5d40742d8ebdfa5c0f62a77231d578b3b4 | |
| parent | HelpChannels: fix alphabetical sorting of dormant channels (diff) | |
HelpChannels: remove positions from element names
There is no longer a reliance on static alphabetical position numbers.
| -rw-r--r-- | bot/cogs/help_channels.py | 12 | ||||
| -rw-r--r-- | bot/resources/elements.json | 240 | 
2 files changed, 125 insertions, 127 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py index 10b17cdb8..3014cffa8 100644 --- a/bot/cogs/help_channels.py +++ b/bot/cogs/help_channels.py @@ -1,7 +1,6 @@  import asyncio  import bisect  import inspect -import itertools  import json  import logging  import random @@ -259,9 +258,9 @@ class HelpChannels(Scheduler, commands.Cog):                  yield channel      @staticmethod -    def get_names() -> t.Dict[str, int]: +    def get_names() -> t.List[str]:          """ -        Return a truncated dict of prefixed element names and their alphabetical indices. +        Return a truncated list of prefixed element names.          The amount of names if configured with `HelpChannels.max_total_channels`.          The prefix is configured with `HelpChannels.name_prefix`. @@ -274,11 +273,10 @@ class HelpChannels(Scheduler, commands.Cog):          with Path("bot/resources/elements.json").open(encoding="utf-8") as elements_file:              all_names = json.load(elements_file) -        names = itertools.islice(all_names.items(), count)          if prefix: -            names = ((prefix + name, pos) for name, pos in names) - -        return dict(names) +            return [prefix + name for name in all_names[:count]] +        else: +            return all_names[:count]      def get_used_names(self) -> t.Set[str]:          """Return channels names which are already being used.""" diff --git a/bot/resources/elements.json b/bot/resources/elements.json index 6ea4964aa..2dc9b6fd6 100644 --- a/bot/resources/elements.json +++ b/bot/resources/elements.json @@ -1,120 +1,120 @@ -{ -    "hydrogen": 44, -    "helium": 42, -    "lithium": 53, -    "beryllium": 9, -    "boron": 12, -    "carbon": 18, -    "nitrogen": 69, -    "oxygen": 73, -    "fluorine": 34, -    "neon": 64, -    "sodium": 97, -    "magnesium": 56, -    "aluminium": 1, -    "silicon": 95, -    "phosphorus": 75, -    "sulfur": 99, -    "chlorine": 20, -    "argon": 4, -    "potassium": 79, -    "calcium": 16, -    "scandium": 92, -    "titanium": 109, -    "vanadium": 112, -    "chromium": 21, -    "manganese": 57, -    "iron": 48, -    "cobalt": 22, -    "nickel": 66, -    "copper": 24, -    "zinc": 116, -    "gallium": 37, -    "germanium": 38, -    "arsenic": 5, -    "selenium": 94, -    "bromine": 13, -    "krypton": 49, -    "rubidium": 88, -    "strontium": 98, -    "yttrium": 115, -    "zirconium": 117, -    "niobium": 68, -    "molybdenum": 61, -    "technetium": 101, -    "ruthenium": 89, -    "rhodium": 86, -    "palladium": 74, -    "silver": 96, -    "cadmium": 14, -    "indium": 45, -    "tin": 108, -    "antimony": 3, -    "tellurium": 102, -    "iodine": 46, -    "xenon": 113, -    "caesium": 15, -    "barium": 7, -    "lanthanum": 50, -    "cerium": 19, -    "praseodymium": 80, -    "neodymium": 63, -    "promethium": 81, -    "samarium": 91, -    "europium": 31, -    "gadolinium": 36, -    "terbium": 104, -    "dysprosium": 28, -    "holmium": 43, -    "erbium": 30, -    "thulium": 107, -    "ytterbium": 114, -    "lutetium": 55, -    "hafnium": 40, -    "tantalum": 100, -    "tungsten": 110, -    "rhenium": 85, -    "osmium": 72, -    "iridium": 47, -    "platinum": 76, -    "gold": 39, -    "mercury": 60, -    "thallium": 105, -    "lead": 52, -    "bismuth": 10, -    "polonium": 78, -    "astatine": 6, -    "radon": 84, -    "francium": 35, -    "radium": 83, -    "actinium": 0, -    "thorium": 106, -    "protactinium": 82, -    "uranium": 111, -    "neptunium": 65, -    "plutonium": 77, -    "americium": 2, -    "curium": 25, -    "berkelium": 8, -    "californium": 17, -    "einsteinium": 29, -    "fermium": 32, -    "mendelevium": 59, -    "nobelium": 70, -    "lawrencium": 51, -    "rutherfordium": 90, -    "dubnium": 27, -    "seaborgium": 93, -    "bohrium": 11, -    "hassium": 41, -    "meitnerium": 58, -    "darmstadtium": 26, -    "roentgenium": 87, -    "copernicium": 23, -    "nihonium": 67, -    "flerovium": 33, -    "moscovium": 62, -    "livermorium": 54, -    "tennessine": 103, -    "oganesson": 71 -} +[ +    "hydrogen", +    "helium", +    "lithium", +    "beryllium", +    "boron", +    "carbon", +    "nitrogen", +    "oxygen", +    "fluorine", +    "neon", +    "sodium", +    "magnesium", +    "aluminium", +    "silicon", +    "phosphorus", +    "sulfur", +    "chlorine", +    "argon", +    "potassium", +    "calcium", +    "scandium", +    "titanium", +    "vanadium", +    "chromium", +    "manganese", +    "iron", +    "cobalt", +    "nickel", +    "copper", +    "zinc", +    "gallium", +    "germanium", +    "arsenic", +    "selenium", +    "bromine", +    "krypton", +    "rubidium", +    "strontium", +    "yttrium", +    "zirconium", +    "niobium", +    "molybdenum", +    "technetium", +    "ruthenium", +    "rhodium", +    "palladium", +    "silver", +    "cadmium", +    "indium", +    "tin", +    "antimony", +    "tellurium", +    "iodine", +    "xenon", +    "caesium", +    "barium", +    "lanthanum", +    "cerium", +    "praseodymium", +    "neodymium", +    "promethium", +    "samarium", +    "europium", +    "gadolinium", +    "terbium", +    "dysprosium", +    "holmium", +    "erbium", +    "thulium", +    "ytterbium", +    "lutetium", +    "hafnium", +    "tantalum", +    "tungsten", +    "rhenium", +    "osmium", +    "iridium", +    "platinum", +    "gold", +    "mercury", +    "thallium", +    "lead", +    "bismuth", +    "polonium", +    "astatine", +    "radon", +    "francium", +    "radium", +    "actinium", +    "thorium", +    "protactinium", +    "uranium", +    "neptunium", +    "plutonium", +    "americium", +    "curium", +    "berkelium", +    "californium", +    "einsteinium", +    "fermium", +    "mendelevium", +    "nobelium", +    "lawrencium", +    "rutherfordium", +    "dubnium", +    "seaborgium", +    "bohrium", +    "hassium", +    "meitnerium", +    "darmstadtium", +    "roentgenium", +    "copernicium", +    "nihonium", +    "flerovium", +    "moscovium", +    "livermorium", +    "tennessine", +    "oganesson" +]  |