From 281af6bc3d9c83843743bff129dcad9ed265b754 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Wed, 20 Jan 2021 11:58:32 -0600 Subject: [PATCH] Timings - Find bad datapacks --- cogs/timings_public.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cogs/timings_public.py b/cogs/timings_public.py index a418905..5d9d657 100644 --- a/cogs/timings_public.py +++ b/cogs/timings_public.py @@ -168,10 +168,13 @@ class Timings(commands.Cog): try: datapacks = request_raw["datapacks"] - if len(datapacks) > 2: - datapack_count = len(datapacks) - 2 - embed_var.add_field(name="❌ Datapacks", - value=f"You have {datapack_count} datapack(s). To see if they are causing lag, unzip them and look for a folder called functions. If the folder exists, remove the datapack.") + handlers = request_raw["idmap"]["handlers"] + for handler in handlers: + handler_name = request_raw["idmap"]["handlers"][handler][1] + if handler_name.startswith("Command Function - ") and handler_name.endswith(":tick"): + handler_name = handler_name.split("Command Function - ")[1].split(":tick")[0] + embed_var.add_field(name=f"❌ {handler_name}", + value=f"This datapack uses command functions which are laggy.") except KeyError as key: print("Missing: " + str(key))