From a04b7d139d82544a321ee8d91b6daa0f075f7320 Mon Sep 17 00:00:00 2001 From: granny <43185817+granny@users.noreply.github.com> Date: Wed, 13 Jan 2021 22:30:16 -0800 Subject: [PATCH] Fix duplicate Songoda fields (#13) * put songoda check into it's own for loop again * add timings hyperlink back to embed title --- cogs/timings.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index 0608b2a..9f8ff23 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -31,6 +31,7 @@ class Timings(commands.Cog): for word in words: if word.startswith("https://timings.") and "/?id=" in word: timings_url = word + embed_var.url = timings_url break if word.startswith("https://www.spigotmc.org/go/timings?url=") or word.startswith( "https://timings.spigotmc.org/?url="): @@ -186,17 +187,6 @@ class Timings(commands.Cog): else: eval_field(embed_var, stored_plugin, plugin_name, unchecked, plugins, server_properties, bukkit, spigot, paper, purpur) - if "songoda" in request["timingsMaster"]["plugins"][plugin]["authors"].casefold(): - if plugin == "EpicHeads": - embed_var.add_field(name="❌ EpicHeads", - value="This plugin was made by Songoda. Songoda resources are poorly developed and often cause problems. You should find an alternative such as [HeadsPlus](spigotmc.org/resources/headsplus-»-1-8-1-16-4.40265/) or [HeadDatabase](https://www.spigotmc.org/resources/head-database.14280/).") - elif plugin == "UltimateStacker": - embed_var.add_field(name="❌ UltimateStacker", - value="Stacking plugins actually causes more lag. " - "Remove UltimateStacker.") - else: - embed_var.add_field(name="❌ " + plugin, - value="This plugin was made by Songoda. Songoda resources are poorly developed and often cause problems. You should find an alternative.") if "config" in TIMINGS_CHECK: for config_name in TIMINGS_CHECK["config"]: config = TIMINGS_CHECK["config"][config_name] @@ -208,6 +198,23 @@ class Timings(commands.Cog): embed_var.add_field(name="Error loading YAML file", value=YAML_ERROR) + try: + for plugin in plugins: + if "songoda" in request["timingsMaster"]["plugins"][plugin]["authors"].casefold(): + if plugin == "EpicHeads": + embed_var.add_field(name="⚠ EpicHeads", + value="This plugin was made by Songoda. Songoda resources are poorly developed and often cause problems. You should find an alternative such as [HeadsPlus](spigotmc.org/resources/headsplus-»-1-8-1-16-4.40265/) or [HeadDatabase](https://www.spigotmc.org/resources/head-database.14280/).") + elif plugin == "UltimateStacker": + embed_var.add_field(name="⚠ UltimateStacker", + value="Stacking plugins actually causes more lag. " + "Remove UltimateStacker.") + else: + embed_var.add_field(name="⚠ " + plugin, + value="This plugin was made by Songoda. Songoda resources are poorly developed and often cause problems. You should find an alternative.") + except KeyError as key: + print("Missing: " + str(key)) + unchecked = unchecked + 1 + try: using_ntvd = True worlds = request_raw["worlds"]