From c8cae08b2d123dcd71fcca2a926c4a13a40c9818 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 14:22:40 -0600 Subject: [PATCH 01/63] Timings - Xmx = Xms --- cogs/timings.py | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index bb4370a..9624938 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -117,32 +117,40 @@ class Timings(commands.Cog): embed_var.add_field(name="⚠ Outdated Flags", value="Add `-XX:G1MixedGCCountTarget=4` to flags", inline=True) + if "-Xmx" in flags: + max_mem = 0 + flaglist = flags.split(" ") + for flag in flaglist: + if flag.startswith("-Xmx"): + max_mem = flag.split("-Xmx")[1] + max_mem = max_mem.replace("G", "000") + max_mem = max_mem.replace("M", "") + max_mem = max_mem.replace("g", "000") + max_mem = max_mem.replace("m", "") + if int(max_mem) < 5400: + embed_var.add_field(name="⚠ Low Memory", + value="Allocate at least 6-10GB of ram to your server if you can afford it.", + inline=True) + if "-Xms" in flags: + min_mem = 0 + flaglist = flags.split(" ") + for flag in flaglist: + if flag.startswith("-Xmx"): + min_mem = flag.split("-Xmx")[1] + min_mem = min_mem.replace("G", "000") + min_mem = min_mem.replace("M", "") + min_mem = min_mem.replace("g", "000") + min_mem = min_mem.replace("m", "") + if min_mem != max_mem: + embed_var.add_field(name="⚠ Aikar's Flags", + value="Your Xmx and Xms values must be equal with Aikar's flags.", + inline=True) else: embed_var.add_field(name="⚠ Aikar's Flags", value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", inline=True) except KeyError: unchecked = unchecked + 1 - - try: - flags = r["timingsMaster"]["system"]["flags"] - if "-Xmx" in flags: - max_mem = 0 - flaglist = flags.split(" ") - for flag in flaglist: - if flag.startswith("-Xmx"): - max_mem = flag.split("-Xmx")[1] - max_mem = max_mem.replace("G", "000") - max_mem = max_mem.replace("M", "") - max_mem = max_mem.replace("g", "000") - max_mem = max_mem.replace("m", "") - if int(max_mem) < 5400: - embed_var.add_field(name="⚠ Low Memory", - value="Allocate at least 6-10GB of ram to your server if you can afford it.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - try: cpu = int(r["timingsMaster"]["system"]["cpu"]) if cpu <= 2: From 47983c8a5e1310b954ea1c149d72d1c6d50e4a9d Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 14:27:16 -0600 Subject: [PATCH 02/63] Update timings.py --- cogs/timings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index 9624938..40e12f4 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -135,8 +135,8 @@ class Timings(commands.Cog): min_mem = 0 flaglist = flags.split(" ") for flag in flaglist: - if flag.startswith("-Xmx"): - min_mem = flag.split("-Xmx")[1] + if flag.startswith("-Xms"): + min_mem = flag.split("-Xms")[1] min_mem = min_mem.replace("G", "000") min_mem = min_mem.replace("M", "") min_mem = min_mem.replace("g", "000") From 5b7cdc07806317424081ede69499fb585b6eb02d Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 15:08:57 -0600 Subject: [PATCH 03/63] Timings - More anticheat recs --- cogs/timings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/timings.py b/cogs/timings.py index 40e12f4..140653b 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -230,7 +230,7 @@ class Timings(commands.Cog): if "Spartan" in plugins: embed_var.add_field(name="⚠ Spartan", value="Spartan is a laggy anticheat. " - "Consider replacing it with [Matrix](https://matrix.rip/).", + "Consider replacing it with [Matrix](https://matrix.rip/), [NCP](https://ci.codemc.io/job/Updated-NoCheatPlus/job/Updated-NoCheatPlus/), or [AAC](https://www.spigotmc.org/resources/aac-advanced-anti-cheat-hack-kill-aura-blocker.6442/).", inline=True) if "IllegalStack" in plugins: embed_var.add_field(name="⚠ IllegalStack", From 93980572e6e25e6ca9eac0635b34013e0566da84 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 15:14:30 -0600 Subject: [PATCH 04/63] Timings - Aikar's old flags --- cogs/timings.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cogs/timings.py b/cogs/timings.py index 140653b..ce84111 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -145,6 +145,10 @@ class Timings(commands.Cog): embed_var.add_field(name="⚠ Aikar's Flags", value="Your Xmx and Xms values must be equal with Aikar's flags.", inline=True) + elif "-Dusing.aikars.flags=mcflags.emc.gs" in flags: + embed_var.add_field(name="⚠ Outdated Flags", + value="Update [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", + inline=True) else: embed_var.add_field(name="⚠ Aikar's Flags", value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", From fb88f74d87216560961d5b3ca8aa1c53e0f17748 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 15:15:16 -0600 Subject: [PATCH 05/63] Timings - X emoji --- cogs/timings.py | 214 ++++++++++++++++++++++++------------------------ 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index ce84111..db47a8a 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -52,17 +52,17 @@ class Timings(commands.Cog): try: version = r["timingsMaster"]["version"] if "1.16.4" not in version: - embed_var.add_field(name="⚠ Legacy Build", + embed_var.add_field(name="❌ Legacy Build", value="Update to 1.16.4.", inline=True) using_yatopia = "yatopia" in r["timingsMaster"]["config"] if using_yatopia: - embed_var.add_field(name="⚠ Yatopia", + embed_var.add_field(name="❌ Yatopia", value="Yatopia is prone to bugs. " "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).", inline=True) elif "Paper" in version: - embed_var.add_field(name="||⚠ Paper||", + embed_var.add_field(name="||❌ Paper||", value="||Purpur has more optimizations but is generally less supported. " "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).||", inline=True) @@ -74,7 +74,7 @@ class Timings(commands.Cog): bungeecord = r["timingsMaster"]["config"]["spigot"]["settings"]["bungeecord"] if not online_mode and bungeecord == "false": if not online_mode and bungeecord == "false": - embed_var.add_field(name="⚠ online-mode", + embed_var.add_field(name="❌ online-mode", value="Enable this in server.properties for security.", inline=True) except KeyError: @@ -83,7 +83,7 @@ class Timings(commands.Cog): try: timing_cost = int(r["timingsMaster"]["system"]["timingcost"]) if timing_cost > 400: - embed_var.add_field(name="⚠ Timingcost", + embed_var.add_field(name="❌ Timingcost", value="Your cpu is overloaded. Find a better host.", inline=True) except KeyError: @@ -92,7 +92,7 @@ class Timings(commands.Cog): try: jvm_version = r["timingsMaster"]["system"]["jvmversion"] if "1.8.0_" in jvm_version or jvm_version.startswith("9.") or jvm_version.startswith("10."): - embed_var.add_field(name="⚠ Java Version", + embed_var.add_field(name="❌ Java Version", value="Use Java 11.", inline=True) @@ -105,16 +105,16 @@ class Timings(commands.Cog): jvm_version = r["timingsMaster"]["system"]["jvmversion"] java_version = jvm_version.split(".")[0] if int(java_version) < 14: - embed_var.add_field(name="⚠ Java " + java_version, + embed_var.add_field(name="❌ Java " + java_version, value="If you are going to use ZGC, you should also use Java 14 or 15.", inline=True) elif "-Daikars.new.flags=true" in flags: if "-XX:+PerfDisableSharedMem" not in flags: - embed_var.add_field(name="⚠ Outdated Flags", + embed_var.add_field(name="❌ Outdated Flags", value="Add `-XX:+PerfDisableSharedMem` to flags", inline=True) if "XX:G1MixedGCCountTarget=4" not in flags: - embed_var.add_field(name="⚠ Outdated Flags", + embed_var.add_field(name="❌ Outdated Flags", value="Add `-XX:G1MixedGCCountTarget=4` to flags", inline=True) if "-Xmx" in flags: @@ -128,7 +128,7 @@ class Timings(commands.Cog): max_mem = max_mem.replace("g", "000") max_mem = max_mem.replace("m", "") if int(max_mem) < 5400: - embed_var.add_field(name="⚠ Low Memory", + embed_var.add_field(name="❌ Low Memory", value="Allocate at least 6-10GB of ram to your server if you can afford it.", inline=True) if "-Xms" in flags: @@ -142,15 +142,15 @@ class Timings(commands.Cog): min_mem = min_mem.replace("g", "000") min_mem = min_mem.replace("m", "") if min_mem != max_mem: - embed_var.add_field(name="⚠ Aikar's Flags", + embed_var.add_field(name="❌ Aikar's Flags", value="Your Xmx and Xms values must be equal with Aikar's flags.", inline=True) elif "-Dusing.aikars.flags=mcflags.emc.gs" in flags: - embed_var.add_field(name="⚠ Outdated Flags", + embed_var.add_field(name="❌ Outdated Flags", value="Update [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", inline=True) else: - embed_var.add_field(name="⚠ Aikar's Flags", + embed_var.add_field(name="❌ Aikar's Flags", value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", inline=True) except KeyError: @@ -158,7 +158,7 @@ class Timings(commands.Cog): try: cpu = int(r["timingsMaster"]["system"]["cpu"]) if cpu <= 2: - embed_var.add_field(name="⚠ Threads", + embed_var.add_field(name="❌ Threads", value="You have only " + str(cpu) + " thread(s). Find a [better host](https://www.birdflop.com).", inline=True) except KeyError: @@ -167,123 +167,123 @@ class Timings(commands.Cog): try: plugins = r["timingsMaster"]["plugins"] if "ClearLag" in plugins: - embed_var.add_field(name="⚠ ClearLag", + embed_var.add_field(name="❌ ClearLag", value="Plugins that claim to remove lag actually cause more lag. " "Remove ClearLag.", inline=True) if "LagAssist" in plugins: - embed_var.add_field(name="⚠ LagAssist", + embed_var.add_field(name="❌ LagAssist", value="Plugins that claim to remove lag actually cause more lag. " "Remove LagAssist.", inline=True) if "NoChunkLag" in plugins: - embed_var.add_field(name="⚠ NoChunkLag", + embed_var.add_field(name="❌ NoChunkLag", value="Plugins that claim to remove lag actually cause more lag. " "Remove NoChunkLag.", inline=True) if "ServerBooster" in plugins: - embed_var.add_field(name="⚠ ServerBooster", + embed_var.add_field(name="❌ ServerBooster", value="Plugins that claim to remove lag actually cause more lag. " "Remove ServerBooster.", inline=True) if "LimitPillagers" in plugins: - embed_var.add_field(name="⚠ LimitPillagers", + embed_var.add_field(name="❌ LimitPillagers", value="You probably don't need LimitPillagers as Paper already adds its features. " "Remove LimitPillagers.", inline=True) if "VillagerOptimiser" in plugins: - embed_var.add_field(name="⚠ VillagerOptimiser", + embed_var.add_field(name="❌ VillagerOptimiser", value="You probably don't need VillagerOptimiser as Paper already adds its features. " "See entity-activation-range in spigot.yml.", inline=True) if "StackMob" in plugins: - embed_var.add_field(name="⚠ StackMob", + embed_var.add_field(name="❌ StackMob", value="Stacking plugins actually cause more lag. " "Remove StackMob.", inline=True) if "Stacker" in plugins: - embed_var.add_field(name="⚠ Stacker", + embed_var.add_field(name="❌ Stacker", value="Stacking plugins actually cause more lag. " "Remove Stacker.", inline=True) if "MobStacker" in plugins: - embed_var.add_field(name="⚠ MobStacker", + embed_var.add_field(name="❌ MobStacker", value="Stacking plugins actually cause more lag. " "Remove MobStacker.", inline=True) if "WildStacker" in plugins: - embed_var.add_field(name="⚠ WildStacker", + embed_var.add_field(name="❌ WildStacker", value="Stacking plugins actually cause more lag. " "Remove WildStacker.", inline=True) if "SuggestionBlocker" in plugins: - embed_var.add_field(name="⚠ SuggestionBlocker", + embed_var.add_field(name="❌ SuggestionBlocker", value="You probably don't need SuggestionBlocker as Spigot already adds its features. " "Set tab-complete to -1 in spigot.yml.", inline=True) if "FastAsyncWorldEdit" in plugins: - embed_var.add_field(name="⚠ FastAsyncWorldEdit", + embed_var.add_field(name="❌ FastAsyncWorldEdit", value="FAWE can corrupt your world. " "Consider replacing FAWE with [Worldedit](https://enginehub.org/worldedit/#downloads).", inline=True) if "CMI" in plugins: - embed_var.add_field(name="⚠ CMI", + embed_var.add_field(name="❌ CMI", value="CMI is a buggy plugin. " "Consider replacing CMI with [EssentialsX](https://essentialsx.net/downloads.html).", inline=True) if "Spartan" in plugins: - embed_var.add_field(name="⚠ Spartan", + embed_var.add_field(name="❌ Spartan", value="Spartan is a laggy anticheat. " "Consider replacing it with [Matrix](https://matrix.rip/), [NCP](https://ci.codemc.io/job/Updated-NoCheatPlus/job/Updated-NoCheatPlus/), or [AAC](https://www.spigotmc.org/resources/aac-advanced-anti-cheat-hack-kill-aura-blocker.6442/).", inline=True) if "IllegalStack" in plugins: - embed_var.add_field(name="⚠ IllegalStack", + embed_var.add_field(name="❌ IllegalStack", value="You probably don't need IllegalStack as Paper already has its features. " "Remove IllegalStack.", inline=True) if "ExploitFixer" in plugins: - embed_var.add_field(name="⚠ ExploitFixer", + embed_var.add_field(name="❌ ExploitFixer", value="You probably don't need ExploitFixer as Paper already has its features. " "Remove ExploitFixer.", inline=True) if "EntityTrackerFixer" in plugins: - embed_var.add_field(name="⚠ EntityTrackerFixer", + embed_var.add_field(name="❌ EntityTrackerFixer", value="You probably don't need EntityTrackerFixer as Paper already has its features. " "Remove EntityTrackerFixer.", inline=True) if "Orebfuscator" in plugins: - embed_var.add_field(name="⚠ Orebfuscator", + embed_var.add_field(name="❌ Orebfuscator", value="You probably don't need Orebfuscator as Paper already has its features. " "Remove Orebfuscator.", inline=True) if "ImageOnMap" in plugins: - embed_var.add_field(name="⚠ ImageOnMap", + embed_var.add_field(name="❌ ImageOnMap", value="This plugin has a [memory leak](https://github.com/zDevelopers/ImageOnMap/issues/104). If it is not essential, you should remove it. " "Consider replacing it with [DrMap](https://www.spigotmc.org/resources/drmap.87368/).", inline=True) if "CrazyActions" in plugins: - embed_var.add_field(name="⚠ CrazyAuctions", + embed_var.add_field(name="❌ CrazyAuctions", value="CrazyAuctions is a laggy plugin, even according to the developer. " "Consider replacing it with [AuctionHouse](https://www.spigotmc.org/resources/auctionhouse.61836/).", inline=True) if "GroupManager" in plugins: - embed_var.add_field(name="⚠ GroupManager", + embed_var.add_field(name="❌ GroupManager", value="GroupManager is an outdated permission plugin. " "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", inline=True) if "PermissionsEx" in plugins: - embed_var.add_field(name="⚠ PermissionsEx", + embed_var.add_field(name="❌ PermissionsEx", value="PermissionsEx is an outdated permission plugin. " "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", inline=True) if "bPermissions" in plugins: - embed_var.add_field(name="⚠ bPermissions", + embed_var.add_field(name="❌ bPermissions", value="bPermissions is an outdated permission plugin. " "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", inline=True) for plugin in plugins: if "Songoda" in r["timingsMaster"]["plugins"][plugin]["authors"]: - embed_var.add_field(name="⚠ " + plugin, + embed_var.add_field(name="❌ " + plugin, value="This plugin was made by Songoda. You should find an alternative.", inline=True) except KeyError: @@ -294,17 +294,17 @@ class Timings(commands.Cog): if using_purpur: plugins = r["timingsMaster"]["plugins"] if "SilkSpawners" in plugins: - embed_var.add_field(name="⚠ SilkSpawners", + embed_var.add_field(name="❌ SilkSpawners", value="You probably don't need SilkSpawners as Purpur already has its features. " "Remove SilkSpawners.", inline=True) if "MineableSpawners" in plugins: - embed_var.add_field(name="⚠ MineableSpawners", + embed_var.add_field(name="❌ MineableSpawners", value="You probably don't need MineableSpawners as Purpur already has its features. " "Remove MineableSpawners.", inline=True) if "VillagerLobotomizatornator" in plugins: - embed_var.add_field(name="⚠ LimitPillagers", + embed_var.add_field(name="❌ LimitPillagers", value="You probably don't need VillagerLobotomizatornator as Purpur already adds its features. " "Enable villager.lobotomize.enabled in purpur.yml.", inline=True) @@ -317,12 +317,12 @@ class Timings(commands.Cog): phantoms_only_insomniacs = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ "phantoms-only-attack-insomniacs"] if phantoms_only_insomniacs == "false": - embed_var.add_field(name="⚠ PhantomSMP", + embed_var.add_field(name="❌ PhantomSMP", value="You probably don't need PhantomSMP as Paper already has its features. " "Remove PhantomSMP.", inline=True) else: - embed_var.add_field(name="⚠ PhantomSMP", + embed_var.add_field(name="❌ PhantomSMP", value="You probably don't need PhantomSMP as Paper already has its features. " "Enable phantoms-only-attack-insomniacs in paper.yml.", inline=True) @@ -334,11 +334,11 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["server.properties"]["network-compression-threshold"]) bungeecord = r["timingsMaster"]["config"]["spigot"]["settings"]["bungeecord"] if network_compression_threshold == 256 and bungeecord == "false": - embed_var.add_field(name="⚠ network-compression-threshold", + embed_var.add_field(name="❌ network-compression-threshold", value="Increase this in server.properties. Recommended: 512.", inline=True) if network_compression_threshold != -1 and bungeecord == "true": - embed_var.add_field(name="⚠ network-compression-threshold", + embed_var.add_field(name="❌ network-compression-threshold", value="Set this to -1 in server.properties for a bungee server like yours.", inline=True) except KeyError: @@ -348,7 +348,7 @@ class Timings(commands.Cog): spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["view-distance"] view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) if view_distance == 10 and spigot_view_distance == "default": - embed_var.add_field(name="⚠ view-distance", + embed_var.add_field(name="❌ view-distance", value="Decrease this from default (10) in spigot.yml. " "Recommended: 3.", inline=True) @@ -358,7 +358,7 @@ class Timings(commands.Cog): try: chunk_gc_period = int(r["timingsMaster"]["config"]["bukkit"]["chunk-gc"]["period-in-ticks"]) if chunk_gc_period == 600: - embed_var.add_field(name="⚠ chunk-gc.period-in-ticks", + embed_var.add_field(name="❌ chunk-gc.period-in-ticks", value="Decrease this in bukkit.yml.\nRecommended: 400.", inline=True) except KeyError: @@ -367,7 +367,7 @@ class Timings(commands.Cog): try: ticks_per_monster_spawns = int(r["timingsMaster"]["config"]["bukkit"]["ticks-per"]["monster-spawns"]) if ticks_per_monster_spawns == 1: - embed_var.add_field(name="⚠ ticks-per.monster-spawns", + embed_var.add_field(name="❌ ticks-per.monster-spawns", value="Increase this in bukkit.yml.\nRecommended: 4.", inline=True) except KeyError: @@ -376,7 +376,7 @@ class Timings(commands.Cog): try: monsters_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["monsters"]) if monsters_spawn_limit == 70: - embed_var.add_field(name="⚠ spawn-limits.monsters", + embed_var.add_field(name="❌ spawn-limits.monsters", value="Decrease this in bukkit.yml.\nRecommended: 15.", inline=True) except KeyError: @@ -385,7 +385,7 @@ class Timings(commands.Cog): try: water_ambient_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["water-ambient"]) if water_ambient_spawn_limit == 20: - embed_var.add_field(name="⚠ spawn-limits.water-ambient", + embed_var.add_field(name="❌ spawn-limits.water-ambient", value="Decrease this in bukkit.yml.\nRecommended: 2.", inline=True) except KeyError: @@ -394,7 +394,7 @@ class Timings(commands.Cog): try: ambient_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["ambient"]) if ambient_spawn_limit == 15: - embed_var.add_field(name="⚠ spawn-limits.ambient", + embed_var.add_field(name="❌ spawn-limits.ambient", value="Decrease this in bukkit.yml.\nRecommended: 1.", inline=True) except KeyError: @@ -403,7 +403,7 @@ class Timings(commands.Cog): try: animals_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["animals"]) if animals_spawn_limit == 10: - embed_var.add_field(name="⚠ spawn-limits.animals", + embed_var.add_field(name="❌ spawn-limits.animals", value="Decrease this in bukkit.yml.\nRecommended: 3.", inline=True) except KeyError: @@ -412,7 +412,7 @@ class Timings(commands.Cog): try: water_animals_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["water-animals"]) if water_animals_spawn_limit == 15: - embed_var.add_field(name="⚠ spawn-limits.water-animals", + embed_var.add_field(name="❌ spawn-limits.water-animals", value="Decrease this in bukkit.yml.\nRecommended: 2.", inline=True) except KeyError: @@ -424,12 +424,12 @@ class Timings(commands.Cog): if spigot_view_distance == "default": view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) if mob_spawn_range == 8 and view_distance <= 6: - embed_var.add_field(name="⚠ mob-spawn-range", + embed_var.add_field(name="❌ mob-spawn-range", value="Decrease this in spigot.yml. " "Recommended: " + str(view_distance - 1) + ".", inline=True) elif mob_spawn_range == 8 and int(spigot_view_distance) <= 6: - embed_var.add_field(name="⚠ mob-spawn-range", + embed_var.add_field(name="❌ mob-spawn-range", value="Decrease this in spigot.yml. " "Recommended: " + str(spigot_view_distance - 1) + ".", inline=True) @@ -441,7 +441,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "animals"]) if animals_entity_activation_range == 32: - embed_var.add_field(name="⚠ entity-activation-range.animals", + embed_var.add_field(name="❌ entity-activation-range.animals", value="Decrease this in spigot.yml. " "Recommended: 6.", inline=True) @@ -453,7 +453,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "monsters"]) if monsters_entity_activation_range == 32: - embed_var.add_field(name="⚠ entity-activation-range.monsters", + embed_var.add_field(name="❌ entity-activation-range.monsters", value="Decrease this in spigot.yml. " "Recommended: 16.", inline=True) @@ -471,7 +471,7 @@ class Timings(commands.Cog): misc_entity_activation_range = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"]["misc"]) if misc_entity_activation_range == 16: - embed_var.add_field(name="⚠ entity-activation-range.misc", + embed_var.add_field(name="❌ entity-activation-range.misc", value="Decrease this in spigot.yml. " "Recommended: 4.", inline=True) @@ -482,7 +482,7 @@ class Timings(commands.Cog): water_entity_activation_range = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"]["water"]) if water_entity_activation_range == 16: - embed_var.add_field(name="⚠ entity-activation-range.water", + embed_var.add_field(name="❌ entity-activation-range.water", value="Decrease this in spigot.yml. " "Recommended: 12.", inline=True) @@ -494,7 +494,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "villagers"]) if villagers_entity_activation_range == 32: - embed_var.add_field(name="⚠ entity-activation-range.villagers", + embed_var.add_field(name="❌ entity-activation-range.villagers", value="Decrease this in spigot.yml. " "Recommended: 16.", inline=True) @@ -513,7 +513,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "tick-inactive-villagers"] if tick_inactive_villagers == "true": - embed_var.add_field(name="⚠ tick-inactive-villagers", + embed_var.add_field(name="❌ tick-inactive-villagers", value="Disable this in spigot.yml.", inline=True) except KeyError: @@ -522,7 +522,7 @@ class Timings(commands.Cog): try: nerf_spawner_mobs = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["nerf-spawner-mobs"] if nerf_spawner_mobs == "false": - embed_var.add_field(name="⚠ nerf-spawner-mobs", + embed_var.add_field(name="❌ nerf-spawner-mobs", value="Enable this in spigot.yml.", inline=True) except KeyError: @@ -539,7 +539,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "wake-up-inactive"]["villagers-every"]) if wake_up_inactive_villagers_for == 100: - embed_var.add_field(name="⚠ wake-up-inactive.villagers-for", + embed_var.add_field(name="❌ wake-up-inactive.villagers-for", value="Decrease this in spigot.yml. " "Recommended: 20.", inline=True) @@ -551,7 +551,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "wake-up-inactive"]["villagers-every"]) if wake_up_inactive_flying_monsters_for == 100: - embed_var.add_field(name="⚠ wake-up-inactive.flying-monsters-for", + embed_var.add_field(name="❌ wake-up-inactive.flying-monsters-for", value="Decrease this in spigot.yml. " "Recommended: 60.", inline=True) @@ -571,7 +571,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "wake-up-inactive"]["villagers-every"]) if wake_up_inactive_villagers_max_per_tick == 4: - embed_var.add_field(name="⚠ wake-up-inactive.villagers-max-per-tick", + embed_var.add_field(name="❌ wake-up-inactive.villagers-max-per-tick", value="Decrease this in spigot.yml. " "Recommended: 1.", inline=True) @@ -583,7 +583,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "wake-up-inactive"]["villagers-every"]) if wake_up_inactive_animals_for == 100: - embed_var.add_field(name="⚠ wake-up-inactive.animals-for", + embed_var.add_field(name="❌ wake-up-inactive.animals-for", value="Decrease this in spigot.yml. " "Recommended: 40.", inline=True) @@ -595,7 +595,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "wake-up-inactive"]["villagers-every"]) if wake_up_inactive_monsters_max_per_tick == 8: - embed_var.add_field(name="⚠ wake-up-inactive.monsters-max-per-tick", + embed_var.add_field(name="❌ wake-up-inactive.monsters-max-per-tick", value="Decrease this in spigot.yml. " "Recommended: 4.", inline=True) @@ -607,7 +607,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "wake-up-inactive"]["villagers-every"]) if wake_up_inactive_flying_monsters_max_per_tick == 8: - embed_var.add_field(name="⚠ wake-up-inactive.flying-monsters-max-per-tick", + embed_var.add_field(name="❌ wake-up-inactive.flying-monsters-max-per-tick", value="Decrease this in spigot.yml. " "Recommended: 1.", inline=True) @@ -633,7 +633,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "wake-up-inactive"]["villagers-every"]) if wake_up_inactive_animals_max_per_tick == 4: - embed_var.add_field(name="⚠ wake-up-inactive.animals-max-per-tick", + embed_var.add_field(name="❌ wake-up-inactive.animals-max-per-tick", value="Decrease this in spigot.yml. " "Recommended: 2.", inline=True) @@ -645,7 +645,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "wake-up-inactive"]["villagers-every"]) if wake_up_inactive_monsters_for == 100: - embed_var.add_field(name="⚠ wake-up-inactive.monsters-for", + embed_var.add_field(name="❌ wake-up-inactive.monsters-for", value="Decrease this in spigot.yml. " "Recommended: 60.", inline=True) @@ -656,7 +656,7 @@ class Timings(commands.Cog): arrow_despawn_rate = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["arrow-despawn-rate"]) if arrow_despawn_rate == 1200: - embed_var.add_field(name="⚠ arrow-despawn-rate", + embed_var.add_field(name="❌ arrow-despawn-rate", value="Decrease this in spigot.yml. " "Recommended: 300.", inline=True) @@ -667,7 +667,7 @@ class Timings(commands.Cog): item_merge_radius = float( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["merge-radius"]["item"]) if item_merge_radius == 2.5: - embed_var.add_field(name="⚠ merge-radius.item", + embed_var.add_field(name="❌ merge-radius.item", value="Increase this in spigot.yml. " "Recommended: 4.0.", inline=True) @@ -678,7 +678,7 @@ class Timings(commands.Cog): exp_merge_radius = float( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["merge-radius"]["exp"]) if exp_merge_radius == 3.0: - embed_var.add_field(name="⚠ merge-radius.exp", + embed_var.add_field(name="❌ merge-radius.exp", value="Increase this in spigot.yml. " "Recommended: 6.0.", inline=True) @@ -689,7 +689,7 @@ class Timings(commands.Cog): max_entity_collisions = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["max-entity-collisions"]) if max_entity_collisions == 8: - embed_var.add_field(name="⚠ max-entity-collisions", + embed_var.add_field(name="❌ max-entity-collisions", value="Decrease this in spigot.yml. " "Recommended: 2.", inline=True) @@ -700,7 +700,7 @@ class Timings(commands.Cog): max_auto_save_chunks_per_tick = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["max-auto-save-chunks-per-tick"]) if max_auto_save_chunks_per_tick == 24: - embed_var.add_field(name="⚠ max-auto-save-chunks-per-tick", + embed_var.add_field(name="❌ max-auto-save-chunks-per-tick", value="Decrease this in paper.yml. " "Recommended: 6.", inline=True) @@ -711,7 +711,7 @@ class Timings(commands.Cog): optimize_explosions = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ "optimize-explosions"] if optimize_explosions == "false": - embed_var.add_field(name="⚠ optimize-explosions", + embed_var.add_field(name="❌ optimize-explosions", value="Enable this in paper.yml.", inline=True) except KeyError: @@ -721,7 +721,7 @@ class Timings(commands.Cog): mob_spawner_tick_rate = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["mob-spawner-tick-rate"]) if mob_spawner_tick_rate == 1: - embed_var.add_field(name="⚠ mob-spawner-tick-rate", + embed_var.add_field(name="❌ mob-spawner-tick-rate", value="Increase this in paper.yml. " "Recommended: 2.", inline=True) @@ -733,7 +733,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["game-mechanics"][ "disable-chest-cat-detection"] if disable_chest_cat_detection == "false": - embed_var.add_field(name="⚠ disable-chest-cat-detection", + embed_var.add_field(name="❌ disable-chest-cat-detection", value="Enable this in paper.yml.", inline=True) except KeyError: @@ -743,7 +743,7 @@ class Timings(commands.Cog): container_update_tick_rate = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["container-update-tick-rate"]) if container_update_tick_rate == "false": - embed_var.add_field(name="⚠ container-update-tick-rate", + embed_var.add_field(name="❌ container-update-tick-rate", value="Increase this in paper.yml. " "Recommended: 3.", inline=True) @@ -754,7 +754,7 @@ class Timings(commands.Cog): grass_spread_tick_rate = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["grass-spread-tick-rate"]) if grass_spread_tick_rate == 1: - embed_var.add_field(name="⚠ grass-spread-tick-rate", + embed_var.add_field(name="❌ grass-spread-tick-rate", value="Increase this in paper.yml. " "Recommended: 4", inline=True) @@ -765,7 +765,7 @@ class Timings(commands.Cog): soft_despawn_range = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["despawn-ranges"]["soft"]) if soft_despawn_range == 32: - embed_var.add_field(name="⚠ despawn-ranges.soft", + embed_var.add_field(name="❌ despawn-ranges.soft", value="Decrease this in paper.yml. " "Recommended: 28", inline=True) @@ -775,7 +775,7 @@ class Timings(commands.Cog): try: hard_despawn_range = int(r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["despawn-ranges"]["soft"]) if hard_despawn_range == 128: - embed_var.add_field(name="⚠ despawn-ranges.hard", + embed_var.add_field(name="❌ despawn-ranges.hard", value="Decrease this in paper.yml. " "Recommended: 48", inline=True) @@ -786,7 +786,7 @@ class Timings(commands.Cog): hopper_disable_move_event = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["hopper"][ "disable-move-event"] if hopper_disable_move_event == "false": - embed_var.add_field(name="⚠ hopper.disable-move-event", + embed_var.add_field(name="❌ hopper.disable-move-event", value="Enable this in paper.yml.", inline=True) except KeyError: @@ -796,7 +796,7 @@ class Timings(commands.Cog): non_player_arrow_despawn_rate = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["non-player-arrow-despawn-rate"]) if non_player_arrow_despawn_rate == -1: - embed_var.add_field(name="⚠ non-player-arrow-despawn-rate", + embed_var.add_field(name="❌ non-player-arrow-despawn-rate", value="Set a value in paper.yml. " "Recommended: 60", inline=True) @@ -807,7 +807,7 @@ class Timings(commands.Cog): creative_arrow_despawn_rate = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["creative-arrow-despawn-rate"]) if creative_arrow_despawn_rate == -1: - embed_var.add_field(name="⚠ creative-arrow-despawn-rate", + embed_var.add_field(name="❌ creative-arrow-despawn-rate", value="Set a value in paper.yml. " "Recommended: 60", inline=True) @@ -818,7 +818,7 @@ class Timings(commands.Cog): prevent_moving_into_unloaded_chunks = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ "prevent-moving-into-unloaded-chunks"] if prevent_moving_into_unloaded_chunks == "false": - embed_var.add_field(name="⚠ prevent-moving-into-unloaded-chunks", + embed_var.add_field(name="❌ prevent-moving-into-unloaded-chunks", value="Enable this in paper.yml.", inline=True) except KeyError: @@ -828,7 +828,7 @@ class Timings(commands.Cog): eigencraft_redstone = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ "use-faster-eigencraft-redstone"] if eigencraft_redstone == "false": - embed_var.add_field(name="⚠ use-faster-eigencraft-redstone", + embed_var.add_field(name="❌ use-faster-eigencraft-redstone", value="Enable this in paper.yml.", inline=True) except KeyError: @@ -837,7 +837,7 @@ class Timings(commands.Cog): try: fix_climbing_bypass_gamerule = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["fix-climbing-bypassing-cramming-rule"] if fix_climbing_bypass_gamerule == "false": - embed_var.add_field(name="⚠ fix-climbing-bypassing-cramming-rule", + embed_var.add_field(name="❌ fix-climbing-bypassing-cramming-rule", value="Enable this in paper.yml.", inline=True) except KeyError: @@ -846,7 +846,7 @@ class Timings(commands.Cog): try: armor_stands_do_collision_entity_lookups = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["armor-stands-do-collision-entity-lookups"] if armor_stands_do_collision_entity_lookups == "true": - embed_var.add_field(name="⚠ armor-stands-do-collision-entity-lookups", + embed_var.add_field(name="❌ armor-stands-do-collision-entity-lookups", value="Disable this in paper.yml.", inline=True) except KeyError: @@ -856,7 +856,7 @@ class Timings(commands.Cog): plugins = r["timingsMaster"]["plugins"] armor_stands_tick = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["armor-stands-tick"] if armor_stands_tick == "true" and "PetBlocks" not in plugins and "BlockBalls" not in plugins and "ArmorStandTools" not in plugins: - embed_var.add_field(name="⚠ armor-stands-tick", + embed_var.add_field(name="❌ armor-stands-tick", value="Disable this in paper.yml.", inline=True) except KeyError: @@ -866,7 +866,7 @@ class Timings(commands.Cog): per_player_mob_spawns = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ "per-player-mob-spawns"] if per_player_mob_spawns == "false": - embed_var.add_field(name="⚠ per-player-mob-spawns", + embed_var.add_field(name="❌ per-player-mob-spawns", value="Enable this in paper.yml.", inline=True) except KeyError: @@ -876,7 +876,7 @@ class Timings(commands.Cog): alt_item_despawn_rate_enabled = \ r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["alt-item-despawn-rate"]["enabled"] if alt_item_despawn_rate_enabled == "false": - embed_var.add_field(name="⚠ alt-item-despawn-rate.enabled", + embed_var.add_field(name="❌ alt-item-despawn-rate.enabled", value="Enable this in paper.yml.", inline=True) except KeyError: @@ -892,13 +892,13 @@ class Timings(commands.Cog): if spigot_view_distance == "default": view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) if view_distance >= 4: - embed_var.add_field(name="⚠ no-tick-view-distance", + embed_var.add_field(name="❌ no-tick-view-distance", value="Set a value in paper.yml. " "Recommended: " + str( view_distance) + ". And reduce view-distance in server.properties. Recommended: 3.", inline=True) elif int(spigot_view_distance) >= 4: - embed_var.add_field(name="⚠ no-tick-view-distance", + embed_var.add_field(name="❌ no-tick-view-distance", value="Set a value in paper.yml. " "Recommended: " + spigot_view_distance + ". And reduce view-distance in spigot.yml. Recommended: 3.", inline=True) @@ -909,7 +909,7 @@ class Timings(commands.Cog): enable_treasure_maps = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ "enable-treasure-maps"] if enable_treasure_maps == "true": - embed_var.add_field(name="⚠ enable-treasure-maps", + embed_var.add_field(name="❌ enable-treasure-maps", value="Disable this in paper.yml. Why? Generating treasure maps is extremely expensive and can hang a server if the structure it's trying to locate is really far away.", inline=True) except KeyError: @@ -919,7 +919,7 @@ class Timings(commands.Cog): projectile_load_save = int(r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ "projectile-load-save-per-chunk-limit"]) if projectile_load_save == -1: - embed_var.add_field(name="⚠ projectile-load-save-per-chunk-limit", + embed_var.add_field(name="❌ projectile-load-save-per-chunk-limit", value="Set a value in paper.yml. Recommended: 8.", inline=True) except KeyError: @@ -928,11 +928,11 @@ class Timings(commands.Cog): try: use_alternate_keepalive = r["timingsMaster"]["config"]["purpur"]["settings"]["use-alternate-keepalive"] if use_alternate_keepalive == "false" and "TCPShield" not in plugins: - embed_var.add_field(name="⚠ use-alternate-keepalive", + embed_var.add_field(name="❌ use-alternate-keepalive", value="Enable this in purpur.yml.", inline=True) if use_alternate_keepalive == "true" and "TCPShield" in plugins: - embed_var.add_field(name="⚠ use-alternate-keepalive", + embed_var.add_field(name="❌ use-alternate-keepalive", value="Disable this in purpur.yml. It causes issues with TCPShield.", inline=True) except KeyError: @@ -942,7 +942,7 @@ class Timings(commands.Cog): dont_send_useless_entity_packets = r["timingsMaster"]["config"]["purpur"]["settings"][ "dont-send-useless-entity-packets"] if dont_send_useless_entity_packets == "false": - embed_var.add_field(name="⚠ dont-send-useless-entity-packets", + embed_var.add_field(name="❌ dont-send-useless-entity-packets", value="Enable this in purpur.yml.", inline=True) except KeyError: @@ -953,7 +953,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["dolphin"][ "disable-treasure-searching"] if disable_treasure_searching == "false": - embed_var.add_field(name="⚠ dolphin.disable-treasure-searching", + embed_var.add_field(name="❌ dolphin.disable-treasure-searching", value="Enable this in purpur.yml.", inline=True) except KeyError: @@ -964,7 +964,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ "brain-ticks"]) if brain_ticks == 1: - embed_var.add_field(name="⚠ villager.brain-ticks", + embed_var.add_field(name="❌ villager.brain-ticks", value="Increase this in purpur.yml. " "Recommended: 4.", inline=True) @@ -976,7 +976,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ "spawn-iron-golem"]["radius"]) if iron_golem_radius == 0: - embed_var.add_field(name="⚠ spawn-iron-golem.radius", + embed_var.add_field(name="❌ spawn-iron-golem.radius", value="Set a value in purpur.yml. " "Recommended: 32.", inline=True) @@ -988,7 +988,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ "spawn-iron-golem"]["limit"]) if iron_golem_limit == 0: - embed_var.add_field(name="⚠ spawn-iron-golem.limit", + embed_var.add_field(name="❌ spawn-iron-golem.limit", value="Set a value in purpur.yml. " "Recommended: 5.", inline=True) @@ -1000,7 +1000,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["zombie"][ "aggressive-towards-villager-when-lagging"] if aggressive_towards_villager_when_lagging == "true": - embed_var.add_field(name="⚠ zombie.aggresive-towards-villager-when-lagging", + embed_var.add_field(name="❌ zombie.aggresive-towards-villager-when-lagging", value="Disable this in purpur.yml.", inline=True) except KeyError: @@ -1011,7 +1011,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["gameplay-mechanics"][ "entities-can-use-portals"] if entities_can_use_portals == "true": - embed_var.add_field(name="⚠ entities-can-use-portals", + embed_var.add_field(name="❌ entities-can-use-portals", value="Disable this in purpur.yml to prevent players from creating chunk anchors.", inline=True) except KeyError: @@ -1021,7 +1021,7 @@ class Timings(commands.Cog): lobotomize_enabled = r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ "lobotomize"]["enabled"] if lobotomize_enabled == "false": - embed_var.add_field(name="⚠ villager.lobotomize.enabled", + embed_var.add_field(name="❌ villager.lobotomize.enabled", value="Enable this in purpur.yml.", inline=True) except KeyError: @@ -1030,7 +1030,7 @@ class Timings(commands.Cog): try: teleport_if_outside_border = r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["gameplay-mechanics"]["player"]["teleport-if-outside-border"] if teleport_if_outside_border == "false": - embed_var.add_field(name="⚠ player.teleport-if-outside-border", + embed_var.add_field(name="❌ player.teleport-if-outside-border", value="Enable this in purpur.yml.", inline=True) except KeyError: From 9cd39f519938b76b7d63fdfafc3d7aac17def4cd Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 15:16:25 -0600 Subject: [PATCH 06/63] Update timings.py --- cogs/timings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/timings.py b/cogs/timings.py index db47a8a..9ed96dc 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -259,7 +259,7 @@ class Timings(commands.Cog): if "ImageOnMap" in plugins: embed_var.add_field(name="❌ ImageOnMap", value="This plugin has a [memory leak](https://github.com/zDevelopers/ImageOnMap/issues/104). If it is not essential, you should remove it. " - "Consider replacing it with [DrMap](https://www.spigotmc.org/resources/drmap.87368/).", + "Consider replacing it with [an alternative](https://www.spigotmc.org/resources/drmap.87368/).", inline=True) if "CrazyActions" in plugins: embed_var.add_field(name="❌ CrazyAuctions", From 8300ff2ac38368ebdb8d438f32bb5ee4c97b95f6 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 16:09:12 -0600 Subject: [PATCH 07/63] Timings - improve offline mode detection --- cogs/timings.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index 9ed96dc..122548c 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -72,11 +72,13 @@ class Timings(commands.Cog): try: online_mode = r["timingsMaster"]["onlinemode"] bungeecord = r["timingsMaster"]["config"]["spigot"]["settings"]["bungeecord"] - if not online_mode and bungeecord == "false": - if not online_mode and bungeecord == "false": - embed_var.add_field(name="❌ online-mode", - value="Enable this in server.properties for security.", - inline=True) + velocity_online_mode = r["timingsMaster"]["config"]["paper"]["settings"]["velocity-support"]["online-mode"] + velocity_enabled = r["timingsMaster"]["config"]["paper"]["settings"]["velocity-support"]["enabled"] + + if not online_mode and bungeecord == "false" and (velocity_online_mode == "false" or velocity_enabled == "false"): + embed_var.add_field(name="❌ online-mode", + value="Enable this in server.properties for security.", + inline=True) except KeyError: unchecked = unchecked + 1 From a4e690a640576a2e532e0cd33de3e49ff8ce2bbc Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sat, 9 Jan 2021 16:20:02 -0600 Subject: [PATCH 08/63] Update README.md --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ebfb40f..0b556ab 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,20 @@ # Botflop -Discord bot focused on Minecraft server administration. Botflop: -* Analyzes timings reports -* Converts message.txt files into hastebin links + +# Current abilities +## Analyze timings reports +Paste a timings report to review an in-depth description of potential optimizations. You can try it out yourself on our [Discord](https://discord.gg/zsz3PzT) +![Timings 1](https://i.imgur.com/MT6ScnL.png) +![Timings 2](https://i.imgur.com/2ApteF5.png) + +## Hastebin upload +Botflop converts text files into hastebin links. You can try it out yourself on our [Discord](https://discord.gg/zsz3PzT) +![message.txt](https://i.imgur.com/JAuL3zy.png) +![latest.log](https://i.imgur.com/AoZGQRi.png) +![config.yml](https://i.imgur.com/qovRot8.png) + +## Pterodactyl linking * Links Pterodactyl panel and Discord accounts * Ensures backups even when running with Blesta -* Communicates with Pterodactyl API to update servers ## In Progress * `.update` command to update either all available plugins to the latest version or just one plugin From 7dea0e631efcf2420fb667b9216b1509ff866e35 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sat, 9 Jan 2021 16:38:33 -0600 Subject: [PATCH 09/63] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0b556ab..01127ea 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,13 @@ # Current abilities ## Analyze timings reports Paste a timings report to review an in-depth description of potential optimizations. You can try it out yourself on our [Discord](https://discord.gg/zsz3PzT) + ![Timings 1](https://i.imgur.com/MT6ScnL.png) ![Timings 2](https://i.imgur.com/2ApteF5.png) ## Hastebin upload Botflop converts text files into hastebin links. You can try it out yourself on our [Discord](https://discord.gg/zsz3PzT) + ![message.txt](https://i.imgur.com/JAuL3zy.png) ![latest.log](https://i.imgur.com/AoZGQRi.png) ![config.yml](https://i.imgur.com/qovRot8.png) From 4110a90e1d6e902ce0a4ce7bc6ed5bcf33bd095e Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sat, 9 Jan 2021 16:47:50 -0600 Subject: [PATCH 10/63] Remove cookies since we don't need them w/ api key --- bot.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/bot.py b/bot.py index c28bc73..84e4c00 100644 --- a/bot.py +++ b/bot.py @@ -27,9 +27,6 @@ guild_id = int(os.getenv('guild_id')) verification_channel = int(os.getenv('verification_channel')) verification_message = int(os.getenv('verification_message')) application_api_key = os.getenv('application_api_key') -cookies = { - 'pterodactyl_session': 'eyJpdiI6InhIVXp5ZE43WlMxUU1NQ1pyNWRFa1E9PSIsInZhbHVlIjoiQTNpcE9JV3FlcmZ6Ym9vS0dBTmxXMGtST2xyTFJvVEM5NWVWbVFJSnV6S1dwcTVGWHBhZzdjMHpkN0RNdDVkQiIsIm1hYyI6IjAxYTI5NDY1OWMzNDJlZWU2OTc3ZDYxYzIyMzlhZTFiYWY1ZjgwMjAwZjY3MDU4ZDYwMzhjOTRmYjMzNDliN2YifQ%3D%3D', -} logging.basicConfig(filename='console.log', level=logging.INFO, @@ -50,7 +47,6 @@ async def on_message(message): # Account link if message.author != bot.user and message.guild == None: channel = message.channel - global cookies await channel.send("Processing, please wait...") # Potential API key, so tries it out if len(message.content) == 48: @@ -62,10 +58,10 @@ async def on_message(message): 'Authorization': 'Bearer ' + message.content, } - # response = requests.get(url, headers=headers, cookies=cookies) + # response = requests.get(url, headers=headers) async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers, cookies=cookies) as response: + async with session.get(url, headers=headers) as response: # If API token is verified to be correct: if response.status == 200: @@ -112,7 +108,7 @@ async def on_message(message): } async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers, cookies=cookies) as response: + async with session.get(url, headers=headers) as response: # If API token is verified to be correct, continues if response.status == 200: @@ -279,7 +275,6 @@ async def react(ctx, url, reaction): @tasks.loop(minutes=10) async def updater(): - global cookies logging.info("Synchronizing roles") file = open('users.json', 'r') data = json.load(file) @@ -297,7 +292,7 @@ async def updater(): 'Authorization': 'Bearer ' + api_key, } async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers, cookies=cookies) as response: + async with session.get(url, headers=headers) as response: if response.status == 200: # Formats response for servers in JSON format servers_json_response = await response.json() @@ -372,9 +367,9 @@ async def updater(): 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + application_api_key, } - #response = requests.get(url, headers=headers, cookies=cookies) + #response = requests.get(url, headers=headers) async with aiohttp.ClientSession() as session: - async with session.get(url, headers = headers, cookies = cookies) as response: + async with session.get(url, headers = headers) as response: servers_json_response = await response.json() file = open('modified_servers.json', 'r') @@ -407,7 +402,7 @@ async def updater(): async with aiohttp.ClientSession() as session: - async with session.patch('https://panel.birdflop.com/api/application/servers/' + str(server['attributes']['id']) + '/build', headers=headers, cookies=cookies, data=data) as response: + async with session.patch('https://panel.birdflop.com/api/application/servers/' + str(server['attributes']['id']) + '/build', headers=headers, data=data) as response: if response.status == 200: modified_servers['servers'].append({ 'uuid': str(server['attributes']['uuid']) @@ -466,7 +461,6 @@ async def updater(): # #urllib.request.urlretrieve("https://www.spigotmc.org/resources/votingplugin.15358/download?version=373388",'/home/container/zzzcache/VotingPlugin2.jar') # # -# global cookies # # headers = { # 'Accept': 'application/json', @@ -474,7 +468,7 @@ async def updater(): # 'Authorization': 'Bearer ' + command_client_api_key, # } # -# response = requests.get(f'https://panel.birdflop.com/api/client/servers/{server}/files/upload', headers=headers, cookies=cookies) +# response = requests.get(f'https://panel.birdflop.com/api/client/servers/{server}/files/upload', headers=headers) # print(str(response)) # update_json = response.json() # transfer_url = update_json["attributes"]["url"] From c9d601c5363e69cb178b5d20f5f00950f1eb3254 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 16:56:38 -0600 Subject: [PATCH 11/63] Update timings.py --- cogs/timings.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index 122548c..0c54ab2 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -86,18 +86,17 @@ class Timings(commands.Cog): timing_cost = int(r["timingsMaster"]["system"]["timingcost"]) if timing_cost > 400: embed_var.add_field(name="❌ Timingcost", - value="Your cpu is overloaded. Find a better host.", + value="Your timingcost is " + str(timing_cost) + ". Find a Find a [better host](https://www.birdflop.com).", inline=True) except KeyError: unchecked = unchecked + 1 try: jvm_version = r["timingsMaster"]["system"]["jvmversion"] - if "1.8.0_" in jvm_version or jvm_version.startswith("9.") or jvm_version.startswith("10."): + if jvm_version.startswith("1.8.") or jvm_version.startswith("9.") or jvm_version.startswith("10."): embed_var.add_field(name="❌ Java Version", value="Use Java 11.", inline=True) - except KeyError: unchecked = unchecked + 1 @@ -1050,7 +1049,7 @@ class Timings(commands.Cog): else: embed_var.description = "Showing " + str(issue_count) + " of " + str(issue_count) + " recommendations." if issue_count > 0: - embed_var.description = embed_var.description + "\n||" + str(unchecked) + " missing optimizations due to server version.||" + embed_var.description = embed_var.description + "\n||" + str(unchecked) + " missing configuration optimizations due to server version.||" await message.channel.send(embed=embed_var) From 4465a032b34cce80e8ff6d37194df5444e563d6d Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sat, 9 Jan 2021 17:46:56 -0600 Subject: [PATCH 12/63] Update timings.py --- cogs/timings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/timings.py b/cogs/timings.py index 0c54ab2..a7d5695 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -86,7 +86,7 @@ class Timings(commands.Cog): timing_cost = int(r["timingsMaster"]["system"]["timingcost"]) if timing_cost > 400: embed_var.add_field(name="❌ Timingcost", - value="Your timingcost is " + str(timing_cost) + ". Find a Find a [better host](https://www.birdflop.com).", + value="Your timingcost is " + str(timing_cost) + ". Find a [better host](https://www.birdflop.com).", inline=True) except KeyError: unchecked = unchecked + 1 From 77265fff8dca9d926879088bb95d5de57aae179a Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sat, 9 Jan 2021 23:49:32 -0600 Subject: [PATCH 13/63] Update timings.py --- cogs/timings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/timings.py b/cogs/timings.py index a7d5695..17cba98 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -432,7 +432,7 @@ class Timings(commands.Cog): elif mob_spawn_range == 8 and int(spigot_view_distance) <= 6: embed_var.add_field(name="❌ mob-spawn-range", value="Decrease this in spigot.yml. " - "Recommended: " + str(spigot_view_distance - 1) + ".", + "Recommended: " + str(int(spigot_view_distance) - 1) + ".", inline=True) except KeyError: unchecked = unchecked + 1 From 79ebd076e8ec95017c0ca1a986f283227da9a2ca Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Sun, 10 Jan 2021 01:03:37 -0600 Subject: [PATCH 14/63] Update timings.py --- cogs/timings.py | 1934 ++++++++++++++++++++++++----------------------- 1 file changed, 975 insertions(+), 959 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index 17cba98..4f0c426 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -48,994 +48,1010 @@ class Timings(commands.Cog): embed_var.set_footer(text="Requested by " + message.author.name, icon_url=message.author.avatar_url) embed_var.url = timings_url unchecked = 0 - - try: - version = r["timingsMaster"]["version"] - if "1.16.4" not in version: - embed_var.add_field(name="❌ Legacy Build", - value="Update to 1.16.4.", - inline=True) - using_yatopia = "yatopia" in r["timingsMaster"]["config"] - if using_yatopia: - embed_var.add_field(name="❌ Yatopia", - value="Yatopia is prone to bugs. " - "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).", - inline=True) - elif "Paper" in version: - embed_var.add_field(name="||❌ Paper||", - value="||Purpur has more optimizations but is generally less supported. " - "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).||", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - online_mode = r["timingsMaster"]["onlinemode"] - bungeecord = r["timingsMaster"]["config"]["spigot"]["settings"]["bungeecord"] - velocity_online_mode = r["timingsMaster"]["config"]["paper"]["settings"]["velocity-support"]["online-mode"] - velocity_enabled = r["timingsMaster"]["config"]["paper"]["settings"]["velocity-support"]["enabled"] - - if not online_mode and bungeecord == "false" and (velocity_online_mode == "false" or velocity_enabled == "false"): - embed_var.add_field(name="❌ online-mode", - value="Enable this in server.properties for security.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - timing_cost = int(r["timingsMaster"]["system"]["timingcost"]) - if timing_cost > 400: - embed_var.add_field(name="❌ Timingcost", - value="Your timingcost is " + str(timing_cost) + ". Find a [better host](https://www.birdflop.com).", - inline=True) - except KeyError: - unchecked = unchecked + 1 - try: - jvm_version = r["timingsMaster"]["system"]["jvmversion"] - if jvm_version.startswith("1.8.") or jvm_version.startswith("9.") or jvm_version.startswith("10."): - embed_var.add_field(name="❌ Java Version", - value="Use Java 11.", - inline=True) - except KeyError: - unchecked = unchecked + 1 + try: + version = r["timingsMaster"]["version"] + if "1.16.4" not in version: + embed_var.add_field(name="❌ Legacy Build", + value="Update to 1.16.4.", + inline=True) + using_yatopia = "yatopia" in r["timingsMaster"]["config"] + if using_yatopia: + embed_var.add_field(name="❌ Yatopia", + value="Yatopia is prone to bugs. " + "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).", + inline=True) + elif "Paper" in version: + embed_var.add_field(name="||❌ Paper||", + value="||Purpur has more optimizations but is generally less supported. " + "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).||", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + online_mode = r["timingsMaster"]["onlinemode"] + bungeecord = r["timingsMaster"]["config"]["spigot"]["settings"]["bungeecord"] + velocity_online_mode = r["timingsMaster"]["config"]["paper"]["settings"]["velocity-support"]["online-mode"] + velocity_enabled = r["timingsMaster"]["config"]["paper"]["settings"]["velocity-support"]["enabled"] + + if not online_mode and bungeecord == "false" and (velocity_online_mode == "false" or velocity_enabled == "false"): + embed_var.add_field(name="❌ online-mode", + value="Enable this in server.properties for security.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + timing_cost = int(r["timingsMaster"]["system"]["timingcost"]) + if timing_cost > 400: + embed_var.add_field(name="❌ Timingcost", + value="Your timingcost is " + str(timing_cost) + ". Find a [better host](https://www.birdflop.com).", + inline=True) + except KeyError: + unchecked = unchecked + 1 - try: - flags = r["timingsMaster"]["system"]["flags"] - if "-XX:+UseZGC" in flags: + try: jvm_version = r["timingsMaster"]["system"]["jvmversion"] - java_version = jvm_version.split(".")[0] - if int(java_version) < 14: - embed_var.add_field(name="❌ Java " + java_version, - value="If you are going to use ZGC, you should also use Java 14 or 15.", - inline=True) - elif "-Daikars.new.flags=true" in flags: - if "-XX:+PerfDisableSharedMem" not in flags: - embed_var.add_field(name="❌ Outdated Flags", - value="Add `-XX:+PerfDisableSharedMem` to flags", + if jvm_version.startswith("1.8.") or jvm_version.startswith("9.") or jvm_version.startswith("10."): + embed_var.add_field(name="❌ Java Version", + value="Use Java 11.", inline=True) - if "XX:G1MixedGCCountTarget=4" not in flags: - embed_var.add_field(name="❌ Outdated Flags", - value="Add `-XX:G1MixedGCCountTarget=4` to flags", - inline=True) - if "-Xmx" in flags: - max_mem = 0 - flaglist = flags.split(" ") - for flag in flaglist: - if flag.startswith("-Xmx"): - max_mem = flag.split("-Xmx")[1] - max_mem = max_mem.replace("G", "000") - max_mem = max_mem.replace("M", "") - max_mem = max_mem.replace("g", "000") - max_mem = max_mem.replace("m", "") - if int(max_mem) < 5400: - embed_var.add_field(name="❌ Low Memory", - value="Allocate at least 6-10GB of ram to your server if you can afford it.", + except KeyError: + unchecked = unchecked + 1 + + try: + flags = r["timingsMaster"]["system"]["flags"] + if "-XX:+UseZGC" in flags: + jvm_version = r["timingsMaster"]["system"]["jvmversion"] + java_version = jvm_version.split(".")[0] + if int(java_version) < 14: + embed_var.add_field(name="❌ Java " + java_version, + value="If you are going to use ZGC, you should also use Java 14 or 15.", + inline=True) + elif "-Daikars.new.flags=true" in flags: + if "-XX:+PerfDisableSharedMem" not in flags: + embed_var.add_field(name="❌ Outdated Flags", + value="Add `-XX:+PerfDisableSharedMem` to flags", inline=True) - if "-Xms" in flags: - min_mem = 0 + if "XX:G1MixedGCCountTarget=4" not in flags: + embed_var.add_field(name="❌ Outdated Flags", + value="Add `-XX:G1MixedGCCountTarget=4` to flags", + inline=True) + if "-Xmx" in flags: + max_mem = 0 flaglist = flags.split(" ") for flag in flaglist: - if flag.startswith("-Xms"): - min_mem = flag.split("-Xms")[1] - min_mem = min_mem.replace("G", "000") - min_mem = min_mem.replace("M", "") - min_mem = min_mem.replace("g", "000") - min_mem = min_mem.replace("m", "") - if min_mem != max_mem: - embed_var.add_field(name="❌ Aikar's Flags", - value="Your Xmx and Xms values must be equal with Aikar's flags.", + if flag.startswith("-Xmx"): + max_mem = flag.split("-Xmx")[1] + max_mem = max_mem.replace("G", "000") + max_mem = max_mem.replace("M", "") + max_mem = max_mem.replace("g", "000") + max_mem = max_mem.replace("m", "") + if int(max_mem) < 5400: + embed_var.add_field(name="❌ Low Memory", + value="Allocate at least 6-10GB of ram to your server if you can afford it.", inline=True) - elif "-Dusing.aikars.flags=mcflags.emc.gs" in flags: - embed_var.add_field(name="❌ Outdated Flags", - value="Update [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", - inline=True) - else: - embed_var.add_field(name="❌ Aikar's Flags", - value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", - inline=True) - except KeyError: - unchecked = unchecked + 1 - try: - cpu = int(r["timingsMaster"]["system"]["cpu"]) - if cpu <= 2: - embed_var.add_field(name="❌ Threads", - value="You have only " + str(cpu) + " thread(s). Find a [better host](https://www.birdflop.com).", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - plugins = r["timingsMaster"]["plugins"] - if "ClearLag" in plugins: - embed_var.add_field(name="❌ ClearLag", - value="Plugins that claim to remove lag actually cause more lag. " - "Remove ClearLag.", - inline=True) - if "LagAssist" in plugins: - embed_var.add_field(name="❌ LagAssist", - value="Plugins that claim to remove lag actually cause more lag. " - "Remove LagAssist.", - inline=True) - if "NoChunkLag" in plugins: - embed_var.add_field(name="❌ NoChunkLag", - value="Plugins that claim to remove lag actually cause more lag. " - "Remove NoChunkLag.", - inline=True) - if "ServerBooster" in plugins: - embed_var.add_field(name="❌ ServerBooster", - value="Plugins that claim to remove lag actually cause more lag. " - "Remove ServerBooster.", - inline=True) - if "LimitPillagers" in plugins: - embed_var.add_field(name="❌ LimitPillagers", - value="You probably don't need LimitPillagers as Paper already adds its features. " - "Remove LimitPillagers.", - inline=True) - if "VillagerOptimiser" in plugins: - embed_var.add_field(name="❌ VillagerOptimiser", - value="You probably don't need VillagerOptimiser as Paper already adds its features. " - "See entity-activation-range in spigot.yml.", - inline=True) - if "StackMob" in plugins: - embed_var.add_field(name="❌ StackMob", - value="Stacking plugins actually cause more lag. " - "Remove StackMob.", - inline=True) - if "Stacker" in plugins: - embed_var.add_field(name="❌ Stacker", - value="Stacking plugins actually cause more lag. " - "Remove Stacker.", - inline=True) - if "MobStacker" in plugins: - embed_var.add_field(name="❌ MobStacker", - value="Stacking plugins actually cause more lag. " - "Remove MobStacker.", - inline=True) - if "WildStacker" in plugins: - embed_var.add_field(name="❌ WildStacker", - value="Stacking plugins actually cause more lag. " - "Remove WildStacker.", - inline=True) - if "SuggestionBlocker" in plugins: - embed_var.add_field(name="❌ SuggestionBlocker", - value="You probably don't need SuggestionBlocker as Spigot already adds its features. " - "Set tab-complete to -1 in spigot.yml.", - inline=True) - if "FastAsyncWorldEdit" in plugins: - embed_var.add_field(name="❌ FastAsyncWorldEdit", - value="FAWE can corrupt your world. " - "Consider replacing FAWE with [Worldedit](https://enginehub.org/worldedit/#downloads).", - inline=True) - if "CMI" in plugins: - embed_var.add_field(name="❌ CMI", - value="CMI is a buggy plugin. " - "Consider replacing CMI with [EssentialsX](https://essentialsx.net/downloads.html).", - inline=True) - if "Spartan" in plugins: - embed_var.add_field(name="❌ Spartan", - value="Spartan is a laggy anticheat. " - "Consider replacing it with [Matrix](https://matrix.rip/), [NCP](https://ci.codemc.io/job/Updated-NoCheatPlus/job/Updated-NoCheatPlus/), or [AAC](https://www.spigotmc.org/resources/aac-advanced-anti-cheat-hack-kill-aura-blocker.6442/).", - inline=True) - if "IllegalStack" in plugins: - embed_var.add_field(name="❌ IllegalStack", - value="You probably don't need IllegalStack as Paper already has its features. " - "Remove IllegalStack.", - inline=True) - if "ExploitFixer" in plugins: - embed_var.add_field(name="❌ ExploitFixer", - value="You probably don't need ExploitFixer as Paper already has its features. " - "Remove ExploitFixer.", - inline=True) - if "EntityTrackerFixer" in plugins: - embed_var.add_field(name="❌ EntityTrackerFixer", - value="You probably don't need EntityTrackerFixer as Paper already has its features. " - "Remove EntityTrackerFixer.", - inline=True) - if "Orebfuscator" in plugins: - embed_var.add_field(name="❌ Orebfuscator", - value="You probably don't need Orebfuscator as Paper already has its features. " - "Remove Orebfuscator.", - inline=True) - if "ImageOnMap" in plugins: - embed_var.add_field(name="❌ ImageOnMap", - value="This plugin has a [memory leak](https://github.com/zDevelopers/ImageOnMap/issues/104). If it is not essential, you should remove it. " - "Consider replacing it with [an alternative](https://www.spigotmc.org/resources/drmap.87368/).", - inline=True) - if "CrazyActions" in plugins: - embed_var.add_field(name="❌ CrazyAuctions", - value="CrazyAuctions is a laggy plugin, even according to the developer. " - "Consider replacing it with [AuctionHouse](https://www.spigotmc.org/resources/auctionhouse.61836/).", - inline=True) - if "GroupManager" in plugins: - embed_var.add_field(name="❌ GroupManager", - value="GroupManager is an outdated permission plugin. " - "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", - inline=True) - if "PermissionsEx" in plugins: - embed_var.add_field(name="❌ PermissionsEx", - value="PermissionsEx is an outdated permission plugin. " - "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", - inline=True) - if "bPermissions" in plugins: - embed_var.add_field(name="❌ bPermissions", - value="bPermissions is an outdated permission plugin. " - "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", - inline=True) - for plugin in plugins: - if "Songoda" in r["timingsMaster"]["plugins"][plugin]["authors"]: - embed_var.add_field(name="❌ " + plugin, - value="This plugin was made by Songoda. You should find an alternative.", + if "-Xms" in flags: + min_mem = 0 + flaglist = flags.split(" ") + for flag in flaglist: + if flag.startswith("-Xms"): + min_mem = flag.split("-Xms")[1] + min_mem = min_mem.replace("G", "000") + min_mem = min_mem.replace("M", "") + min_mem = min_mem.replace("g", "000") + min_mem = min_mem.replace("m", "") + if min_mem != max_mem: + embed_var.add_field(name="❌ Aikar's Flags", + value="Your Xmx and Xms values must be equal with Aikar's flags.", + inline=True) + elif "-Dusing.aikars.flags=mcflags.emc.gs" in flags: + embed_var.add_field(name="❌ Outdated Flags", + value="Update [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", + inline=True) + else: + embed_var.add_field(name="❌ Aikar's Flags", + value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", + inline=True) + except KeyError: + unchecked = unchecked + 1 + try: + cpu = int(r["timingsMaster"]["system"]["cpu"]) + if cpu <= 2: + embed_var.add_field(name="❌ Threads", + value="You have only " + str(cpu) + " thread(s). Find a [better host](https://www.birdflop.com).", inline=True) - except KeyError: - unchecked = unchecked + 1 + except KeyError: + unchecked = unchecked + 1 - try: - using_purpur = "purpur" in r["timingsMaster"]["config"] - if using_purpur: + try: plugins = r["timingsMaster"]["plugins"] - if "SilkSpawners" in plugins: - embed_var.add_field(name="❌ SilkSpawners", - value="You probably don't need SilkSpawners as Purpur already has its features. " - "Remove SilkSpawners.", + if "ClearLag" in plugins: + embed_var.add_field(name="❌ ClearLag", + value="Plugins that claim to remove lag actually cause more lag. " + "Remove ClearLag.", inline=True) - if "MineableSpawners" in plugins: - embed_var.add_field(name="❌ MineableSpawners", - value="You probably don't need MineableSpawners as Purpur already has its features. " - "Remove MineableSpawners.", + if "LagAssist" in plugins: + embed_var.add_field(name="❌ LagAssist", + value="Plugins that claim to remove lag actually cause more lag. " + "Remove LagAssist.", inline=True) - if "VillagerLobotomizatornator" in plugins: + if "NoChunkLag" in plugins: + embed_var.add_field(name="❌ NoChunkLag", + value="Plugins that claim to remove lag actually cause more lag. " + "Remove NoChunkLag.", + inline=True) + if "ServerBooster" in plugins: + embed_var.add_field(name="❌ ServerBooster", + value="Plugins that claim to remove lag actually cause more lag. " + "Remove ServerBooster.", + inline=True) + if "MobLimiter" in plugins: + embed_var.add_field(name="❌ MobLimiter", + value="You probably don't need MobLimiter as Bukkit already has its features. " + "Remove MobLimiter.", + inline=True) + if "BookLimiter" in plugins: + embed_var.add_field(name="❌ BookLimiter", + value="You probably don't need BookLimiter as Paper already has its features. " + "Remove BookLimiter.", + inline=True) + if "LimitPillagers" in plugins: embed_var.add_field(name="❌ LimitPillagers", - value="You probably don't need VillagerLobotomizatornator as Purpur already adds its features. " - "Enable villager.lobotomize.enabled in purpur.yml.", + value="You probably don't need LimitPillagers as Paper already adds its features. " + "Remove LimitPillagers.", inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - plugins = r["timingsMaster"]["plugins"] - if "PhantomSMP" in plugins: - phantoms_only_insomniacs = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ - "phantoms-only-attack-insomniacs"] - if phantoms_only_insomniacs == "false": - embed_var.add_field(name="❌ PhantomSMP", - value="You probably don't need PhantomSMP as Paper already has its features. " - "Remove PhantomSMP.", + if "VillagerOptimiser" in plugins: + embed_var.add_field(name="❌ VillagerOptimiser", + value="You probably don't need VillagerOptimiser as Paper already adds its features. " + "See entity-activation-range in spigot.yml.", inline=True) - else: - embed_var.add_field(name="❌ PhantomSMP", - value="You probably don't need PhantomSMP as Paper already has its features. " - "Enable phantoms-only-attack-insomniacs in paper.yml.", + if "StackMob" in plugins: + embed_var.add_field(name="❌ StackMob", + value="Stacking plugins actually cause more lag. " + "Remove StackMob.", inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - network_compression_threshold = int( - r["timingsMaster"]["config"]["server.properties"]["network-compression-threshold"]) - bungeecord = r["timingsMaster"]["config"]["spigot"]["settings"]["bungeecord"] - if network_compression_threshold == 256 and bungeecord == "false": - embed_var.add_field(name="❌ network-compression-threshold", - value="Increase this in server.properties. Recommended: 512.", - inline=True) - if network_compression_threshold != -1 and bungeecord == "true": - embed_var.add_field(name="❌ network-compression-threshold", - value="Set this to -1 in server.properties for a bungee server like yours.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["view-distance"] - view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) - if view_distance == 10 and spigot_view_distance == "default": - embed_var.add_field(name="❌ view-distance", - value="Decrease this from default (10) in spigot.yml. " - "Recommended: 3.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - chunk_gc_period = int(r["timingsMaster"]["config"]["bukkit"]["chunk-gc"]["period-in-ticks"]) - if chunk_gc_period == 600: - embed_var.add_field(name="❌ chunk-gc.period-in-ticks", - value="Decrease this in bukkit.yml.\nRecommended: 400.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - ticks_per_monster_spawns = int(r["timingsMaster"]["config"]["bukkit"]["ticks-per"]["monster-spawns"]) - if ticks_per_monster_spawns == 1: - embed_var.add_field(name="❌ ticks-per.monster-spawns", - value="Increase this in bukkit.yml.\nRecommended: 4.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - monsters_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["monsters"]) - if monsters_spawn_limit == 70: - embed_var.add_field(name="❌ spawn-limits.monsters", - value="Decrease this in bukkit.yml.\nRecommended: 15.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - water_ambient_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["water-ambient"]) - if water_ambient_spawn_limit == 20: - embed_var.add_field(name="❌ spawn-limits.water-ambient", - value="Decrease this in bukkit.yml.\nRecommended: 2.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - ambient_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["ambient"]) - if ambient_spawn_limit == 15: - embed_var.add_field(name="❌ spawn-limits.ambient", - value="Decrease this in bukkit.yml.\nRecommended: 1.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - animals_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["animals"]) - if animals_spawn_limit == 10: - embed_var.add_field(name="❌ spawn-limits.animals", - value="Decrease this in bukkit.yml.\nRecommended: 3.", - inline=True) - except KeyError: - unchecked = unchecked + 1 + if "Stacker" in plugins: + embed_var.add_field(name="❌ Stacker", + value="Stacking plugins actually cause more lag. " + "Remove Stacker.", + inline=True) + if "MobStacker" in plugins: + embed_var.add_field(name="❌ MobStacker", + value="Stacking plugins actually cause more lag. " + "Remove MobStacker.", + inline=True) + if "WildStacker" in plugins: + embed_var.add_field(name="❌ WildStacker", + value="Stacking plugins actually cause more lag. " + "Remove WildStacker.", + inline=True) + if "SuggestionBlocker" in plugins: + embed_var.add_field(name="❌ SuggestionBlocker", + value="You probably don't need SuggestionBlocker as Spigot already adds its features. " + "Set tab-complete to -1 in spigot.yml.", + inline=True) + if "FastAsyncWorldEdit" in plugins: + embed_var.add_field(name="❌ FastAsyncWorldEdit", + value="FAWE can corrupt your world. " + "Consider replacing FAWE with [Worldedit](https://enginehub.org/worldedit/#downloads).", + inline=True) + if "CMI" in plugins: + embed_var.add_field(name="❌ CMI", + value="CMI is a buggy plugin. " + "Consider replacing CMI with [EssentialsX](https://essentialsx.net/downloads.html).", + inline=True) + if "Spartan" in plugins: + embed_var.add_field(name="❌ Spartan", + value="Spartan is a laggy anticheat. " + "Consider replacing it with [Matrix](https://matrix.rip/), [NCP](https://ci.codemc.io/job/Updated-NoCheatPlus/job/Updated-NoCheatPlus/), or [AAC](https://www.spigotmc.org/resources/aac-advanced-anti-cheat-hack-kill-aura-blocker.6442/).", + inline=True) + if "IllegalStack" in plugins: + embed_var.add_field(name="❌ IllegalStack", + value="You probably don't need IllegalStack as Paper already has its features. " + "Remove IllegalStack.", + inline=True) + if "ExploitFixer" in plugins: + embed_var.add_field(name="❌ ExploitFixer", + value="You probably don't need ExploitFixer as Paper already has its features. " + "Remove ExploitFixer.", + inline=True) + if "EntityTrackerFixer" in plugins: + embed_var.add_field(name="❌ EntityTrackerFixer", + value="You probably don't need EntityTrackerFixer as Paper already has its features. " + "Remove EntityTrackerFixer.", + inline=True) + if "Orebfuscator" in plugins: + embed_var.add_field(name="❌ Orebfuscator", + value="You probably don't need Orebfuscator as Paper already has its features. " + "Remove Orebfuscator.", + inline=True) + if "ImageOnMap" in plugins: + embed_var.add_field(name="❌ ImageOnMap", + value="This plugin has a [memory leak](https://github.com/zDevelopers/ImageOnMap/issues/104). If it is not essential, you should remove it. " + "Consider replacing it with [an alternative](https://www.spigotmc.org/resources/drmap.87368/).", + inline=True) + if "CrazyActions" in plugins: + embed_var.add_field(name="❌ CrazyAuctions", + value="CrazyAuctions is a laggy plugin, even according to the developer. " + "Consider replacing it with [AuctionHouse](https://www.spigotmc.org/resources/auctionhouse.61836/).", + inline=True) + if "GroupManager" in plugins: + embed_var.add_field(name="❌ GroupManager", + value="GroupManager is an outdated permission plugin. " + "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", + inline=True) + if "PermissionsEx" in plugins: + embed_var.add_field(name="❌ PermissionsEx", + value="PermissionsEx is an outdated permission plugin. " + "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", + inline=True) + if "bPermissions" in plugins: + embed_var.add_field(name="❌ bPermissions", + value="bPermissions is an outdated permission plugin. " + "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", + inline=True) + for plugin in plugins: + if "Songoda" in r["timingsMaster"]["plugins"][plugin]["authors"]: + embed_var.add_field(name="❌ " + plugin, + value="This plugin was made by Songoda. You should find an alternative.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + using_purpur = "purpur" in r["timingsMaster"]["config"] + if using_purpur: + plugins = r["timingsMaster"]["plugins"] + if "SilkSpawners" in plugins: + embed_var.add_field(name="❌ SilkSpawners", + value="You probably don't need SilkSpawners as Purpur already has its features. " + "Remove SilkSpawners.", + inline=True) + if "MineableSpawners" in plugins: + embed_var.add_field(name="❌ MineableSpawners", + value="You probably don't need MineableSpawners as Purpur already has its features. " + "Remove MineableSpawners.", + inline=True) + if "VillagerLobotomizatornator" in plugins: + embed_var.add_field(name="❌ LimitPillagers", + value="You probably don't need VillagerLobotomizatornator as Purpur already adds its features. " + "Enable villager.lobotomize.enabled in purpur.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 - try: - water_animals_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["water-animals"]) - if water_animals_spawn_limit == 15: - embed_var.add_field(name="❌ spawn-limits.water-animals", - value="Decrease this in bukkit.yml.\nRecommended: 2.", - inline=True) - except KeyError: - unchecked = unchecked + 1 + try: + plugins = r["timingsMaster"]["plugins"] + if "PhantomSMP" in plugins: + phantoms_only_insomniacs = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ + "phantoms-only-attack-insomniacs"] + if phantoms_only_insomniacs == "false": + embed_var.add_field(name="❌ PhantomSMP", + value="You probably don't need PhantomSMP as Paper already has its features. " + "Remove PhantomSMP.", + inline=True) + else: + embed_var.add_field(name="❌ PhantomSMP", + value="You probably don't need PhantomSMP as Paper already has its features. " + "Enable phantoms-only-attack-insomniacs in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + network_compression_threshold = int( + r["timingsMaster"]["config"]["server.properties"]["network-compression-threshold"]) + bungeecord = r["timingsMaster"]["config"]["spigot"]["settings"]["bungeecord"] + if network_compression_threshold == 256 and bungeecord == "false": + embed_var.add_field(name="❌ network-compression-threshold", + value="Increase this in server.properties. Recommended: 512.", + inline=True) + if network_compression_threshold != -1 and bungeecord == "true": + embed_var.add_field(name="❌ network-compression-threshold", + value="Set this to -1 in server.properties for a bungee server like yours.", + inline=True) + except KeyError: + unchecked = unchecked + 1 - try: - mob_spawn_range = int(r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["mob-spawn-range"]) - spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["view-distance"] - if spigot_view_distance == "default": + try: + spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["view-distance"] view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) - if mob_spawn_range == 8 and view_distance <= 6: - embed_var.add_field(name="❌ mob-spawn-range", - value="Decrease this in spigot.yml. " - "Recommended: " + str(view_distance - 1) + ".", + if view_distance == 10 and spigot_view_distance == "default": + embed_var.add_field(name="❌ view-distance", + value="Decrease this from default (10) in spigot.yml. " + "Recommended: 3.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + chunk_gc_period = int(r["timingsMaster"]["config"]["bukkit"]["chunk-gc"]["period-in-ticks"]) + if chunk_gc_period == 600: + embed_var.add_field(name="❌ chunk-gc.period-in-ticks", + value="Decrease this in bukkit.yml.\nRecommended: 400.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + ticks_per_monster_spawns = int(r["timingsMaster"]["config"]["bukkit"]["ticks-per"]["monster-spawns"]) + if ticks_per_monster_spawns == 1: + embed_var.add_field(name="❌ ticks-per.monster-spawns", + value="Increase this in bukkit.yml.\nRecommended: 4.", inline=True) - elif mob_spawn_range == 8 and int(spigot_view_distance) <= 6: + except KeyError: + unchecked = unchecked + 1 + + try: + monsters_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["monsters"]) + if monsters_spawn_limit == 70: + embed_var.add_field(name="❌ spawn-limits.monsters", + value="Decrease this in bukkit.yml.\nRecommended: 15.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + water_ambient_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["water-ambient"]) + if water_ambient_spawn_limit == 20: + embed_var.add_field(name="❌ spawn-limits.water-ambient", + value="Decrease this in bukkit.yml.\nRecommended: 2.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + ambient_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["ambient"]) + if ambient_spawn_limit == 15: + embed_var.add_field(name="❌ spawn-limits.ambient", + value="Decrease this in bukkit.yml.\nRecommended: 1.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + animals_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["animals"]) + if animals_spawn_limit == 10: + embed_var.add_field(name="❌ spawn-limits.animals", + value="Decrease this in bukkit.yml.\nRecommended: 3.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + water_animals_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["water-animals"]) + if water_animals_spawn_limit == 15: + embed_var.add_field(name="❌ spawn-limits.water-animals", + value="Decrease this in bukkit.yml.\nRecommended: 2.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + mob_spawn_range = int(r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["mob-spawn-range"]) + spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["view-distance"] + if spigot_view_distance == "default": + view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) + if mob_spawn_range == 8 and view_distance <= 6: embed_var.add_field(name="❌ mob-spawn-range", value="Decrease this in spigot.yml. " - "Recommended: " + str(int(spigot_view_distance) - 1) + ".", + "Recommended: " + str(view_distance - 1) + ".", inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - animals_entity_activation_range = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "animals"]) - if animals_entity_activation_range == 32: - embed_var.add_field(name="❌ entity-activation-range.animals", - value="Decrease this in spigot.yml. " - "Recommended: 6.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - monsters_entity_activation_range = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "monsters"]) - if monsters_entity_activation_range == 32: - embed_var.add_field(name="❌ entity-activation-range.monsters", - value="Decrease this in spigot.yml. " - "Recommended: 16.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - raiders_entity_activation_range = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "raiders"]) - except KeyError: - unchecked = unchecked + 1 - - try: - misc_entity_activation_range = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"]["misc"]) - if misc_entity_activation_range == 16: - embed_var.add_field(name="❌ entity-activation-range.misc", - value="Decrease this in spigot.yml. " - "Recommended: 4.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - water_entity_activation_range = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"]["water"]) - if water_entity_activation_range == 16: - embed_var.add_field(name="❌ entity-activation-range.water", - value="Decrease this in spigot.yml. " - "Recommended: 12.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - villagers_entity_activation_range = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "villagers"]) - if villagers_entity_activation_range == 32: - embed_var.add_field(name="❌ entity-activation-range.villagers", - value="Decrease this in spigot.yml. " - "Recommended: 16.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - flying_monsters_entity_activation_range = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "flying-monsters"]) - except KeyError: - unchecked = unchecked + 1 - - try: - tick_inactive_villagers = \ - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "tick-inactive-villagers"] - if tick_inactive_villagers == "true": - embed_var.add_field(name="❌ tick-inactive-villagers", - value="Disable this in spigot.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - nerf_spawner_mobs = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["nerf-spawner-mobs"] - if nerf_spawner_mobs == "false": - embed_var.add_field(name="❌ nerf-spawner-mobs", - value="Enable this in spigot.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_villagers_every = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - except KeyError: - unchecked = unchecked + 1 - try: - wake_up_inactive_villagers_for = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_villagers_for == 100: - embed_var.add_field(name="❌ wake-up-inactive.villagers-for", - value="Decrease this in spigot.yml. " - "Recommended: 20.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_flying_monsters_for = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_flying_monsters_for == 100: - embed_var.add_field(name="❌ wake-up-inactive.flying-monsters-for", - value="Decrease this in spigot.yml. " - "Recommended: 60.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_animals_every = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_villagers_max_per_tick = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_villagers_max_per_tick == 4: - embed_var.add_field(name="❌ wake-up-inactive.villagers-max-per-tick", - value="Decrease this in spigot.yml. " - "Recommended: 1.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_animals_for = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_animals_for == 100: - embed_var.add_field(name="❌ wake-up-inactive.animals-for", - value="Decrease this in spigot.yml. " - "Recommended: 40.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_monsters_max_per_tick = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_monsters_max_per_tick == 8: - embed_var.add_field(name="❌ wake-up-inactive.monsters-max-per-tick", - value="Decrease this in spigot.yml. " - "Recommended: 4.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_flying_monsters_max_per_tick = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_flying_monsters_max_per_tick == 8: - embed_var.add_field(name="❌ wake-up-inactive.flying-monsters-max-per-tick", - value="Decrease this in spigot.yml. " - "Recommended: 1.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_flying_monsters_every = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_monsters_every = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_animals_max_per_tick = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_animals_max_per_tick == 4: - embed_var.add_field(name="❌ wake-up-inactive.animals-max-per-tick", - value="Decrease this in spigot.yml. " - "Recommended: 2.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - wake_up_inactive_monsters_for = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_monsters_for == 100: - embed_var.add_field(name="❌ wake-up-inactive.monsters-for", - value="Decrease this in spigot.yml. " - "Recommended: 60.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - arrow_despawn_rate = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["arrow-despawn-rate"]) - if arrow_despawn_rate == 1200: - embed_var.add_field(name="❌ arrow-despawn-rate", - value="Decrease this in spigot.yml. " - "Recommended: 300.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - item_merge_radius = float( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["merge-radius"]["item"]) - if item_merge_radius == 2.5: - embed_var.add_field(name="❌ merge-radius.item", - value="Increase this in spigot.yml. " - "Recommended: 4.0.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - exp_merge_radius = float( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["merge-radius"]["exp"]) - if exp_merge_radius == 3.0: - embed_var.add_field(name="❌ merge-radius.exp", - value="Increase this in spigot.yml. " - "Recommended: 6.0.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - max_entity_collisions = int( - r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["max-entity-collisions"]) - if max_entity_collisions == 8: - embed_var.add_field(name="❌ max-entity-collisions", - value="Decrease this in spigot.yml. " - "Recommended: 2.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - max_auto_save_chunks_per_tick = int( - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["max-auto-save-chunks-per-tick"]) - if max_auto_save_chunks_per_tick == 24: - embed_var.add_field(name="❌ max-auto-save-chunks-per-tick", - value="Decrease this in paper.yml. " - "Recommended: 6.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - optimize_explosions = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ - "optimize-explosions"] - if optimize_explosions == "false": - embed_var.add_field(name="❌ optimize-explosions", - value="Enable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - mob_spawner_tick_rate = int( - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["mob-spawner-tick-rate"]) - if mob_spawner_tick_rate == 1: - embed_var.add_field(name="❌ mob-spawner-tick-rate", - value="Increase this in paper.yml. " - "Recommended: 2.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - disable_chest_cat_detection = \ - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["game-mechanics"][ - "disable-chest-cat-detection"] - if disable_chest_cat_detection == "false": - embed_var.add_field(name="❌ disable-chest-cat-detection", - value="Enable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - container_update_tick_rate = int( - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["container-update-tick-rate"]) - if container_update_tick_rate == "false": - embed_var.add_field(name="❌ container-update-tick-rate", - value="Increase this in paper.yml. " - "Recommended: 3.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - grass_spread_tick_rate = int( - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["grass-spread-tick-rate"]) - if grass_spread_tick_rate == 1: - embed_var.add_field(name="❌ grass-spread-tick-rate", - value="Increase this in paper.yml. " - "Recommended: 4", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - soft_despawn_range = int( - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["despawn-ranges"]["soft"]) - if soft_despawn_range == 32: - embed_var.add_field(name="❌ despawn-ranges.soft", - value="Decrease this in paper.yml. " - "Recommended: 28", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - hard_despawn_range = int(r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["despawn-ranges"]["soft"]) - if hard_despawn_range == 128: - embed_var.add_field(name="❌ despawn-ranges.hard", - value="Decrease this in paper.yml. " - "Recommended: 48", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - hopper_disable_move_event = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["hopper"][ - "disable-move-event"] - if hopper_disable_move_event == "false": - embed_var.add_field(name="❌ hopper.disable-move-event", - value="Enable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - non_player_arrow_despawn_rate = int( - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["non-player-arrow-despawn-rate"]) - if non_player_arrow_despawn_rate == -1: - embed_var.add_field(name="❌ non-player-arrow-despawn-rate", - value="Set a value in paper.yml. " - "Recommended: 60", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - creative_arrow_despawn_rate = int( - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["creative-arrow-despawn-rate"]) - if creative_arrow_despawn_rate == -1: - embed_var.add_field(name="❌ creative-arrow-despawn-rate", - value="Set a value in paper.yml. " - "Recommended: 60", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - prevent_moving_into_unloaded_chunks = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ - "prevent-moving-into-unloaded-chunks"] - if prevent_moving_into_unloaded_chunks == "false": - embed_var.add_field(name="❌ prevent-moving-into-unloaded-chunks", - value="Enable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - eigencraft_redstone = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ - "use-faster-eigencraft-redstone"] - if eigencraft_redstone == "false": - embed_var.add_field(name="❌ use-faster-eigencraft-redstone", - value="Enable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - fix_climbing_bypass_gamerule = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["fix-climbing-bypassing-cramming-rule"] - if fix_climbing_bypass_gamerule == "false": - embed_var.add_field(name="❌ fix-climbing-bypassing-cramming-rule", - value="Enable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - armor_stands_do_collision_entity_lookups = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["armor-stands-do-collision-entity-lookups"] - if armor_stands_do_collision_entity_lookups == "true": - embed_var.add_field(name="❌ armor-stands-do-collision-entity-lookups", - value="Disable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - plugins = r["timingsMaster"]["plugins"] - armor_stands_tick = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["armor-stands-tick"] - if armor_stands_tick == "true" and "PetBlocks" not in plugins and "BlockBalls" not in plugins and "ArmorStandTools" not in plugins: - embed_var.add_field(name="❌ armor-stands-tick", - value="Disable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - per_player_mob_spawns = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ - "per-player-mob-spawns"] - if per_player_mob_spawns == "false": - embed_var.add_field(name="❌ per-player-mob-spawns", - value="Enable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - alt_item_despawn_rate_enabled = \ - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["alt-item-despawn-rate"]["enabled"] - if alt_item_despawn_rate_enabled == "false": - embed_var.add_field(name="❌ alt-item-despawn-rate.enabled", - value="Enable this in paper.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 + elif mob_spawn_range == 8 and int(spigot_view_distance) <= 6: + embed_var.add_field(name="❌ mob-spawn-range", + value="Decrease this in spigot.yml. " + "Recommended: " + str(int(spigot_view_distance) - 1) + ".", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + animals_entity_activation_range = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "animals"]) + if animals_entity_activation_range == 32: + embed_var.add_field(name="❌ entity-activation-range.animals", + value="Decrease this in spigot.yml. " + "Recommended: 6.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + monsters_entity_activation_range = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "monsters"]) + if monsters_entity_activation_range == 32: + embed_var.add_field(name="❌ entity-activation-range.monsters", + value="Decrease this in spigot.yml. " + "Recommended: 16.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + raiders_entity_activation_range = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "raiders"]) + except KeyError: + unchecked = unchecked + 1 + + try: + misc_entity_activation_range = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"]["misc"]) + if misc_entity_activation_range == 16: + embed_var.add_field(name="❌ entity-activation-range.misc", + value="Decrease this in spigot.yml. " + "Recommended: 4.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + water_entity_activation_range = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"]["water"]) + if water_entity_activation_range == 16: + embed_var.add_field(name="❌ entity-activation-range.water", + value="Decrease this in spigot.yml. " + "Recommended: 12.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + villagers_entity_activation_range = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "villagers"]) + if villagers_entity_activation_range == 32: + embed_var.add_field(name="❌ entity-activation-range.villagers", + value="Decrease this in spigot.yml. " + "Recommended: 16.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + flying_monsters_entity_activation_range = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "flying-monsters"]) + except KeyError: + unchecked = unchecked + 1 + + try: + tick_inactive_villagers = \ + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "tick-inactive-villagers"] + if tick_inactive_villagers == "true": + embed_var.add_field(name="❌ tick-inactive-villagers", + value="Disable this in spigot.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + nerf_spawner_mobs = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["nerf-spawner-mobs"] + if nerf_spawner_mobs == "false": + embed_var.add_field(name="❌ nerf-spawner-mobs", + value="Enable this in spigot.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_villagers_every = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + except KeyError: + unchecked = unchecked + 1 + try: + wake_up_inactive_villagers_for = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + if wake_up_inactive_villagers_for == 100: + embed_var.add_field(name="❌ wake-up-inactive.villagers-for", + value="Decrease this in spigot.yml. " + "Recommended: 20.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_flying_monsters_for = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + if wake_up_inactive_flying_monsters_for == 100: + embed_var.add_field(name="❌ wake-up-inactive.flying-monsters-for", + value="Decrease this in spigot.yml. " + "Recommended: 60.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_animals_every = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_villagers_max_per_tick = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + if wake_up_inactive_villagers_max_per_tick == 4: + embed_var.add_field(name="❌ wake-up-inactive.villagers-max-per-tick", + value="Decrease this in spigot.yml. " + "Recommended: 1.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_animals_for = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + if wake_up_inactive_animals_for == 100: + embed_var.add_field(name="❌ wake-up-inactive.animals-for", + value="Decrease this in spigot.yml. " + "Recommended: 40.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_monsters_max_per_tick = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + if wake_up_inactive_monsters_max_per_tick == 8: + embed_var.add_field(name="❌ wake-up-inactive.monsters-max-per-tick", + value="Decrease this in spigot.yml. " + "Recommended: 4.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_flying_monsters_max_per_tick = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + if wake_up_inactive_flying_monsters_max_per_tick == 8: + embed_var.add_field(name="❌ wake-up-inactive.flying-monsters-max-per-tick", + value="Decrease this in spigot.yml. " + "Recommended: 1.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_flying_monsters_every = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_monsters_every = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_animals_max_per_tick = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + if wake_up_inactive_animals_max_per_tick == 4: + embed_var.add_field(name="❌ wake-up-inactive.animals-max-per-tick", + value="Decrease this in spigot.yml. " + "Recommended: 2.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + wake_up_inactive_monsters_for = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ + "wake-up-inactive"]["villagers-every"]) + if wake_up_inactive_monsters_for == 100: + embed_var.add_field(name="❌ wake-up-inactive.monsters-for", + value="Decrease this in spigot.yml. " + "Recommended: 60.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + arrow_despawn_rate = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["arrow-despawn-rate"]) + if arrow_despawn_rate == 1200: + embed_var.add_field(name="❌ arrow-despawn-rate", + value="Decrease this in spigot.yml. " + "Recommended: 300.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + item_merge_radius = float( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["merge-radius"]["item"]) + if item_merge_radius == 2.5: + embed_var.add_field(name="❌ merge-radius.item", + value="Increase this in spigot.yml. " + "Recommended: 4.0.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + exp_merge_radius = float( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["merge-radius"]["exp"]) + if exp_merge_radius == 3.0: + embed_var.add_field(name="❌ merge-radius.exp", + value="Increase this in spigot.yml. " + "Recommended: 6.0.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + max_entity_collisions = int( + r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["max-entity-collisions"]) + if max_entity_collisions == 8: + embed_var.add_field(name="❌ max-entity-collisions", + value="Decrease this in spigot.yml. " + "Recommended: 2.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + max_auto_save_chunks_per_tick = int( + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["max-auto-save-chunks-per-tick"]) + if max_auto_save_chunks_per_tick == 24: + embed_var.add_field(name="❌ max-auto-save-chunks-per-tick", + value="Decrease this in paper.yml. " + "Recommended: 6.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + optimize_explosions = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ + "optimize-explosions"] + if optimize_explosions == "false": + embed_var.add_field(name="❌ optimize-explosions", + value="Enable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + mob_spawner_tick_rate = int( + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["mob-spawner-tick-rate"]) + if mob_spawner_tick_rate == 1: + embed_var.add_field(name="❌ mob-spawner-tick-rate", + value="Increase this in paper.yml. " + "Recommended: 2.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + disable_chest_cat_detection = \ + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["game-mechanics"][ + "disable-chest-cat-detection"] + if disable_chest_cat_detection == "false": + embed_var.add_field(name="❌ disable-chest-cat-detection", + value="Enable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + container_update_tick_rate = int( + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["container-update-tick-rate"]) + if container_update_tick_rate == "false": + embed_var.add_field(name="❌ container-update-tick-rate", + value="Increase this in paper.yml. " + "Recommended: 3.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + grass_spread_tick_rate = int( + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["grass-spread-tick-rate"]) + if grass_spread_tick_rate == 1: + embed_var.add_field(name="❌ grass-spread-tick-rate", + value="Increase this in paper.yml. " + "Recommended: 4", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + soft_despawn_range = int( + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["despawn-ranges"]["soft"]) + if soft_despawn_range == 32: + embed_var.add_field(name="❌ despawn-ranges.soft", + value="Decrease this in paper.yml. " + "Recommended: 28", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + hard_despawn_range = int(r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["despawn-ranges"]["soft"]) + if hard_despawn_range == 128: + embed_var.add_field(name="❌ despawn-ranges.hard", + value="Decrease this in paper.yml. " + "Recommended: 48", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + hopper_disable_move_event = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["hopper"][ + "disable-move-event"] + if hopper_disable_move_event == "false": + embed_var.add_field(name="❌ hopper.disable-move-event", + value="Enable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + non_player_arrow_despawn_rate = int( + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["non-player-arrow-despawn-rate"]) + if non_player_arrow_despawn_rate == -1: + embed_var.add_field(name="❌ non-player-arrow-despawn-rate", + value="Set a value in paper.yml. " + "Recommended: 60", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + creative_arrow_despawn_rate = int( + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["creative-arrow-despawn-rate"]) + if creative_arrow_despawn_rate == -1: + embed_var.add_field(name="❌ creative-arrow-despawn-rate", + value="Set a value in paper.yml. " + "Recommended: 60", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + prevent_moving_into_unloaded_chunks = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ + "prevent-moving-into-unloaded-chunks"] + if prevent_moving_into_unloaded_chunks == "false": + embed_var.add_field(name="❌ prevent-moving-into-unloaded-chunks", + value="Enable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + eigencraft_redstone = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ + "use-faster-eigencraft-redstone"] + if eigencraft_redstone == "false": + embed_var.add_field(name="❌ use-faster-eigencraft-redstone", + value="Enable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + fix_climbing_bypass_gamerule = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["fix-climbing-bypassing-cramming-rule"] + if fix_climbing_bypass_gamerule == "false": + embed_var.add_field(name="❌ fix-climbing-bypassing-cramming-rule", + value="Enable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + armor_stands_do_collision_entity_lookups = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["armor-stands-do-collision-entity-lookups"] + if armor_stands_do_collision_entity_lookups == "true": + embed_var.add_field(name="❌ armor-stands-do-collision-entity-lookups", + value="Disable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 - try: - no_tick_view_distance = int( - r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["viewdistances"][ - "no-tick-view-distance"]) - if no_tick_view_distance == -1: - spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"][ - "view-distance"] - if spigot_view_distance == "default": - view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) - if view_distance >= 4: + try: + plugins = r["timingsMaster"]["plugins"] + armor_stands_tick = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["armor-stands-tick"] + if armor_stands_tick == "true" and "PetBlocks" not in plugins and "BlockBalls" not in plugins and "ArmorStandTools" not in plugins: + embed_var.add_field(name="❌ armor-stands-tick", + value="Disable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + per_player_mob_spawns = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ + "per-player-mob-spawns"] + if per_player_mob_spawns == "false": + embed_var.add_field(name="❌ per-player-mob-spawns", + value="Enable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + alt_item_despawn_rate_enabled = \ + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["alt-item-despawn-rate"]["enabled"] + if alt_item_despawn_rate_enabled == "false": + embed_var.add_field(name="❌ alt-item-despawn-rate.enabled", + value="Enable this in paper.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + no_tick_view_distance = int( + r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["viewdistances"][ + "no-tick-view-distance"]) + if no_tick_view_distance == -1: + spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"][ + "view-distance"] + if spigot_view_distance == "default": + view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) + if view_distance >= 4: + embed_var.add_field(name="❌ no-tick-view-distance", + value="Set a value in paper.yml. " + "Recommended: " + str( + view_distance) + ". And reduce view-distance in server.properties. Recommended: 3.", + inline=True) + elif int(spigot_view_distance) >= 4: embed_var.add_field(name="❌ no-tick-view-distance", value="Set a value in paper.yml. " - "Recommended: " + str( - view_distance) + ". And reduce view-distance in server.properties. Recommended: 3.", + "Recommended: " + spigot_view_distance + ". And reduce view-distance in spigot.yml. Recommended: 3.", inline=True) - elif int(spigot_view_distance) >= 4: - embed_var.add_field(name="❌ no-tick-view-distance", - value="Set a value in paper.yml. " - "Recommended: " + spigot_view_distance + ". And reduce view-distance in spigot.yml. Recommended: 3.", + except KeyError: + unchecked = unchecked + 1 + + try: + enable_treasure_maps = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ + "enable-treasure-maps"] + if enable_treasure_maps == "true": + embed_var.add_field(name="❌ enable-treasure-maps", + value="Disable this in paper.yml. Why? Generating treasure maps is extremely expensive and can hang a server if the structure it's trying to locate is really far away.", inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - enable_treasure_maps = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ - "enable-treasure-maps"] - if enable_treasure_maps == "true": - embed_var.add_field(name="❌ enable-treasure-maps", - value="Disable this in paper.yml. Why? Generating treasure maps is extremely expensive and can hang a server if the structure it's trying to locate is really far away.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - projectile_load_save = int(r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ - "projectile-load-save-per-chunk-limit"]) - if projectile_load_save == -1: - embed_var.add_field(name="❌ projectile-load-save-per-chunk-limit", - value="Set a value in paper.yml. Recommended: 8.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - use_alternate_keepalive = r["timingsMaster"]["config"]["purpur"]["settings"]["use-alternate-keepalive"] - if use_alternate_keepalive == "false" and "TCPShield" not in plugins: - embed_var.add_field(name="❌ use-alternate-keepalive", - value="Enable this in purpur.yml.", - inline=True) - if use_alternate_keepalive == "true" and "TCPShield" in plugins: - embed_var.add_field(name="❌ use-alternate-keepalive", - value="Disable this in purpur.yml. It causes issues with TCPShield.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - dont_send_useless_entity_packets = r["timingsMaster"]["config"]["purpur"]["settings"][ - "dont-send-useless-entity-packets"] - if dont_send_useless_entity_packets == "false": - embed_var.add_field(name="❌ dont-send-useless-entity-packets", - value="Enable this in purpur.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - disable_treasure_searching = \ - r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["dolphin"][ - "disable-treasure-searching"] - if disable_treasure_searching == "false": - embed_var.add_field(name="❌ dolphin.disable-treasure-searching", - value="Enable this in purpur.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - brain_ticks = int( - r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ - "brain-ticks"]) - if brain_ticks == 1: - embed_var.add_field(name="❌ villager.brain-ticks", - value="Increase this in purpur.yml. " - "Recommended: 4.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - iron_golem_radius = int( - r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ - "spawn-iron-golem"]["radius"]) - if iron_golem_radius == 0: - embed_var.add_field(name="❌ spawn-iron-golem.radius", - value="Set a value in purpur.yml. " - "Recommended: 32.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - iron_golem_limit = int( - r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ - "spawn-iron-golem"]["limit"]) - if iron_golem_limit == 0: - embed_var.add_field(name="❌ spawn-iron-golem.limit", - value="Set a value in purpur.yml. " - "Recommended: 5.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - aggressive_towards_villager_when_lagging = \ - r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["zombie"][ - "aggressive-towards-villager-when-lagging"] - if aggressive_towards_villager_when_lagging == "true": - embed_var.add_field(name="❌ zombie.aggresive-towards-villager-when-lagging", - value="Disable this in purpur.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - entities_can_use_portals = \ - r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["gameplay-mechanics"][ - "entities-can-use-portals"] - if entities_can_use_portals == "true": - embed_var.add_field(name="❌ entities-can-use-portals", - value="Disable this in purpur.yml to prevent players from creating chunk anchors.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - lobotomize_enabled = r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ - "lobotomize"]["enabled"] - if lobotomize_enabled == "false": - embed_var.add_field(name="❌ villager.lobotomize.enabled", - value="Enable this in purpur.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 - - try: - teleport_if_outside_border = r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["gameplay-mechanics"]["player"]["teleport-if-outside-border"] - if teleport_if_outside_border == "false": - embed_var.add_field(name="❌ player.teleport-if-outside-border", - value="Enable this in purpur.yml.", - inline=True) - except KeyError: - unchecked = unchecked + 1 + except KeyError: + unchecked = unchecked + 1 + + try: + projectile_load_save = int(r["timingsMaster"]["config"]["paper"]["world-settings"]["default"][ + "projectile-load-save-per-chunk-limit"]) + if projectile_load_save == -1: + embed_var.add_field(name="❌ projectile-load-save-per-chunk-limit", + value="Set a value in paper.yml. Recommended: 8.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + use_alternate_keepalive = r["timingsMaster"]["config"]["purpur"]["settings"]["use-alternate-keepalive"] + if use_alternate_keepalive == "false" and "TCPShield" not in plugins: + embed_var.add_field(name="❌ use-alternate-keepalive", + value="Enable this in purpur.yml.", + inline=True) + if use_alternate_keepalive == "true" and "TCPShield" in plugins: + embed_var.add_field(name="❌ use-alternate-keepalive", + value="Disable this in purpur.yml. It causes issues with TCPShield.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + dont_send_useless_entity_packets = r["timingsMaster"]["config"]["purpur"]["settings"][ + "dont-send-useless-entity-packets"] + if dont_send_useless_entity_packets == "false": + embed_var.add_field(name="❌ dont-send-useless-entity-packets", + value="Enable this in purpur.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + disable_treasure_searching = \ + r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["dolphin"][ + "disable-treasure-searching"] + if disable_treasure_searching == "false": + embed_var.add_field(name="❌ dolphin.disable-treasure-searching", + value="Enable this in purpur.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + brain_ticks = int( + r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ + "brain-ticks"]) + if brain_ticks == 1: + embed_var.add_field(name="❌ villager.brain-ticks", + value="Increase this in purpur.yml. " + "Recommended: 4.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + iron_golem_radius = int( + r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ + "spawn-iron-golem"]["radius"]) + if iron_golem_radius == 0: + embed_var.add_field(name="❌ spawn-iron-golem.radius", + value="Set a value in purpur.yml. " + "Recommended: 32.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + iron_golem_limit = int( + r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ + "spawn-iron-golem"]["limit"]) + if iron_golem_limit == 0: + embed_var.add_field(name="❌ spawn-iron-golem.limit", + value="Set a value in purpur.yml. " + "Recommended: 5.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + aggressive_towards_villager_when_lagging = \ + r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["zombie"][ + "aggressive-towards-villager-when-lagging"] + if aggressive_towards_villager_when_lagging == "true": + embed_var.add_field(name="❌ zombie.aggresive-towards-villager-when-lagging", + value="Disable this in purpur.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + entities_can_use_portals = \ + r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["gameplay-mechanics"][ + "entities-can-use-portals"] + if entities_can_use_portals == "true": + embed_var.add_field(name="❌ entities-can-use-portals", + value="Disable this in purpur.yml to prevent players from creating chunk anchors.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + lobotomize_enabled = r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["mobs"]["villager"][ + "lobotomize"]["enabled"] + if lobotomize_enabled == "false": + embed_var.add_field(name="❌ villager.lobotomize.enabled", + value="Enable this in purpur.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + + try: + teleport_if_outside_border = r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["gameplay-mechanics"]["player"]["teleport-if-outside-border"] + if teleport_if_outside_border == "false": + embed_var.add_field(name="❌ player.teleport-if-outside-border", + value="Enable this in purpur.yml.", + inline=True) + except KeyError: + unchecked = unchecked + 1 + except ValueError: + embed_var.add_field(name="❌ Invalid Configuration", + value="At least one of your configuration files had an invalid data type.", + inline=True) + await message.channel.send(embed=embed_var) + return if len(embed_var.fields) == 0: embed_var.add_field(name="✅ All good", From 87dd7878b5ca20918534a96bab0fa9d1fed6ef86 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 04:44:13 -0600 Subject: [PATCH 15/63] Testing cog for account linking pt. 1 --- bot.py | 141 +-------------------------------------------------------- 1 file changed, 1 insertion(+), 140 deletions(-) diff --git a/bot.py b/bot.py index 84e4c00..2dd9eb6 100644 --- a/bot.py +++ b/bot.py @@ -45,148 +45,9 @@ async def on_ready(): @bot.event async def on_message(message): # Account link - if message.author != bot.user and message.guild == None: - channel = message.channel - await channel.send("Processing, please wait...") - # Potential API key, so tries it out - if len(message.content) == 48: - url = "https://panel.birdflop.com/api/client/account" - - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Authorization': 'Bearer ' + message.content, - } - - # response = requests.get(url, headers=headers) - - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - - # If API token is verified to be correct: - if response.status == 200: - - # Formats response of account in JSON format - json_response = await response.json() - - # Loads contents of users.json - file = open('users.json', 'r') - data = json.load(file) - file.close() - - # Checks if user exists. If so, skips adding them to users.json - client_id_already_exists = False - discord_id_already_exists = False - for user in data['users']: - if user['client_id'] == json_response['attributes']['id']: - client_id_already_exists = True - logging.info("Client ID already exists") - if user['discord_id'] == message.author.id: - discord_id_already_exists = True - logging.info("Discord ID already exists") - if client_id_already_exists == False and discord_id_already_exists == False: - data['users'].append({ - 'discord_id': message.author.id, - 'client_id': json_response['attributes']['id'], - 'client_api_key': message.content - }) - json_dumps = json.dumps(data, indent=2) - # Adds user to users.json - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - - guild = bot.get_guild(guild_id) - member = guild.get_member(message.author.id) - if member: - - url = "https://panel.birdflop.com/api/client" - - headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer ' + message.content, - } - - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - - # If API token is verified to be correct, continues - if response.status == 200: - - # Formats response for servers in JSON format - servers_json_response = await response.json() - - user_client = False - user_subuser = False - user_crabwings = False - user_duckfeet = False - user_elktail = False - for server in servers_json_response['data']: - server_owner = server['attributes']['server_owner'] - if server_owner == True: - user_client = True - elif server_owner == False: - user_subuser = True - server_node = server['attributes']['node'] - if server_node == "Crabwings - NYC": - user_crabwings = True - elif server_node == "Duckfeet - EU": - user_duckfeet = True - elif server_node == "Elktail - EU": - user_elktail = True - if user_client == True: - role = discord.utils.get(guild.roles, id=client_role_id) - await member.add_roles(role) - if user_subuser == True: - role = discord.utils.get(guild.roles, id=subuser_role_id) - await member.add_roles(role) - if user_crabwings == True: - role = discord.utils.get(guild.roles, id=crabwings_role_id) - await member.add_roles(role) - if user_duckfeet == True: - role = discord.utils.get(guild.roles, id=duckfeet_role_id) - await member.add_roles(role) - if user_elktail == True: - role = discord.utils.get(guild.roles, id=elktail_role_id) - await member.add_roles(role) - role = discord.utils.get(guild.roles, id=verified_role_id) - await member.add_roles(role) - - await channel.send( - 'Your Discord account has been linked to your panel account! You may unlink your Discord and panel accounts by reacting in the #verification channel or by deleting your Verification API key.') - logging.info("Success message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + ". User linked to API key " + message.content + " and client_id " + str( - json_response['attributes']['id'])) - elif discord_id_already_exists: - await channel.send( - 'Sorry, your Discord account is already linked to a panel account. If you would like to link your Discord account to a different panel account, please unlink your Discord account first by reacting in the #verification channel.') - logging.info("Duplicate Discord message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( - json_response['attributes']['id'])) - elif client_id_already_exists: - await channel.send( - 'Sorry, your panel account is already linked to a Discord account. If you would like to link your panel account to a different Discord account, please unlink your panel account first by deleting its Verification API key and waiting up to 10 minutes.') - logging.info("Duplicate panel message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( - json_response['attributes']['id'])) - else: - # Says if API key is the corect # of characters but invalid - await channel.send("Sorry, that appears to be an invalid API key.") - logging.info( - 'invalid sent to ' + message.author.name + "#" + str(message.author.discriminator) + " (" + str( - message.author.id) + ")") - else: - # Says this if API key is incorrect # of characters - await channel.send( - 'Sorry, that doesn\'t appear to be an API token. An API token should be a long string resembling this: ```yQSB12ik6YRcmE4d8tIEj5gkQqDs6jQuZwVOo4ZjSGl28d46```') - logging.info("obvious incorrect sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str(message.author.id) + ")") # Binflop - elif len(message.attachments) > 0: + if len(message.attachments) > 0: if message.attachments[0].url.endswith( ('.png', '.jpg', '.jpeg', '.mp4', '.mov', '.avi', '.gif', '.image')) == False: download = message.attachments[0].url From c494f53e5e8411e91219cc03b1d1d4b371dfbd90 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 04:46:00 -0600 Subject: [PATCH 16/63] Update bot.py --- bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 2dd9eb6..5e19e39 100644 --- a/bot.py +++ b/bot.py @@ -72,9 +72,9 @@ async def on_message(message): embed_var = discord.Embed(title="Please use a paste service", color=0x1D83D4) embed_var.description = response await message.channel.send(embed=embed_var) - + linking = bot.get_cog('Linking') + await linking.link_account(message) timings = bot.get_cog('Timings') - await timings.analyze_timings(message) await bot.process_commands(message) From fafaa5ffcb7fe46e901973d63667d1d6300d1fb7 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 04:50:46 -0600 Subject: [PATCH 17/63] Create linking.py --- cogs/linking.py | 160 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 cogs/linking.py diff --git a/cogs/linking.py b/cogs/linking.py new file mode 100644 index 0000000..9d73e56 --- /dev/null +++ b/cogs/linking.py @@ -0,0 +1,160 @@ +import os +import discord +import requests +import json +import logging +import sys +from discord.ext import commands, tasks +from discord.ext.commands import has_permissions, MissingPermissions +from dotenv import load_dotenv +import aiohttp +import asyncio + +class Linking(commands.Cog): + + def __init__(self, bot): + self.bot = bot + + async def link_account(self, message): + if message.author != bot.user and message.guild == None: + channel = message.channel + await channel.send("Processing, please wait...") + # Potential API key, so tries it out + if len(message.content) == 48: + url = "https://panel.birdflop.com/api/client/account" + + headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + message.content, + } + + # response = requests.get(url, headers=headers) + + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + + # If API token is verified to be correct: + if response.status == 200: + + # Formats response of account in JSON format + json_response = await response.json() + + # Loads contents of users.json + file = open('users.json', 'r') + data = json.load(file) + file.close() + + # Checks if user exists. If so, skips adding them to users.json + client_id_already_exists = False + discord_id_already_exists = False + for user in data['users']: + if user['client_id'] == json_response['attributes']['id']: + client_id_already_exists = True + logging.info("Client ID already exists") + if user['discord_id'] == message.author.id: + discord_id_already_exists = True + logging.info("Discord ID already exists") + if client_id_already_exists == False and discord_id_already_exists == False: + data['users'].append({ + 'discord_id': message.author.id, + 'client_id': json_response['attributes']['id'], + 'client_api_key': message.content + }) + json_dumps = json.dumps(data, indent=2) + # Adds user to users.json + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + + guild = bot.get_guild(guild_id) + member = guild.get_member(message.author.id) + if member: + + url = "https://panel.birdflop.com/api/client" + + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer ' + message.content, + } + + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + + # If API token is verified to be correct, continues + if response.status == 200: + + # Formats response for servers in JSON format + servers_json_response = await response.json() + + user_client = False + user_subuser = False + user_crabwings = False + user_duckfeet = False + user_elktail = False + for server in servers_json_response['data']: + server_owner = server['attributes']['server_owner'] + if server_owner == True: + user_client = True + elif server_owner == False: + user_subuser = True + server_node = server['attributes']['node'] + if server_node == "Crabwings - NYC": + user_crabwings = True + elif server_node == "Duckfeet - EU": + user_duckfeet = True + elif server_node == "Elktail - EU": + user_elktail = True + if user_client == True: + role = discord.utils.get(guild.roles, id=client_role_id) + await member.add_roles(role) + if user_subuser == True: + role = discord.utils.get(guild.roles, id=subuser_role_id) + await member.add_roles(role) + if user_crabwings == True: + role = discord.utils.get(guild.roles, id=crabwings_role_id) + await member.add_roles(role) + if user_duckfeet == True: + role = discord.utils.get(guild.roles, id=duckfeet_role_id) + await member.add_roles(role) + if user_elktail == True: + role = discord.utils.get(guild.roles, id=elktail_role_id) + await member.add_roles(role) + role = discord.utils.get(guild.roles, id=verified_role_id) + await member.add_roles(role) + + await channel.send( + 'Your Discord account has been linked to your panel account! You may unlink your Discord and panel accounts by reacting in the #verification channel or by deleting your Verification API key.') + logging.info("Success message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + ". User linked to API key " + message.content + " and client_id " + str( + json_response['attributes']['id'])) + elif discord_id_already_exists: + await channel.send( + 'Sorry, your Discord account is already linked to a panel account. If you would like to link your Discord account to a different panel account, please unlink your Discord account first by reacting in the #verification channel.') + logging.info("Duplicate Discord message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( + json_response['attributes']['id'])) + elif client_id_already_exists: + await channel.send( + 'Sorry, your panel account is already linked to a Discord account. If you would like to link your panel account to a different Discord account, please unlink your panel account first by deleting its Verification API key and waiting up to 10 minutes.') + logging.info("Duplicate panel message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( + json_response['attributes']['id'])) + else: + # Says if API key is the corect # of characters but invalid + await channel.send("Sorry, that appears to be an invalid API key.") + logging.info( + 'invalid sent to ' + message.author.name + "#" + str(message.author.discriminator) + " (" + str( + message.author.id) + ")") + else: + # Says this if API key is incorrect # of characters + await channel.send( + 'Sorry, that doesn\'t appear to be an API token. An API token should be a long string resembling this: ```yQSB12ik6YRcmE4d8tIEj5gkQqDs6jQuZwVOo4ZjSGl28d46```') + logging.info("obvious incorrect sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str(message.author.id) + ")") + +def setup(bot): + bot.add_cog(Linking(bot)) From 1c629071012b96ce12767ac1b50472209f0fe00b Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 04:52:52 -0600 Subject: [PATCH 18/63] Update linking.py --- cogs/linking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index 9d73e56..a8b40cb 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -16,7 +16,7 @@ class Linking(commands.Cog): self.bot = bot async def link_account(self, message): - if message.author != bot.user and message.guild == None: + if message.author != self.user and message.guild == None: channel = message.channel await channel.send("Processing, please wait...") # Potential API key, so tries it out From 20716d0775dac91065e9ba638536f40ba3508929 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 04:54:51 -0600 Subject: [PATCH 19/63] Update linking.py --- cogs/linking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index a8b40cb..ec9ed19 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -16,7 +16,7 @@ class Linking(commands.Cog): self.bot = bot async def link_account(self, message): - if message.author != self.user and message.guild == None: + if message.author != self.bot.user and message.guild == None: channel = message.channel await channel.send("Processing, please wait...") # Potential API key, so tries it out From 01a92af99f1696ba12e41c6087103755e656df09 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 04:56:19 -0600 Subject: [PATCH 20/63] Update linking.py --- cogs/linking.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/cogs/linking.py b/cogs/linking.py index ec9ed19..14e8b2a 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -1,14 +1,4 @@ -import os -import discord -import requests -import json -import logging -import sys -from discord.ext import commands, tasks -from discord.ext.commands import has_permissions, MissingPermissions -from dotenv import load_dotenv -import aiohttp -import asyncio + class Linking(commands.Cog): From 5aa57d4484374af5f89f0d1276da7f3dd4808e08 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 04:56:54 -0600 Subject: [PATCH 21/63] Update linking.py --- cogs/linking.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index 14e8b2a..ec9ed19 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -1,4 +1,14 @@ - +import os +import discord +import requests +import json +import logging +import sys +from discord.ext import commands, tasks +from discord.ext.commands import has_permissions, MissingPermissions +from dotenv import load_dotenv +import aiohttp +import asyncio class Linking(commands.Cog): From 20214902dd4e132d894ad1d15c9957dbdf11f2f8 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 04:58:36 -0600 Subject: [PATCH 22/63] Update linking.py --- cogs/linking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index ec9ed19..268d97b 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -67,7 +67,7 @@ class Linking(commands.Cog): file.write(json_dumps) file.close() - guild = bot.get_guild(guild_id) + guild = self.bot.get_guild(guild_id) member = guild.get_member(message.author.id) if member: From 97c76220edd6473b824a83f6d400c8cd9d062ba8 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:01:01 -0600 Subject: [PATCH 23/63] Update linking.py --- cogs/linking.py | 272 ++++++++++++++++++++++++------------------------ 1 file changed, 137 insertions(+), 135 deletions(-) diff --git a/cogs/linking.py b/cogs/linking.py index 268d97b..00d70e0 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -16,145 +16,147 @@ class Linking(commands.Cog): self.bot = bot async def link_account(self, message): + global guild_id + print(str(guild_id)) if message.author != self.bot.user and message.guild == None: - channel = message.channel - await channel.send("Processing, please wait...") - # Potential API key, so tries it out - if len(message.content) == 48: - url = "https://panel.birdflop.com/api/client/account" - - headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Authorization': 'Bearer ' + message.content, - } - - # response = requests.get(url, headers=headers) - - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - - # If API token is verified to be correct: - if response.status == 200: - - # Formats response of account in JSON format - json_response = await response.json() - - # Loads contents of users.json - file = open('users.json', 'r') - data = json.load(file) + channel = message.channel + await channel.send("Processing, please wait...") + # Potential API key, so tries it out + if len(message.content) == 48: + url = "https://panel.birdflop.com/api/client/account" + + headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + message.content, + } + + # response = requests.get(url, headers=headers) + + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + + # If API token is verified to be correct: + if response.status == 200: + + # Formats response of account in JSON format + json_response = await response.json() + + # Loads contents of users.json + file = open('users.json', 'r') + data = json.load(file) + file.close() + + # Checks if user exists. If so, skips adding them to users.json + client_id_already_exists = False + discord_id_already_exists = False + for user in data['users']: + if user['client_id'] == json_response['attributes']['id']: + client_id_already_exists = True + logging.info("Client ID already exists") + if user['discord_id'] == message.author.id: + discord_id_already_exists = True + logging.info("Discord ID already exists") + if client_id_already_exists == False and discord_id_already_exists == False: + data['users'].append({ + 'discord_id': message.author.id, + 'client_id': json_response['attributes']['id'], + 'client_api_key': message.content + }) + json_dumps = json.dumps(data, indent=2) + # Adds user to users.json + file = open('users.json', 'w') + file.write(json_dumps) file.close() - # Checks if user exists. If so, skips adding them to users.json - client_id_already_exists = False - discord_id_already_exists = False - for user in data['users']: - if user['client_id'] == json_response['attributes']['id']: - client_id_already_exists = True - logging.info("Client ID already exists") - if user['discord_id'] == message.author.id: - discord_id_already_exists = True - logging.info("Discord ID already exists") - if client_id_already_exists == False and discord_id_already_exists == False: - data['users'].append({ - 'discord_id': message.author.id, - 'client_id': json_response['attributes']['id'], - 'client_api_key': message.content - }) - json_dumps = json.dumps(data, indent=2) - # Adds user to users.json - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - - guild = self.bot.get_guild(guild_id) - member = guild.get_member(message.author.id) - if member: - - url = "https://panel.birdflop.com/api/client" - - headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer ' + message.content, - } - - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - - # If API token is verified to be correct, continues - if response.status == 200: - - # Formats response for servers in JSON format - servers_json_response = await response.json() - - user_client = False - user_subuser = False - user_crabwings = False - user_duckfeet = False - user_elktail = False - for server in servers_json_response['data']: - server_owner = server['attributes']['server_owner'] - if server_owner == True: - user_client = True - elif server_owner == False: - user_subuser = True - server_node = server['attributes']['node'] - if server_node == "Crabwings - NYC": - user_crabwings = True - elif server_node == "Duckfeet - EU": - user_duckfeet = True - elif server_node == "Elktail - EU": - user_elktail = True - if user_client == True: - role = discord.utils.get(guild.roles, id=client_role_id) - await member.add_roles(role) - if user_subuser == True: - role = discord.utils.get(guild.roles, id=subuser_role_id) - await member.add_roles(role) - if user_crabwings == True: - role = discord.utils.get(guild.roles, id=crabwings_role_id) - await member.add_roles(role) - if user_duckfeet == True: - role = discord.utils.get(guild.roles, id=duckfeet_role_id) - await member.add_roles(role) - if user_elktail == True: - role = discord.utils.get(guild.roles, id=elktail_role_id) - await member.add_roles(role) - role = discord.utils.get(guild.roles, id=verified_role_id) + guild = self.bot.get_guild(guild_id) + member = guild.get_member(message.author.id) + if member: + + url = "https://panel.birdflop.com/api/client" + + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer ' + message.content, + } + + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + + # If API token is verified to be correct, continues + if response.status == 200: + + # Formats response for servers in JSON format + servers_json_response = await response.json() + + user_client = False + user_subuser = False + user_crabwings = False + user_duckfeet = False + user_elktail = False + for server in servers_json_response['data']: + server_owner = server['attributes']['server_owner'] + if server_owner == True: + user_client = True + elif server_owner == False: + user_subuser = True + server_node = server['attributes']['node'] + if server_node == "Crabwings - NYC": + user_crabwings = True + elif server_node == "Duckfeet - EU": + user_duckfeet = True + elif server_node == "Elktail - EU": + user_elktail = True + if user_client == True: + role = discord.utils.get(guild.roles, id=client_role_id) await member.add_roles(role) - - await channel.send( - 'Your Discord account has been linked to your panel account! You may unlink your Discord and panel accounts by reacting in the #verification channel or by deleting your Verification API key.') - logging.info("Success message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + ". User linked to API key " + message.content + " and client_id " + str( - json_response['attributes']['id'])) - elif discord_id_already_exists: - await channel.send( - 'Sorry, your Discord account is already linked to a panel account. If you would like to link your Discord account to a different panel account, please unlink your Discord account first by reacting in the #verification channel.') - logging.info("Duplicate Discord message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( - json_response['attributes']['id'])) - elif client_id_already_exists: - await channel.send( - 'Sorry, your panel account is already linked to a Discord account. If you would like to link your panel account to a different Discord account, please unlink your panel account first by deleting its Verification API key and waiting up to 10 minutes.') - logging.info("Duplicate panel message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( - json_response['attributes']['id'])) - else: - # Says if API key is the corect # of characters but invalid - await channel.send("Sorry, that appears to be an invalid API key.") - logging.info( - 'invalid sent to ' + message.author.name + "#" + str(message.author.discriminator) + " (" + str( - message.author.id) + ")") - else: - # Says this if API key is incorrect # of characters - await channel.send( - 'Sorry, that doesn\'t appear to be an API token. An API token should be a long string resembling this: ```yQSB12ik6YRcmE4d8tIEj5gkQqDs6jQuZwVOo4ZjSGl28d46```') - logging.info("obvious incorrect sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str(message.author.id) + ")") + if user_subuser == True: + role = discord.utils.get(guild.roles, id=subuser_role_id) + await member.add_roles(role) + if user_crabwings == True: + role = discord.utils.get(guild.roles, id=crabwings_role_id) + await member.add_roles(role) + if user_duckfeet == True: + role = discord.utils.get(guild.roles, id=duckfeet_role_id) + await member.add_roles(role) + if user_elktail == True: + role = discord.utils.get(guild.roles, id=elktail_role_id) + await member.add_roles(role) + role = discord.utils.get(guild.roles, id=verified_role_id) + await member.add_roles(role) + + await channel.send( + 'Your Discord account has been linked to your panel account! You may unlink your Discord and panel accounts by reacting in the #verification channel or by deleting your Verification API key.') + logging.info("Success message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + ". User linked to API key " + message.content + " and client_id " + str( + json_response['attributes']['id'])) + elif discord_id_already_exists: + await channel.send( + 'Sorry, your Discord account is already linked to a panel account. If you would like to link your Discord account to a different panel account, please unlink your Discord account first by reacting in the #verification channel.') + logging.info("Duplicate Discord message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( + json_response['attributes']['id'])) + elif client_id_already_exists: + await channel.send( + 'Sorry, your panel account is already linked to a Discord account. If you would like to link your panel account to a different Discord account, please unlink your panel account first by deleting its Verification API key and waiting up to 10 minutes.') + logging.info("Duplicate panel message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( + json_response['attributes']['id'])) + else: + # Says if API key is the corect # of characters but invalid + await channel.send("Sorry, that appears to be an invalid API key.") + logging.info( + 'invalid sent to ' + message.author.name + "#" + str(message.author.discriminator) + " (" + str( + message.author.id) + ")") + else: + # Says this if API key is incorrect # of characters + await channel.send( + 'Sorry, that doesn\'t appear to be an API token. An API token should be a long string resembling this: ```yQSB12ik6YRcmE4d8tIEj5gkQqDs6jQuZwVOo4ZjSGl28d46```') + logging.info("obvious incorrect sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str(message.author.id) + ")") def setup(bot): bot.add_cog(Linking(bot)) From a5d030e67b05c4fb2cda554c0107510f90619744 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:02:37 -0600 Subject: [PATCH 24/63] Update linking.py --- cogs/linking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index 00d70e0..009c07a 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -14,9 +14,9 @@ class Linking(commands.Cog): def __init__(self, bot): self.bot = bot + guild_id = int(os.getenv('guild_id')) async def link_account(self, message): - global guild_id print(str(guild_id)) if message.author != self.bot.user and message.guild == None: channel = message.channel From a7dac02ae906c382d55f0d7d53101867190893dd Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:03:12 -0600 Subject: [PATCH 25/63] Update linking.py --- cogs/linking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index 009c07a..08d5b81 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -14,9 +14,9 @@ class Linking(commands.Cog): def __init__(self, bot): self.bot = bot - guild_id = int(os.getenv('guild_id')) async def link_account(self, message): + guild_id = int(os.getenv('guild_id')) print(str(guild_id)) if message.author != self.bot.user and message.guild == None: channel = message.channel From 733c6470c7c43e107e142ef4a7e5c13281af6d9b Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:05:53 -0600 Subject: [PATCH 26/63] Update linking.py --- cogs/linking.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cogs/linking.py b/cogs/linking.py index 08d5b81..10a9fb7 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -16,8 +16,12 @@ class Linking(commands.Cog): self.bot = bot async def link_account(self, message): - guild_id = int(os.getenv('guild_id')) - print(str(guild_id)) + try: + guild_id + print(str(guild_id) + "exists") + except NameError: + guild_id=int(os.getenv('guild_id') + print(str(guild_id) + "created") if message.author != self.bot.user and message.guild == None: channel = message.channel await channel.send("Processing, please wait...") From 57d53f157c6161123a50240276b2ac2675ff9540 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:07:08 -0600 Subject: [PATCH 27/63] Update linking.py --- cogs/linking.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/linking.py b/cogs/linking.py index 10a9fb7..17619c2 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -20,8 +20,8 @@ class Linking(commands.Cog): guild_id print(str(guild_id) + "exists") except NameError: - guild_id=int(os.getenv('guild_id') - print(str(guild_id) + "created") + guild_id=int(os.getenv('guild_id')) + print(str(guild_id) + " created") if message.author != self.bot.user and message.guild == None: channel = message.channel await channel.send("Processing, please wait...") From 0e1f6264e72097dc6992839664b052144cd0093a Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:11:49 -0600 Subject: [PATCH 28/63] Update linking.py --- cogs/linking.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index 17619c2..2adb251 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -14,8 +14,10 @@ class Linking(commands.Cog): def __init__(self, bot): self.bot = bot + guild_id = int(os.getenv('guild_id')) - async def link_account(self, message): + @commands.Cog.listener() + async def on_message(self, message): try: guild_id print(str(guild_id) + "exists") From b8362049506e54e0af172c8e1b070c8e8386f652 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:12:54 -0600 Subject: [PATCH 29/63] Update bot.py --- bot.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 5e19e39..a6e9485 100644 --- a/bot.py +++ b/bot.py @@ -71,9 +71,7 @@ async def on_message(message): response = response + "\n(file was truncated because it was too long.)" embed_var = discord.Embed(title="Please use a paste service", color=0x1D83D4) embed_var.description = response - await message.channel.send(embed=embed_var) - linking = bot.get_cog('Linking') - await linking.link_account(message) + await message.channel.send(embed=embed_var) timings = bot.get_cog('Timings') await timings.analyze_timings(message) await bot.process_commands(message) From 29e2c397d916dd16fd77bee4379ff01323eae46d Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:19:49 -0600 Subject: [PATCH 30/63] Update linking.py --- cogs/linking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index 2adb251..a3b452d 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -14,7 +14,7 @@ class Linking(commands.Cog): def __init__(self, bot): self.bot = bot - guild_id = int(os.getenv('guild_id')) + self.guild_id = int(os.getenv('guild_id')) @commands.Cog.listener() async def on_message(self, message): From 6c517c1a640feb59b30f08069bcee1fe1e70351e Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:21:15 -0600 Subject: [PATCH 31/63] Update linking.py --- cogs/linking.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index a3b452d..66b1f69 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -19,7 +19,6 @@ class Linking(commands.Cog): @commands.Cog.listener() async def on_message(self, message): try: - guild_id print(str(guild_id) + "exists") except NameError: guild_id=int(os.getenv('guild_id')) From ae513aeeee559b0cbbe24e97d2da08d7a0ed4fdb Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:21:59 -0600 Subject: [PATCH 32/63] Update linking.py --- cogs/linking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index 66b1f69..34c4b4a 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -19,7 +19,7 @@ class Linking(commands.Cog): @commands.Cog.listener() async def on_message(self, message): try: - print(str(guild_id) + "exists") + print(str(self.guild_id) + "exists") except NameError: guild_id=int(os.getenv('guild_id')) print(str(guild_id) + " created") From c8ba130ba66a2fd49279f78772ef136939a8d1eb Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:25:04 -0600 Subject: [PATCH 33/63] Update linking.py --- cogs/linking.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cogs/linking.py b/cogs/linking.py index 34c4b4a..d98c6cb 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -17,12 +17,6 @@ class Linking(commands.Cog): self.guild_id = int(os.getenv('guild_id')) @commands.Cog.listener() - async def on_message(self, message): - try: - print(str(self.guild_id) + "exists") - except NameError: - guild_id=int(os.getenv('guild_id')) - print(str(guild_id) + " created") if message.author != self.bot.user and message.guild == None: channel = message.channel await channel.send("Processing, please wait...") @@ -74,7 +68,7 @@ class Linking(commands.Cog): file.write(json_dumps) file.close() - guild = self.bot.get_guild(guild_id) + guild = self.bot.get_guild(self.guild_id) member = guild.get_member(message.author.id) if member: From b6a9a0da2165b322ff712a640be2794a70e1575b Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:25:55 -0600 Subject: [PATCH 34/63] Update linking.py --- cogs/linking.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cogs/linking.py b/cogs/linking.py index d98c6cb..8e30564 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -17,6 +17,7 @@ class Linking(commands.Cog): self.guild_id = int(os.getenv('guild_id')) @commands.Cog.listener() + await link_account(self, message): if message.author != self.bot.user and message.guild == None: channel = message.channel await channel.send("Processing, please wait...") From 3d0913b748c6bbd5d3387070c7f16317dbb53a36 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:27:10 -0600 Subject: [PATCH 35/63] Update linking.py --- cogs/linking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking.py b/cogs/linking.py index 8e30564..97c33b9 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -17,7 +17,7 @@ class Linking(commands.Cog): self.guild_id = int(os.getenv('guild_id')) @commands.Cog.listener() - await link_account(self, message): + async def on_message(self, message): if message.author != self.bot.user and message.guild == None: channel = message.channel await channel.send("Processing, please wait...") From 314cb71c1ce2fe40d8cb065e24fc7fad13526de0 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:30:28 -0600 Subject: [PATCH 36/63] Update linking.py --- cogs/linking.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cogs/linking.py b/cogs/linking.py index 97c33b9..4b21429 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -15,6 +15,12 @@ class Linking(commands.Cog): def __init__(self, bot): self.bot = bot self.guild_id = int(os.getenv('guild_id')) + self.crabwings_role_id = int(os.getenv('crabwings_role_id')) + self.duckfeet_role_id = int(os.getenv('duckfeet_role_id')) + self.elktail_role_id = int(os.getenv('elktail_role_id')) + self.client_role_id = int(os.getenv('client_role_id')) + self.subuser_role_id = int(os.getenv('subuser_role_id')) + self.verified_role_id = int(os.getenv('verified_role_id')) @commands.Cog.listener() async def on_message(self, message): @@ -108,21 +114,21 @@ class Linking(commands.Cog): elif server_node == "Elktail - EU": user_elktail = True if user_client == True: - role = discord.utils.get(guild.roles, id=client_role_id) + role = discord.utils.get(guild.roles, id=self.client_role_id) await member.add_roles(role) if user_subuser == True: - role = discord.utils.get(guild.roles, id=subuser_role_id) + role = discord.utils.get(guild.roles, id=self.subuser_role_id) await member.add_roles(role) if user_crabwings == True: - role = discord.utils.get(guild.roles, id=crabwings_role_id) + role = discord.utils.get(guild.roles, id=self.crabwings_role_id) await member.add_roles(role) if user_duckfeet == True: - role = discord.utils.get(guild.roles, id=duckfeet_role_id) + role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) await member.add_roles(role) if user_elktail == True: - role = discord.utils.get(guild.roles, id=elktail_role_id) + role = discord.utils.get(guild.roles, id=self.elktail_role_id) await member.add_roles(role) - role = discord.utils.get(guild.roles, id=verified_role_id) + role = discord.utils.get(guild.roles, id=self.verified_role_id) await member.add_roles(role) await channel.send( From 41ba011caef67f58cdc3c7820d998f086dbc358a Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:43:41 -0600 Subject: [PATCH 37/63] Create linking_updater.py --- cogs/linking_updater.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cogs/linking_updater.py diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py new file mode 100644 index 0000000..1831f75 --- /dev/null +++ b/cogs/linking_updater.py @@ -0,0 +1,22 @@ +import os +import discord +import requests +import json +import logging +from discord.ext import commands, tasks +from discord.ext.commands import has_permissions, MissingPermissions +from dotenv import load_dotenv +import aiohttp +import asyncio + +class Linking(commands.Cog): + + def __init__(self, bot): + self.bot = bot + self.guild_id = int(os.getenv('guild_id')) + self.crabwings_role_id = int(os.getenv('crabwings_role_id')) + self.duckfeet_role_id = int(os.getenv('duckfeet_role_id')) + self.elktail_role_id = int(os.getenv('elktail_role_id')) + self.client_role_id = int(os.getenv('client_role_id')) + self.subuser_role_id = int(os.getenv('subuser_role_id')) + self.verified_role_id = int(os.getenv('verified_role_id')) From dbad211c0e37599a5d3559a9a3ac098be9cc6c32 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:43:55 -0600 Subject: [PATCH 38/63] Update linking_updater.py --- cogs/linking_updater.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 1831f75..8b13789 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -1,22 +1 @@ -import os -import discord -import requests -import json -import logging -from discord.ext import commands, tasks -from discord.ext.commands import has_permissions, MissingPermissions -from dotenv import load_dotenv -import aiohttp -import asyncio -class Linking(commands.Cog): - - def __init__(self, bot): - self.bot = bot - self.guild_id = int(os.getenv('guild_id')) - self.crabwings_role_id = int(os.getenv('crabwings_role_id')) - self.duckfeet_role_id = int(os.getenv('duckfeet_role_id')) - self.elktail_role_id = int(os.getenv('elktail_role_id')) - self.client_role_id = int(os.getenv('client_role_id')) - self.subuser_role_id = int(os.getenv('subuser_role_id')) - self.verified_role_id = int(os.getenv('verified_role_id')) From 7019ed2a7cfd11c01331e67f1d30cb1d6cc9010e Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:44:01 -0600 Subject: [PATCH 39/63] Delete linking_updater.py --- cogs/linking_updater.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 cogs/linking_updater.py diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py deleted file mode 100644 index 8b13789..0000000 --- a/cogs/linking_updater.py +++ /dev/null @@ -1 +0,0 @@ - From 81991b873da4d36e47b0a8f1aaeb316a69953e44 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:44:25 -0600 Subject: [PATCH 40/63] Create linking_updater.py --- cogs/linking_updater.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cogs/linking_updater.py diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py new file mode 100644 index 0000000..1831f75 --- /dev/null +++ b/cogs/linking_updater.py @@ -0,0 +1,22 @@ +import os +import discord +import requests +import json +import logging +from discord.ext import commands, tasks +from discord.ext.commands import has_permissions, MissingPermissions +from dotenv import load_dotenv +import aiohttp +import asyncio + +class Linking(commands.Cog): + + def __init__(self, bot): + self.bot = bot + self.guild_id = int(os.getenv('guild_id')) + self.crabwings_role_id = int(os.getenv('crabwings_role_id')) + self.duckfeet_role_id = int(os.getenv('duckfeet_role_id')) + self.elktail_role_id = int(os.getenv('elktail_role_id')) + self.client_role_id = int(os.getenv('client_role_id')) + self.subuser_role_id = int(os.getenv('subuser_role_id')) + self.verified_role_id = int(os.getenv('verified_role_id')) From 77d6348ddb2feb6a91456fafb258a542b7ba5b5c Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:48:11 -0600 Subject: [PATCH 41/63] Update linking_updater.py --- cogs/linking_updater.py | 92 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 1831f75..fab9894 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -9,7 +9,7 @@ from dotenv import load_dotenv import aiohttp import asyncio -class Linking(commands.Cog): +class Linking_updater(commands.Cog): def __init__(self, bot): self.bot = bot @@ -20,3 +20,93 @@ class Linking(commands.Cog): self.client_role_id = int(os.getenv('client_role_id')) self.subuser_role_id = int(os.getenv('subuser_role_id')) self.verified_role_id = int(os.getenv('verified_role_id')) + + @tasks.loop(minutes=10) + async def linking_updater(self): + logging.info("Synchronizing roles") + file = open('users.json', 'r') + data = json.load(file) + file.close() + guild = self.bot.get_guild(guild_id) + i = -1 + for client in data['users']: + i += 1 + member = guild.get_member(client['discord_id']) + if member: + api_key = client['client_api_key'] + url = "https://panel.birdflop.com/api/client" + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer ' + api_key, + } + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + if response.status == 200: + # Formats response for servers in JSON format + servers_json_response = await response.json() + + user_client = False + user_subuser = False + user_crabwings = False + user_duckfeet = False + user_elktail = False + for server in servers_json_response['data']: + server_owner = server['attributes']['server_owner'] + if server_owner == True: + user_client = True + elif server_owner == False: + user_subuser = True + server_node = server['attributes']['node'] + if server_node == "Crabwings - NYC": + user_crabwings = True + elif server_node == "Duckfeet - EU": + user_duckfeet = True + elif server_node == "Elktail - EU": + user_elktail = True + role = discord.utils.get(guild.roles, id=self.client_role_id) + if user_client == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.subuser_role_id) + if user_subuser == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.crabwings_role_id) + if user_crabwings == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) + if user_duckfeet == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.elktail_role_id) + if user_elktail == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + else: + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + await member.edit(roles=[]) + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) + else: + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and client_api_key " + client['client_api_key']) + + @linking_updater.before_loop + async def before_linking_updater(self): + logging.info('waiting to enter loop') + await bot.wait_until_ready() From d66829b9334b73c9cff860a94e5cb380bc44a3c6 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:48:52 -0600 Subject: [PATCH 42/63] Update bot.py --- bot.py | 83 ---------------------------------------------------------- 1 file changed, 83 deletions(-) diff --git a/bot.py b/bot.py index a6e9485..e3036cd 100644 --- a/bot.py +++ b/bot.py @@ -134,89 +134,6 @@ async def react(ctx, url, reaction): @tasks.loop(minutes=10) async def updater(): - logging.info("Synchronizing roles") - file = open('users.json', 'r') - data = json.load(file) - file.close() - guild = bot.get_guild(guild_id) - i = -1 - for client in data['users']: - i += 1 - member = guild.get_member(client['discord_id']) - if member: - api_key = client['client_api_key'] - url = "https://panel.birdflop.com/api/client" - headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer ' + api_key, - } - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - if response.status == 200: - # Formats response for servers in JSON format - servers_json_response = await response.json() - - user_client = False - user_subuser = False - user_crabwings = False - user_duckfeet = False - user_elktail = False - for server in servers_json_response['data']: - server_owner = server['attributes']['server_owner'] - if server_owner == True: - user_client = True - elif server_owner == False: - user_subuser = True - server_node = server['attributes']['node'] - if server_node == "Crabwings - NYC": - user_crabwings = True - elif server_node == "Duckfeet - EU": - user_duckfeet = True - elif server_node == "Elktail - EU": - user_elktail = True - role = discord.utils.get(guild.roles, id=client_role_id) - if user_client == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=subuser_role_id) - if user_subuser == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=crabwings_role_id) - if user_crabwings == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=duckfeet_role_id) - if user_duckfeet == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=elktail_role_id) - if user_elktail == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - await member.edit(roles=[]) - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) - else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and client_api_key " + client['client_api_key']) - # Update backups logging.info('Ensuring backups') url = "https://panel.birdflop.com/api/application/servers" From 92926922bd96f7deed22dc94152a953245f4c17d Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:50:11 -0600 Subject: [PATCH 43/63] debugging --- cogs/linking_updater.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index fab9894..0e01d69 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -42,6 +42,7 @@ class Linking_updater(commands.Cog): async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as response: if response.status == 200: + logging.info("200") # Formats response for servers in JSON format servers_json_response = await response.json() From 00114458000ad5470865bb1eb6e298480632a81b Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:51:23 -0600 Subject: [PATCH 44/63] Update linking_updater.py --- cogs/linking_updater.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 0e01d69..672cace 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -29,10 +29,13 @@ class Linking_updater(commands.Cog): file.close() guild = self.bot.get_guild(guild_id) i = -1 + print("1") for client in data['users']: + print("2") i += 1 member = guild.get_member(client['discord_id']) if member: + print("3") api_key = client['client_api_key'] url = "https://panel.birdflop.com/api/client" headers = { @@ -41,8 +44,9 @@ class Linking_updater(commands.Cog): } async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as response: + print("4") if response.status == 200: - logging.info("200") + print("5") # Formats response for servers in JSON format servers_json_response = await response.json() From 2734b436ad7d7ea4289e33913b159aa5b95346c6 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 05:56:02 -0600 Subject: [PATCH 45/63] Update linking.py --- cogs/linking.py | 225 +++++++++++++++++++----------------------------- 1 file changed, 87 insertions(+), 138 deletions(-) diff --git a/cogs/linking.py b/cogs/linking.py index 4b21429..657949a 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -3,14 +3,13 @@ import discord import requests import json import logging -import sys from discord.ext import commands, tasks from discord.ext.commands import has_permissions, MissingPermissions from dotenv import load_dotenv import aiohttp import asyncio -class Linking(commands.Cog): +class Linking_updater(commands.Cog): def __init__(self, bot): self.bot = bot @@ -21,148 +20,98 @@ class Linking(commands.Cog): self.client_role_id = int(os.getenv('client_role_id')) self.subuser_role_id = int(os.getenv('subuser_role_id')) self.verified_role_id = int(os.getenv('verified_role_id')) - - @commands.Cog.listener() - async def on_message(self, message): - if message.author != self.bot.user and message.guild == None: - channel = message.channel - await channel.send("Processing, please wait...") - # Potential API key, so tries it out - if len(message.content) == 48: - url = "https://panel.birdflop.com/api/client/account" + @tasks.loop(minutes=10) + async def linking_updater(self): + logging.info("Synchronizing roles") + file = open('users.json', 'r') + data = json.load(file) + file.close() + guild = self.bot.get_guild(guild_id) + i = -1 + print("1") + for client in data['users']: + print("2") + i += 1 + member = guild.get_member(client['discord_id']) + if member: + print("3") + api_key = client['client_api_key'] + url = "https://panel.birdflop.com/api/client" headers = { 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Authorization': 'Bearer ' + message.content, + 'Authorization': 'Bearer ' + api_key, } - - # response = requests.get(url, headers=headers) - async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as response: - - # If API token is verified to be correct: + print("4") if response.status == 200: - - # Formats response of account in JSON format - json_response = await response.json() - - # Loads contents of users.json - file = open('users.json', 'r') - data = json.load(file) - file.close() - - # Checks if user exists. If so, skips adding them to users.json - client_id_already_exists = False - discord_id_already_exists = False - for user in data['users']: - if user['client_id'] == json_response['attributes']['id']: - client_id_already_exists = True - logging.info("Client ID already exists") - if user['discord_id'] == message.author.id: - discord_id_already_exists = True - logging.info("Discord ID already exists") - if client_id_already_exists == False and discord_id_already_exists == False: - data['users'].append({ - 'discord_id': message.author.id, - 'client_id': json_response['attributes']['id'], - 'client_api_key': message.content - }) - json_dumps = json.dumps(data, indent=2) - # Adds user to users.json - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - - guild = self.bot.get_guild(self.guild_id) - member = guild.get_member(message.author.id) - if member: - - url = "https://panel.birdflop.com/api/client" - - headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer ' + message.content, - } - - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - - # If API token is verified to be correct, continues - if response.status == 200: - - # Formats response for servers in JSON format - servers_json_response = await response.json() - - user_client = False - user_subuser = False - user_crabwings = False - user_duckfeet = False - user_elktail = False - for server in servers_json_response['data']: - server_owner = server['attributes']['server_owner'] - if server_owner == True: - user_client = True - elif server_owner == False: - user_subuser = True - server_node = server['attributes']['node'] - if server_node == "Crabwings - NYC": - user_crabwings = True - elif server_node == "Duckfeet - EU": - user_duckfeet = True - elif server_node == "Elktail - EU": - user_elktail = True - if user_client == True: - role = discord.utils.get(guild.roles, id=self.client_role_id) - await member.add_roles(role) - if user_subuser == True: - role = discord.utils.get(guild.roles, id=self.subuser_role_id) - await member.add_roles(role) - if user_crabwings == True: - role = discord.utils.get(guild.roles, id=self.crabwings_role_id) - await member.add_roles(role) - if user_duckfeet == True: - role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) - await member.add_roles(role) - if user_elktail == True: - role = discord.utils.get(guild.roles, id=self.elktail_role_id) - await member.add_roles(role) - role = discord.utils.get(guild.roles, id=self.verified_role_id) - await member.add_roles(role) - - await channel.send( - 'Your Discord account has been linked to your panel account! You may unlink your Discord and panel accounts by reacting in the #verification channel or by deleting your Verification API key.') - logging.info("Success message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + ". User linked to API key " + message.content + " and client_id " + str( - json_response['attributes']['id'])) - elif discord_id_already_exists: - await channel.send( - 'Sorry, your Discord account is already linked to a panel account. If you would like to link your Discord account to a different panel account, please unlink your Discord account first by reacting in the #verification channel.') - logging.info("Duplicate Discord message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( - json_response['attributes']['id'])) - elif client_id_already_exists: - await channel.send( - 'Sorry, your panel account is already linked to a Discord account. If you would like to link your panel account to a different Discord account, please unlink your panel account first by deleting its Verification API key and waiting up to 10 minutes.') - logging.info("Duplicate panel message sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str( - message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( - json_response['attributes']['id'])) + print("5") + # Formats response for servers in JSON format + servers_json_response = await response.json() + + user_client = False + user_subuser = False + user_crabwings = False + user_duckfeet = False + user_elktail = False + for server in servers_json_response['data']: + server_owner = server['attributes']['server_owner'] + if server_owner == True: + user_client = True + elif server_owner == False: + user_subuser = True + server_node = server['attributes']['node'] + if server_node == "Crabwings - NYC": + user_crabwings = True + elif server_node == "Duckfeet - EU": + user_duckfeet = True + elif server_node == "Elktail - EU": + user_elktail = True + role = discord.utils.get(guild.roles, id=self.client_role_id) + if user_client == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.subuser_role_id) + if user_subuser == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.crabwings_role_id) + if user_crabwings == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) + if user_duckfeet == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.elktail_role_id) + if user_elktail == True: + await member.add_roles(role) + else: + await member.remove_roles(role) else: - # Says if API key is the corect # of characters but invalid - await channel.send("Sorry, that appears to be an invalid API key.") - logging.info( - 'invalid sent to ' + message.author.name + "#" + str(message.author.discriminator) + " (" + str( - message.author.id) + ")") + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + await member.edit(roles=[]) + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) else: - # Says this if API key is incorrect # of characters - await channel.send( - 'Sorry, that doesn\'t appear to be an API token. An API token should be a long string resembling this: ```yQSB12ik6YRcmE4d8tIEj5gkQqDs6jQuZwVOo4ZjSGl28d46```') - logging.info("obvious incorrect sent to " + message.author.name + "#" + str( - message.author.discriminator) + " (" + str(message.author.id) + ")") - -def setup(bot): - bot.add_cog(Linking(bot)) + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and client_api_key " + client['client_api_key']) + + @linking_updater.before_loop + async def before_linking_updater(self): + logging.info('waiting to enter loop') + await bot.wait_until_ready() From 3dad101b6808efccb7df5e588b8c42565633b9d0 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:02:37 -0600 Subject: [PATCH 46/63] Update linking.py --- cogs/linking.py | 225 +++++++++++++++++++++++++++++------------------- 1 file changed, 138 insertions(+), 87 deletions(-) diff --git a/cogs/linking.py b/cogs/linking.py index 657949a..4b21429 100644 --- a/cogs/linking.py +++ b/cogs/linking.py @@ -3,13 +3,14 @@ import discord import requests import json import logging +import sys from discord.ext import commands, tasks from discord.ext.commands import has_permissions, MissingPermissions from dotenv import load_dotenv import aiohttp import asyncio -class Linking_updater(commands.Cog): +class Linking(commands.Cog): def __init__(self, bot): self.bot = bot @@ -20,98 +21,148 @@ class Linking_updater(commands.Cog): self.client_role_id = int(os.getenv('client_role_id')) self.subuser_role_id = int(os.getenv('subuser_role_id')) self.verified_role_id = int(os.getenv('verified_role_id')) + + @commands.Cog.listener() + async def on_message(self, message): + if message.author != self.bot.user and message.guild == None: + channel = message.channel + await channel.send("Processing, please wait...") + # Potential API key, so tries it out + if len(message.content) == 48: + url = "https://panel.birdflop.com/api/client/account" - @tasks.loop(minutes=10) - async def linking_updater(self): - logging.info("Synchronizing roles") - file = open('users.json', 'r') - data = json.load(file) - file.close() - guild = self.bot.get_guild(guild_id) - i = -1 - print("1") - for client in data['users']: - print("2") - i += 1 - member = guild.get_member(client['discord_id']) - if member: - print("3") - api_key = client['client_api_key'] - url = "https://panel.birdflop.com/api/client" headers = { 'Accept': 'application/json', - 'Authorization': 'Bearer ' + api_key, + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + message.content, } + + # response = requests.get(url, headers=headers) + async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as response: - print("4") + + # If API token is verified to be correct: if response.status == 200: - print("5") - # Formats response for servers in JSON format - servers_json_response = await response.json() - - user_client = False - user_subuser = False - user_crabwings = False - user_duckfeet = False - user_elktail = False - for server in servers_json_response['data']: - server_owner = server['attributes']['server_owner'] - if server_owner == True: - user_client = True - elif server_owner == False: - user_subuser = True - server_node = server['attributes']['node'] - if server_node == "Crabwings - NYC": - user_crabwings = True - elif server_node == "Duckfeet - EU": - user_duckfeet = True - elif server_node == "Elktail - EU": - user_elktail = True - role = discord.utils.get(guild.roles, id=self.client_role_id) - if user_client == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.subuser_role_id) - if user_subuser == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.crabwings_role_id) - if user_crabwings == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) - if user_duckfeet == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.elktail_role_id) - if user_elktail == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) + + # Formats response of account in JSON format + json_response = await response.json() + + # Loads contents of users.json + file = open('users.json', 'r') + data = json.load(file) file.close() - await member.edit(roles=[]) - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) + + # Checks if user exists. If so, skips adding them to users.json + client_id_already_exists = False + discord_id_already_exists = False + for user in data['users']: + if user['client_id'] == json_response['attributes']['id']: + client_id_already_exists = True + logging.info("Client ID already exists") + if user['discord_id'] == message.author.id: + discord_id_already_exists = True + logging.info("Discord ID already exists") + if client_id_already_exists == False and discord_id_already_exists == False: + data['users'].append({ + 'discord_id': message.author.id, + 'client_id': json_response['attributes']['id'], + 'client_api_key': message.content + }) + json_dumps = json.dumps(data, indent=2) + # Adds user to users.json + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + + guild = self.bot.get_guild(self.guild_id) + member = guild.get_member(message.author.id) + if member: + + url = "https://panel.birdflop.com/api/client" + + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer ' + message.content, + } + + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + + # If API token is verified to be correct, continues + if response.status == 200: + + # Formats response for servers in JSON format + servers_json_response = await response.json() + + user_client = False + user_subuser = False + user_crabwings = False + user_duckfeet = False + user_elktail = False + for server in servers_json_response['data']: + server_owner = server['attributes']['server_owner'] + if server_owner == True: + user_client = True + elif server_owner == False: + user_subuser = True + server_node = server['attributes']['node'] + if server_node == "Crabwings - NYC": + user_crabwings = True + elif server_node == "Duckfeet - EU": + user_duckfeet = True + elif server_node == "Elktail - EU": + user_elktail = True + if user_client == True: + role = discord.utils.get(guild.roles, id=self.client_role_id) + await member.add_roles(role) + if user_subuser == True: + role = discord.utils.get(guild.roles, id=self.subuser_role_id) + await member.add_roles(role) + if user_crabwings == True: + role = discord.utils.get(guild.roles, id=self.crabwings_role_id) + await member.add_roles(role) + if user_duckfeet == True: + role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) + await member.add_roles(role) + if user_elktail == True: + role = discord.utils.get(guild.roles, id=self.elktail_role_id) + await member.add_roles(role) + role = discord.utils.get(guild.roles, id=self.verified_role_id) + await member.add_roles(role) + + await channel.send( + 'Your Discord account has been linked to your panel account! You may unlink your Discord and panel accounts by reacting in the #verification channel or by deleting your Verification API key.') + logging.info("Success message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + ". User linked to API key " + message.content + " and client_id " + str( + json_response['attributes']['id'])) + elif discord_id_already_exists: + await channel.send( + 'Sorry, your Discord account is already linked to a panel account. If you would like to link your Discord account to a different panel account, please unlink your Discord account first by reacting in the #verification channel.') + logging.info("Duplicate Discord message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( + json_response['attributes']['id'])) + elif client_id_already_exists: + await channel.send( + 'Sorry, your panel account is already linked to a Discord account. If you would like to link your panel account to a different Discord account, please unlink your panel account first by deleting its Verification API key and waiting up to 10 minutes.') + logging.info("Duplicate panel message sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str( + message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str( + json_response['attributes']['id'])) + else: + # Says if API key is the corect # of characters but invalid + await channel.send("Sorry, that appears to be an invalid API key.") + logging.info( + 'invalid sent to ' + message.author.name + "#" + str(message.author.discriminator) + " (" + str( + message.author.id) + ")") else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and client_api_key " + client['client_api_key']) - - @linking_updater.before_loop - async def before_linking_updater(self): - logging.info('waiting to enter loop') - await bot.wait_until_ready() + # Says this if API key is incorrect # of characters + await channel.send( + 'Sorry, that doesn\'t appear to be an API token. An API token should be a long string resembling this: ```yQSB12ik6YRcmE4d8tIEj5gkQqDs6jQuZwVOo4ZjSGl28d46```') + logging.info("obvious incorrect sent to " + message.author.name + "#" + str( + message.author.discriminator) + " (" + str(message.author.id) + ")") + +def setup(bot): + bot.add_cog(Linking(bot)) From aa1f2186c0dc9d7c0629c9d8c3f6971607c26dcf Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:03:19 -0600 Subject: [PATCH 47/63] Update linking_updater.py --- cogs/linking_updater.py | 184 ++++++++++++++++++++-------------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 672cace..657949a 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -21,97 +21,97 @@ class Linking_updater(commands.Cog): self.subuser_role_id = int(os.getenv('subuser_role_id')) self.verified_role_id = int(os.getenv('verified_role_id')) - @tasks.loop(minutes=10) - async def linking_updater(self): - logging.info("Synchronizing roles") - file = open('users.json', 'r') - data = json.load(file) - file.close() - guild = self.bot.get_guild(guild_id) - i = -1 - print("1") - for client in data['users']: - print("2") - i += 1 - member = guild.get_member(client['discord_id']) - if member: - print("3") - api_key = client['client_api_key'] - url = "https://panel.birdflop.com/api/client" - headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer ' + api_key, - } - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - print("4") - if response.status == 200: - print("5") - # Formats response for servers in JSON format - servers_json_response = await response.json() + @tasks.loop(minutes=10) + async def linking_updater(self): + logging.info("Synchronizing roles") + file = open('users.json', 'r') + data = json.load(file) + file.close() + guild = self.bot.get_guild(guild_id) + i = -1 + print("1") + for client in data['users']: + print("2") + i += 1 + member = guild.get_member(client['discord_id']) + if member: + print("3") + api_key = client['client_api_key'] + url = "https://panel.birdflop.com/api/client" + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer ' + api_key, + } + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + print("4") + if response.status == 200: + print("5") + # Formats response for servers in JSON format + servers_json_response = await response.json() - user_client = False - user_subuser = False - user_crabwings = False - user_duckfeet = False - user_elktail = False - for server in servers_json_response['data']: - server_owner = server['attributes']['server_owner'] - if server_owner == True: - user_client = True - elif server_owner == False: - user_subuser = True - server_node = server['attributes']['node'] - if server_node == "Crabwings - NYC": - user_crabwings = True - elif server_node == "Duckfeet - EU": - user_duckfeet = True - elif server_node == "Elktail - EU": - user_elktail = True - role = discord.utils.get(guild.roles, id=self.client_role_id) - if user_client == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.subuser_role_id) - if user_subuser == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.crabwings_role_id) - if user_crabwings == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) - if user_duckfeet == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.elktail_role_id) - if user_elktail == True: - await member.add_roles(role) - else: - await member.remove_roles(role) + user_client = False + user_subuser = False + user_crabwings = False + user_duckfeet = False + user_elktail = False + for server in servers_json_response['data']: + server_owner = server['attributes']['server_owner'] + if server_owner == True: + user_client = True + elif server_owner == False: + user_subuser = True + server_node = server['attributes']['node'] + if server_node == "Crabwings - NYC": + user_crabwings = True + elif server_node == "Duckfeet - EU": + user_duckfeet = True + elif server_node == "Elktail - EU": + user_elktail = True + role = discord.utils.get(guild.roles, id=self.client_role_id) + if user_client == True: + await member.add_roles(role) else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - await member.edit(roles=[]) - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) - else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and client_api_key " + client['client_api_key']) - - @linking_updater.before_loop - async def before_linking_updater(self): - logging.info('waiting to enter loop') - await bot.wait_until_ready() + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.subuser_role_id) + if user_subuser == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.crabwings_role_id) + if user_crabwings == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) + if user_duckfeet == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.elktail_role_id) + if user_elktail == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + else: + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + await member.edit(roles=[]) + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) + else: + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and client_api_key " + client['client_api_key']) + + @linking_updater.before_loop + async def before_linking_updater(self): + logging.info('waiting to enter loop') + await bot.wait_until_ready() From e6e91d6468f7f1aa80426e3f274f9426460c4cfc Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:05:38 -0600 Subject: [PATCH 48/63] Update linking_updater.py --- cogs/linking_updater.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 657949a..f2ea2fb 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -115,3 +115,6 @@ class Linking_updater(commands.Cog): async def before_linking_updater(self): logging.info('waiting to enter loop') await bot.wait_until_ready() + +def setup(bot): + bot.add_cog(Linking_updater(bot)) From aec25ceeb3466841d37a22543abb43fd2cb3badc Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:07:36 -0600 Subject: [PATCH 49/63] Update linking_updater.py --- cogs/linking_updater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index f2ea2fb..aa308d6 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -21,7 +21,7 @@ class Linking_updater(commands.Cog): self.subuser_role_id = int(os.getenv('subuser_role_id')) self.verified_role_id = int(os.getenv('verified_role_id')) - @tasks.loop(minutes=10) + @tasks.loop(seconds=10) async def linking_updater(self): logging.info("Synchronizing roles") file = open('users.json', 'r') From b51f1d31049e6381e735dc89c1c48a343d8f9a0d Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:10:18 -0600 Subject: [PATCH 50/63] Update linking_updater.py --- cogs/linking_updater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index aa308d6..42a90b7 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -114,7 +114,7 @@ class Linking_updater(commands.Cog): @linking_updater.before_loop async def before_linking_updater(self): logging.info('waiting to enter loop') - await bot.wait_until_ready() + await self.bot.wait_until_ready() def setup(bot): bot.add_cog(Linking_updater(bot)) From d8810b1b25ed56c587c714b7521249beef0d9337 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:15:50 -0600 Subject: [PATCH 51/63] Update linking_updater.py --- cogs/linking_updater.py | 111 +++------------------------------------- 1 file changed, 7 insertions(+), 104 deletions(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 42a90b7..e3cde37 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -1,120 +1,23 @@ -import os import discord -import requests -import json -import logging from discord.ext import commands, tasks -from discord.ext.commands import has_permissions, MissingPermissions -from dotenv import load_dotenv -import aiohttp -import asyncio + + class Linking_updater(commands.Cog): def __init__(self, bot): self.bot = bot - self.guild_id = int(os.getenv('guild_id')) - self.crabwings_role_id = int(os.getenv('crabwings_role_id')) - self.duckfeet_role_id = int(os.getenv('duckfeet_role_id')) - self.elktail_role_id = int(os.getenv('elktail_role_id')) - self.client_role_id = int(os.getenv('client_role_id')) - self.subuser_role_id = int(os.getenv('subuser_role_id')) - self.verified_role_id = int(os.getenv('verified_role_id')) @tasks.loop(seconds=10) async def linking_updater(self): - logging.info("Synchronizing roles") - file = open('users.json', 'r') - data = json.load(file) - file.close() - guild = self.bot.get_guild(guild_id) - i = -1 - print("1") - for client in data['users']: - print("2") - i += 1 - member = guild.get_member(client['discord_id']) - if member: - print("3") - api_key = client['client_api_key'] - url = "https://panel.birdflop.com/api/client" - headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer ' + api_key, - } - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - print("4") - if response.status == 200: - print("5") - # Formats response for servers in JSON format - servers_json_response = await response.json() - - user_client = False - user_subuser = False - user_crabwings = False - user_duckfeet = False - user_elktail = False - for server in servers_json_response['data']: - server_owner = server['attributes']['server_owner'] - if server_owner == True: - user_client = True - elif server_owner == False: - user_subuser = True - server_node = server['attributes']['node'] - if server_node == "Crabwings - NYC": - user_crabwings = True - elif server_node == "Duckfeet - EU": - user_duckfeet = True - elif server_node == "Elktail - EU": - user_elktail = True - role = discord.utils.get(guild.roles, id=self.client_role_id) - if user_client == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.subuser_role_id) - if user_subuser == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.crabwings_role_id) - if user_crabwings == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) - if user_duckfeet == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=self.elktail_role_id) - if user_elktail == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - await member.edit(roles=[]) - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) - else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and client_api_key " + client['client_api_key']) - + print("Hello2") + @linking_updater.before_loop async def before_linking_updater(self): - logging.info('waiting to enter loop') + print("Hello") await self.bot.wait_until_ready() def setup(bot): bot.add_cog(Linking_updater(bot)) + +linking_updater.start() From 364fbb65299d9074b9672e69fd0fc65aa754e075 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:17:23 -0600 Subject: [PATCH 52/63] Update linking_updater.py --- cogs/linking_updater.py | 112 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index e3cde37..85fdd10 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -1,23 +1,121 @@ +import os import discord +import requests +import json +import logging from discord.ext import commands, tasks - - +from discord.ext.commands import has_permissions, MissingPermissions +from dotenv import load_dotenv +import aiohttp +import asyncio class Linking_updater(commands.Cog): def __init__(self, bot): self.bot = bot + self.guild_id = int(os.getenv('guild_id')) + self.crabwings_role_id = int(os.getenv('crabwings_role_id')) + self.duckfeet_role_id = int(os.getenv('duckfeet_role_id')) + self.elktail_role_id = int(os.getenv('elktail_role_id')) + self.client_role_id = int(os.getenv('client_role_id')) + self.subuser_role_id = int(os.getenv('subuser_role_id')) + self.verified_role_id = int(os.getenv('verified_role_id')) + linking_updater.start() @tasks.loop(seconds=10) async def linking_updater(self): - print("Hello2") - + logging.info("Synchronizing roles") + file = open('users.json', 'r') + data = json.load(file) + file.close() + guild = self.bot.get_guild(guild_id) + i = -1 + print("1") + for client in data['users']: + print("2") + i += 1 + member = guild.get_member(client['discord_id']) + if member: + print("3") + api_key = client['client_api_key'] + url = "https://panel.birdflop.com/api/client" + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer ' + api_key, + } + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + print("4") + if response.status == 200: + print("5") + # Formats response for servers in JSON format + servers_json_response = await response.json() + + user_client = False + user_subuser = False + user_crabwings = False + user_duckfeet = False + user_elktail = False + for server in servers_json_response['data']: + server_owner = server['attributes']['server_owner'] + if server_owner == True: + user_client = True + elif server_owner == False: + user_subuser = True + server_node = server['attributes']['node'] + if server_node == "Crabwings - NYC": + user_crabwings = True + elif server_node == "Duckfeet - EU": + user_duckfeet = True + elif server_node == "Elktail - EU": + user_elktail = True + role = discord.utils.get(guild.roles, id=self.client_role_id) + if user_client == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.subuser_role_id) + if user_subuser == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.crabwings_role_id) + if user_crabwings == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.duckfeet_role_id) + if user_duckfeet == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=self.elktail_role_id) + if user_elktail == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + else: + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + await member.edit(roles=[]) + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) + else: + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and client_api_key " + client['client_api_key']) + @linking_updater.before_loop async def before_linking_updater(self): - print("Hello") + logging.info('waiting to enter loop') await self.bot.wait_until_ready() def setup(bot): bot.add_cog(Linking_updater(bot)) - -linking_updater.start() From c578d62ff2d37d791192947b31ce096cb04ab06e Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:18:58 -0600 Subject: [PATCH 53/63] Update linking_updater.py --- cogs/linking_updater.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 85fdd10..42a90b7 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -20,7 +20,6 @@ class Linking_updater(commands.Cog): self.client_role_id = int(os.getenv('client_role_id')) self.subuser_role_id = int(os.getenv('subuser_role_id')) self.verified_role_id = int(os.getenv('verified_role_id')) - linking_updater.start() @tasks.loop(seconds=10) async def linking_updater(self): From 30f5d04effcef78b9560844af588219851df9b5d Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:23:06 -0600 Subject: [PATCH 54/63] Update bot.py --- bot.py | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index e3036cd..f9883dd 100644 --- a/bot.py +++ b/bot.py @@ -76,7 +76,6 @@ async def on_message(message): await timings.analyze_timings(message) await bot.process_commands(message) - @bot.event async def on_raw_reaction_add(payload): global verification_message @@ -134,6 +133,89 @@ async def react(ctx, url, reaction): @tasks.loop(minutes=10) async def updater(): + logging.info("Synchronizing roles") + file = open('users.json', 'r') + data = json.load(file) + file.close() + guild = bot.get_guild(guild_id) + i = -1 + for client in data['users']: + i += 1 + member = guild.get_member(client['discord_id']) + if member: + api_key = client['client_api_key'] + url = "https://panel.birdflop.com/api/client" + headers = { + 'Accept': 'application/json', + 'Authorization': 'Bearer ' + api_key, + } + async with aiohttp.ClientSession() as session: + async with session.get(url, headers=headers) as response: + if response.status == 200: + # Formats response for servers in JSON format + servers_json_response = await response.json() + + user_client = False + user_subuser = False + user_crabwings = False + user_duckfeet = False + user_elktail = False + for server in servers_json_response['data']: + server_owner = server['attributes']['server_owner'] + if server_owner == True: + user_client = True + elif server_owner == False: + user_subuser = True + server_node = server['attributes']['node'] + if server_node == "Crabwings - NYC": + user_crabwings = True + elif server_node == "Duckfeet - EU": + user_duckfeet = True + elif server_node == "Elktail - EU": + user_elktail = True + role = discord.utils.get(guild.roles, id=client_role_id) + if user_client == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=subuser_role_id) + if user_subuser == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=crabwings_role_id) + if user_crabwings == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=duckfeet_role_id) + if user_duckfeet == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + role = discord.utils.get(guild.roles, id=elktail_role_id) + if user_elktail == True: + await member.add_roles(role) + else: + await member.remove_roles(role) + else: + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + await member.edit(roles=[]) + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) + else: + data['users'].pop(i) + json_dumps = json.dumps(data, indent=2) + file = open('users.json', 'w') + file.write(json_dumps) + file.close() + logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( + client['client_id']) + " and client_api_key " + client['client_api_key']) + # Update backups logging.info('Ensuring backups') url = "https://panel.birdflop.com/api/application/servers" @@ -264,6 +346,8 @@ for file_name in os.listdir('./cogs'): bot.load_extension(f'cogs.{file_name[:-3]}') updater.start() +linking_updater = bot.get_cog('Linking_updater') +await linking_updater.linking_updater.start() bot.run(token) # full name: message.author.name + "#" + str(message.author.discriminator) + " (" + str(message.author.id) + ")" From 8809e120d671fe30991869cecee2d0e7c09b9300 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:23:44 -0600 Subject: [PATCH 55/63] Update bot.py --- bot.py | 85 +--------------------------------------------------------- 1 file changed, 1 insertion(+), 84 deletions(-) diff --git a/bot.py b/bot.py index f9883dd..95272c4 100644 --- a/bot.py +++ b/bot.py @@ -133,89 +133,6 @@ async def react(ctx, url, reaction): @tasks.loop(minutes=10) async def updater(): - logging.info("Synchronizing roles") - file = open('users.json', 'r') - data = json.load(file) - file.close() - guild = bot.get_guild(guild_id) - i = -1 - for client in data['users']: - i += 1 - member = guild.get_member(client['discord_id']) - if member: - api_key = client['client_api_key'] - url = "https://panel.birdflop.com/api/client" - headers = { - 'Accept': 'application/json', - 'Authorization': 'Bearer ' + api_key, - } - async with aiohttp.ClientSession() as session: - async with session.get(url, headers=headers) as response: - if response.status == 200: - # Formats response for servers in JSON format - servers_json_response = await response.json() - - user_client = False - user_subuser = False - user_crabwings = False - user_duckfeet = False - user_elktail = False - for server in servers_json_response['data']: - server_owner = server['attributes']['server_owner'] - if server_owner == True: - user_client = True - elif server_owner == False: - user_subuser = True - server_node = server['attributes']['node'] - if server_node == "Crabwings - NYC": - user_crabwings = True - elif server_node == "Duckfeet - EU": - user_duckfeet = True - elif server_node == "Elktail - EU": - user_elktail = True - role = discord.utils.get(guild.roles, id=client_role_id) - if user_client == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=subuser_role_id) - if user_subuser == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=crabwings_role_id) - if user_crabwings == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=duckfeet_role_id) - if user_duckfeet == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - role = discord.utils.get(guild.roles, id=elktail_role_id) - if user_elktail == True: - await member.add_roles(role) - else: - await member.remove_roles(role) - else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - await member.edit(roles=[]) - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and INVALID client_api_key " + client['client_api_key']) - else: - data['users'].pop(i) - json_dumps = json.dumps(data, indent=2) - file = open('users.json', 'w') - file.write(json_dumps) - file.close() - logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str( - client['client_id']) + " and client_api_key " + client['client_api_key']) - # Update backups logging.info('Ensuring backups') url = "https://panel.birdflop.com/api/application/servers" @@ -347,7 +264,7 @@ for file_name in os.listdir('./cogs'): updater.start() linking_updater = bot.get_cog('Linking_updater') -await linking_updater.linking_updater.start() +linking_updater.linking_updater.start() bot.run(token) # full name: message.author.name + "#" + str(message.author.discriminator) + " (" + str(message.author.id) + ")" From da86340e85a125fc267f954399ec61ecc542faaa Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:23:58 -0600 Subject: [PATCH 56/63] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 95272c4..3d56b3b 100644 --- a/bot.py +++ b/bot.py @@ -264,7 +264,7 @@ for file_name in os.listdir('./cogs'): updater.start() linking_updater = bot.get_cog('Linking_updater') -linking_updater.linking_updater.start() +linking_updater.linking_updater.linking_updater.start() bot.run(token) # full name: message.author.name + "#" + str(message.author.discriminator) + " (" + str(message.author.id) + ")" From 530ed3eaddae89dceb5828a2b780170394641754 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:24:40 -0600 Subject: [PATCH 57/63] Update bot.py --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 3d56b3b..95272c4 100644 --- a/bot.py +++ b/bot.py @@ -264,7 +264,7 @@ for file_name in os.listdir('./cogs'): updater.start() linking_updater = bot.get_cog('Linking_updater') -linking_updater.linking_updater.linking_updater.start() +linking_updater.linking_updater.start() bot.run(token) # full name: message.author.name + "#" + str(message.author.discriminator) + " (" + str(message.author.id) + ")" From c85d754438361a3c3eeee2d7a1f7a7bdc9115d49 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:25:48 -0600 Subject: [PATCH 58/63] Update linking_updater.py --- cogs/linking_updater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 42a90b7..47d7e3c 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -27,7 +27,7 @@ class Linking_updater(commands.Cog): file = open('users.json', 'r') data = json.load(file) file.close() - guild = self.bot.get_guild(guild_id) + guild = bot.get_guild(self.guild_id) i = -1 print("1") for client in data['users']: From 88357cbf821dba686c2408a10344d17136165347 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:28:01 -0600 Subject: [PATCH 59/63] Update linking_updater.py --- cogs/linking_updater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 47d7e3c..99045e2 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -27,7 +27,7 @@ class Linking_updater(commands.Cog): file = open('users.json', 'r') data = json.load(file) file.close() - guild = bot.get_guild(self.guild_id) + guild = self.bot.get_guild(self.guild_id) i = -1 print("1") for client in data['users']: From d31dde61e388d8d7c398425e35b45938ea71e688 Mon Sep 17 00:00:00 2001 From: Purpur <43528123+Pemigrade@users.noreply.github.com> Date: Sun, 10 Jan 2021 06:29:08 -0600 Subject: [PATCH 60/63] remove debugging --- cogs/linking_updater.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cogs/linking_updater.py b/cogs/linking_updater.py index 99045e2..9f61b86 100644 --- a/cogs/linking_updater.py +++ b/cogs/linking_updater.py @@ -21,7 +21,7 @@ class Linking_updater(commands.Cog): self.subuser_role_id = int(os.getenv('subuser_role_id')) self.verified_role_id = int(os.getenv('verified_role_id')) - @tasks.loop(seconds=10) + @tasks.loop(minutes=10) async def linking_updater(self): logging.info("Synchronizing roles") file = open('users.json', 'r') @@ -29,13 +29,10 @@ class Linking_updater(commands.Cog): file.close() guild = self.bot.get_guild(self.guild_id) i = -1 - print("1") for client in data['users']: - print("2") i += 1 member = guild.get_member(client['discord_id']) if member: - print("3") api_key = client['client_api_key'] url = "https://panel.birdflop.com/api/client" headers = { @@ -44,9 +41,7 @@ class Linking_updater(commands.Cog): } async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as response: - print("4") if response.status == 200: - print("5") # Formats response for servers in JSON format servers_json_response = await response.json() From c2fcd4c30587b50db878ec2a5c47412cfd492b64 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Mon, 11 Jan 2021 00:56:43 -0600 Subject: [PATCH 61/63] Update timings.py --- cogs/timings.py | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index 4f0c426..e88de22 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -2,7 +2,6 @@ import discord from discord.ext import commands import requests - class Timings(commands.Cog): def __init__(self, bot): @@ -24,7 +23,7 @@ class Timings(commands.Cog): embed_var.add_field(name="❌ Spigot", value="Upgrade to [Purpur](https://ci.pl3x.net/job/Purpur/).", inline=True) - await message.channel.send(embed=embed_var) + await message.reply(embed=embed_var) return if timings_url == "": return @@ -41,7 +40,7 @@ class Timings(commands.Cog): embed_var.add_field(name="❌ Invalid report", value="Create a new timings report.", inline=True) - await message.channel.send(embed=embed_var) + await message.reply(embed=embed_var) return embed_var = discord.Embed(title="Timings Analysis", color=0x55ffff) @@ -175,7 +174,7 @@ class Timings(commands.Cog): if "LagAssist" in plugins: embed_var.add_field(name="❌ LagAssist", value="Plugins that claim to remove lag actually cause more lag. " - "Remove LagAssist.", + "LagAssist should only be used for analytics and preventative measures. All other features should be disabled.", inline=True) if "NoChunkLag" in plugins: embed_var.add_field(name="❌ NoChunkLag", @@ -292,11 +291,29 @@ class Timings(commands.Cog): value="bPermissions is an outdated permission plugin. " "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", inline=True) + if "DisableJoinMessage" in plugins and "Essentials" in plugins: + embed_var.add_field(name="❌ DisableJoinMessage", + value="You probably don't need DisableJoinMessage because Essentials already has its features. ", + inline=True) for plugin in plugins: - if "Songoda" in r["timingsMaster"]["plugins"][plugin]["authors"]: - embed_var.add_field(name="❌ " + plugin, - value="This plugin was made by Songoda. You should find an alternative.", - inline=True) + if "songoda" in r["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/).", + inline=True) + 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/).", + inline=True) + elif plugin == "UltimateStacker": + embed_var.add_field(name="❌ UltimateStacker", + value="Stacking plugins actually cause more lag. " + "Remove UltimateStacker.", + inline=True) + 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.", + inline=True) except KeyError: unchecked = unchecked + 1 @@ -1050,23 +1067,21 @@ class Timings(commands.Cog): embed_var.add_field(name="❌ Invalid Configuration", value="At least one of your configuration files had an invalid data type.", inline=True) - await message.channel.send(embed=embed_var) + await message.reply(embed=embed_var) return if len(embed_var.fields) == 0: embed_var.add_field(name="✅ All good", value="Analyzed with no issues") - await message.channel.send(embed=embed_var) + await message.reply(embed=embed_var) return issue_count = len(embed_var.fields) - if issue_count > 25: - embed_var.description = "Showing 25 of " + str(issue_count) + " recommendations." - else: - embed_var.description = "Showing " + str(issue_count) + " of " + str(issue_count) + " recommendations." - if issue_count > 0: - embed_var.description = embed_var.description + "\n||" + str(unchecked) + " missing configuration optimizations due to server version.||" - await message.channel.send(embed=embed_var) + if issue_count >= 25: + embed_var.insert_field_at(index=24, name="Plus " + str(issue_count - 24) + " more recommendations", value="Create a new timings report after resolving some of the above issues to see more,", inline=True) + if unchecked > 0: + embed_var.description = "||" + str(unchecked) + " missing configuration optimizations due to your server version.||" + await message.reply(embed=embed_var) def setup(bot): From e0eeefbdafe5766d218f78d42d2a98a7c694fa56 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Mon, 11 Jan 2021 15:53:34 -0600 Subject: [PATCH 62/63] Update timings.py --- cogs/timings.py | 450 ++++++++++++++++++------------------------------ 1 file changed, 168 insertions(+), 282 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index e88de22..c9c1177 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -21,8 +21,9 @@ class Timings(commands.Cog): "https://timings.spigotmc.org/?url="): embed_var = discord.Embed(title="Timings Analysis", color=0x55ffff) embed_var.add_field(name="❌ Spigot", - value="Upgrade to [Purpur](https://ci.pl3x.net/job/Purpur/).", - inline=True) + value="Upgrade to [Purpur](https://ci.pl3x.net/job/Purpur/).") + embed_var.set_footer(text="Requested by " + message.author.name, icon_url=message.author.avatar_url) + embed_var.url = timings_url await message.reply(embed=embed_var) return if timings_url == "": @@ -38,8 +39,9 @@ class Timings(commands.Cog): if r is None: embed_var = discord.Embed(title="Timings Analysis", color=0x55ffff) embed_var.add_field(name="❌ Invalid report", - value="Create a new timings report.", - inline=True) + value="Create a new timings report.") + embed_var.set_footer(text="Requested by " + message.author.name, icon_url=message.author.avatar_url) + embed_var.url = timings_url await message.reply(embed=embed_var) return @@ -52,19 +54,16 @@ class Timings(commands.Cog): version = r["timingsMaster"]["version"] if "1.16.4" not in version: embed_var.add_field(name="❌ Legacy Build", - value="Update to 1.16.4.", - inline=True) + value="Update to 1.16.4.") using_yatopia = "yatopia" in r["timingsMaster"]["config"] if using_yatopia: embed_var.add_field(name="❌ Yatopia", value="Yatopia is prone to bugs. " - "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).", - inline=True) + "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).") elif "Paper" in version: embed_var.add_field(name="||❌ Paper||", value="||Purpur has more optimizations but is generally less supported. " - "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).||", - inline=True) + "Consider using [Purpur](https://ci.pl3x.net/job/Purpur/).||") except KeyError: unchecked = unchecked + 1 @@ -76,17 +75,15 @@ class Timings(commands.Cog): if not online_mode and bungeecord == "false" and (velocity_online_mode == "false" or velocity_enabled == "false"): embed_var.add_field(name="❌ online-mode", - value="Enable this in server.properties for security.", - inline=True) + value="Enable this in server.properties for security.") except KeyError: unchecked = unchecked + 1 try: timing_cost = int(r["timingsMaster"]["system"]["timingcost"]) - if timing_cost > 400: + if timing_cost > 300: embed_var.add_field(name="❌ Timingcost", - value="Your timingcost is " + str(timing_cost) + ". Find a [better host](https://www.birdflop.com).", - inline=True) + value="Your timingcost is " + str(timing_cost) + ". Find a [better host](https://www.birdflop.com).") except KeyError: unchecked = unchecked + 1 @@ -94,8 +91,7 @@ class Timings(commands.Cog): jvm_version = r["timingsMaster"]["system"]["jvmversion"] if jvm_version.startswith("1.8.") or jvm_version.startswith("9.") or jvm_version.startswith("10."): embed_var.add_field(name="❌ Java Version", - value="Use Java 11.", - inline=True) + value="You are using Java " + jvm_version + ". Update to [Java 11](https://adoptopenjdk.net/installation.html).") except KeyError: unchecked = unchecked + 1 @@ -106,17 +102,14 @@ class Timings(commands.Cog): java_version = jvm_version.split(".")[0] if int(java_version) < 14: embed_var.add_field(name="❌ Java " + java_version, - value="If you are going to use ZGC, you should also use Java 14 or 15.", - inline=True) + value="If you are going to use ZGC, you should also use Java 14+.") elif "-Daikars.new.flags=true" in flags: if "-XX:+PerfDisableSharedMem" not in flags: embed_var.add_field(name="❌ Outdated Flags", - value="Add `-XX:+PerfDisableSharedMem` to flags", - inline=True) + value="Add `-XX:+PerfDisableSharedMem` to flags") if "XX:G1MixedGCCountTarget=4" not in flags: embed_var.add_field(name="❌ Outdated Flags", - value="Add `-XX:G1MixedGCCountTarget=4` to flags", - inline=True) + value="Add `-XX:G1MixedGCCountTarget=4` to flags") if "-Xmx" in flags: max_mem = 0 flaglist = flags.split(" ") @@ -129,8 +122,7 @@ class Timings(commands.Cog): max_mem = max_mem.replace("m", "") if int(max_mem) < 5400: embed_var.add_field(name="❌ Low Memory", - value="Allocate at least 6-10GB of ram to your server if you can afford it.", - inline=True) + value="Allocate at least 6-10GB of ram to your server if you can afford it.") if "-Xms" in flags: min_mem = 0 flaglist = flags.split(" ") @@ -143,24 +135,23 @@ class Timings(commands.Cog): min_mem = min_mem.replace("m", "") if min_mem != max_mem: embed_var.add_field(name="❌ Aikar's Flags", - value="Your Xmx and Xms values must be equal with Aikar's flags.", - inline=True) + value="Your Xmx and Xms values should be equivalent when using Aikar's flags.") elif "-Dusing.aikars.flags=mcflags.emc.gs" in flags: embed_var.add_field(name="❌ Outdated Flags", - value="Update [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", - inline=True) + value="Update [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).") else: embed_var.add_field(name="❌ Aikar's Flags", - value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).", - inline=True) + value="Use [Aikar's flags](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).") except KeyError: unchecked = unchecked + 1 try: cpu = int(r["timingsMaster"]["system"]["cpu"]) - if cpu <= 2: + if cpu == 1: embed_var.add_field(name="❌ Threads", - value="You have only " + str(cpu) + " thread(s). Find a [better host](https://www.birdflop.com).", - inline=True) + value="You have only " + str(cpu) + " thread. Find a [better host](https://www.birdflop.com).") + if cpu == 2: + embed_var.add_field(name="❌ Threads", + value="You have only " + str(cpu) + " threads. Find a [better host](https://www.birdflop.com).") except KeyError: unchecked = unchecked + 1 @@ -169,151 +160,118 @@ class Timings(commands.Cog): if "ClearLag" in plugins: embed_var.add_field(name="❌ ClearLag", value="Plugins that claim to remove lag actually cause more lag. " - "Remove ClearLag.", - inline=True) + "Remove ClearLag.") if "LagAssist" in plugins: embed_var.add_field(name="❌ LagAssist", - value="Plugins that claim to remove lag actually cause more lag. " - "LagAssist should only be used for analytics and preventative measures. All other features should be disabled.", - inline=True) + value="LagAssist should only be used for analytics and preventative measures." + "All other features of the plugin should be disabled.") if "NoChunkLag" in plugins: embed_var.add_field(name="❌ NoChunkLag", value="Plugins that claim to remove lag actually cause more lag. " - "Remove NoChunkLag.", - inline=True) + "Remove NoChunkLag.") if "ServerBooster" in plugins: embed_var.add_field(name="❌ ServerBooster", value="Plugins that claim to remove lag actually cause more lag. " - "Remove ServerBooster.", - inline=True) + "Remove ServerBooster.") if "MobLimiter" in plugins: embed_var.add_field(name="❌ MobLimiter", value="You probably don't need MobLimiter as Bukkit already has its features. " - "Remove MobLimiter.", - inline=True) + "Remove MobLimiter.") if "BookLimiter" in plugins: embed_var.add_field(name="❌ BookLimiter", value="You probably don't need BookLimiter as Paper already has its features. " - "Remove BookLimiter.", - inline=True) + "Remove BookLimiter.") if "LimitPillagers" in plugins: embed_var.add_field(name="❌ LimitPillagers", value="You probably don't need LimitPillagers as Paper already adds its features. " - "Remove LimitPillagers.", - inline=True) + "Remove LimitPillagers.") if "VillagerOptimiser" in plugins: embed_var.add_field(name="❌ VillagerOptimiser", value="You probably don't need VillagerOptimiser as Paper already adds its features. " - "See entity-activation-range in spigot.yml.", - inline=True) + "See entity-activation-range in spigot.yml.") if "StackMob" in plugins: embed_var.add_field(name="❌ StackMob", value="Stacking plugins actually cause more lag. " - "Remove StackMob.", - inline=True) + "Remove StackMob.") if "Stacker" in plugins: embed_var.add_field(name="❌ Stacker", value="Stacking plugins actually cause more lag. " - "Remove Stacker.", - inline=True) + "Remove Stacker.") if "MobStacker" in plugins: embed_var.add_field(name="❌ MobStacker", value="Stacking plugins actually cause more lag. " - "Remove MobStacker.", - inline=True) + "Remove MobStacker.") if "WildStacker" in plugins: embed_var.add_field(name="❌ WildStacker", value="Stacking plugins actually cause more lag. " - "Remove WildStacker.", - inline=True) + "Remove WildStacker.") if "SuggestionBlocker" in plugins: embed_var.add_field(name="❌ SuggestionBlocker", value="You probably don't need SuggestionBlocker as Spigot already adds its features. " - "Set tab-complete to -1 in spigot.yml.", - inline=True) + "Set tab-complete to -1 in spigot.yml.") if "FastAsyncWorldEdit" in plugins: embed_var.add_field(name="❌ FastAsyncWorldEdit", value="FAWE can corrupt your world. " - "Consider replacing FAWE with [Worldedit](https://enginehub.org/worldedit/#downloads).", - inline=True) + "Consider replacing FAWE with [Worldedit](https://enginehub.org/worldedit/#downloads).") if "CMI" in plugins: embed_var.add_field(name="❌ CMI", value="CMI is a buggy plugin. " - "Consider replacing CMI with [EssentialsX](https://essentialsx.net/downloads.html).", - inline=True) + "Consider replacing CMI with [EssentialsX](https://essentialsx.net/downloads.html).") if "Spartan" in plugins: embed_var.add_field(name="❌ Spartan", value="Spartan is a laggy anticheat. " - "Consider replacing it with [Matrix](https://matrix.rip/), [NCP](https://ci.codemc.io/job/Updated-NoCheatPlus/job/Updated-NoCheatPlus/), or [AAC](https://www.spigotmc.org/resources/aac-advanced-anti-cheat-hack-kill-aura-blocker.6442/).", - inline=True) + "Consider replacing it with [Matrix](https://matrix.rip/), [NCP](https://ci.codemc.io/job/Updated-NoCheatPlus/job/Updated-NoCheatPlus/), or [AAC](https://www.spigotmc.org/resources/aac-advanced-anti-cheat-hack-kill-aura-blocker.6442/).") if "IllegalStack" in plugins: embed_var.add_field(name="❌ IllegalStack", value="You probably don't need IllegalStack as Paper already has its features. " - "Remove IllegalStack.", - inline=True) + "Remove IllegalStack.") if "ExploitFixer" in plugins: embed_var.add_field(name="❌ ExploitFixer", value="You probably don't need ExploitFixer as Paper already has its features. " - "Remove ExploitFixer.", - inline=True) + "Remove ExploitFixer.") if "EntityTrackerFixer" in plugins: embed_var.add_field(name="❌ EntityTrackerFixer", value="You probably don't need EntityTrackerFixer as Paper already has its features. " - "Remove EntityTrackerFixer.", - inline=True) + "Remove EntityTrackerFixer.") if "Orebfuscator" in plugins: embed_var.add_field(name="❌ Orebfuscator", value="You probably don't need Orebfuscator as Paper already has its features. " - "Remove Orebfuscator.", - inline=True) + "Remove Orebfuscator.") if "ImageOnMap" in plugins: embed_var.add_field(name="❌ ImageOnMap", value="This plugin has a [memory leak](https://github.com/zDevelopers/ImageOnMap/issues/104). If it is not essential, you should remove it. " - "Consider replacing it with [an alternative](https://www.spigotmc.org/resources/drmap.87368/).", - inline=True) + "Consider replacing it with [an alternative](https://www.spigotmc.org/resources/drmap.87368/).") if "CrazyActions" in plugins: embed_var.add_field(name="❌ CrazyAuctions", value="CrazyAuctions is a laggy plugin, even according to the developer. " - "Consider replacing it with [AuctionHouse](https://www.spigotmc.org/resources/auctionhouse.61836/).", - inline=True) + "Consider replacing it with [AuctionHouse](https://www.spigotmc.org/resources/auctionhouse.61836/).") if "GroupManager" in plugins: embed_var.add_field(name="❌ GroupManager", value="GroupManager is an outdated permission plugin. " - "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", - inline=True) + "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).") if "PermissionsEx" in plugins: embed_var.add_field(name="❌ PermissionsEx", value="PermissionsEx is an outdated permission plugin. " - "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", - inline=True) + "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).") if "bPermissions" in plugins: embed_var.add_field(name="❌ bPermissions", value="bPermissions is an outdated permission plugin. " - "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).", - inline=True) + "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).") if "DisableJoinMessage" in plugins and "Essentials" in plugins: embed_var.add_field(name="❌ DisableJoinMessage", - value="You probably don't need DisableJoinMessage because Essentials already has its features. ", - inline=True) + value="You probably don't need DisableJoinMessage because Essentials already has its features. ") for plugin in plugins: if "songoda" in r["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/).", - inline=True) - 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/).", - inline=True) + 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 cause more lag. " - "Remove UltimateStacker.", - inline=True) + "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.", - inline=True) + value="This plugin was made by Songoda. Songoda resources are poorly developed and often cause problems. You should find an alternative.") except KeyError: unchecked = unchecked + 1 @@ -324,18 +282,15 @@ class Timings(commands.Cog): if "SilkSpawners" in plugins: embed_var.add_field(name="❌ SilkSpawners", value="You probably don't need SilkSpawners as Purpur already has its features. " - "Remove SilkSpawners.", - inline=True) + "Remove SilkSpawners.") if "MineableSpawners" in plugins: embed_var.add_field(name="❌ MineableSpawners", value="You probably don't need MineableSpawners as Purpur already has its features. " - "Remove MineableSpawners.", - inline=True) + "Remove MineableSpawners.") if "VillagerLobotomizatornator" in plugins: embed_var.add_field(name="❌ LimitPillagers", value="You probably don't need VillagerLobotomizatornator as Purpur already adds its features. " - "Enable villager.lobotomize.enabled in purpur.yml.", - inline=True) + "Enable villager.lobotomize.enabled in purpur.yml.") except KeyError: unchecked = unchecked + 1 @@ -347,13 +302,11 @@ class Timings(commands.Cog): if phantoms_only_insomniacs == "false": embed_var.add_field(name="❌ PhantomSMP", value="You probably don't need PhantomSMP as Paper already has its features. " - "Remove PhantomSMP.", - inline=True) + "Remove PhantomSMP.") else: embed_var.add_field(name="❌ PhantomSMP", value="You probably don't need PhantomSMP as Paper already has its features. " - "Enable phantoms-only-attack-insomniacs in paper.yml.", - inline=True) + "Enable phantoms-only-attack-insomniacs in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -361,34 +314,30 @@ class Timings(commands.Cog): network_compression_threshold = int( r["timingsMaster"]["config"]["server.properties"]["network-compression-threshold"]) bungeecord = r["timingsMaster"]["config"]["spigot"]["settings"]["bungeecord"] - if network_compression_threshold == 256 and bungeecord == "false": + if network_compression_threshold <= 256 and bungeecord == "false": embed_var.add_field(name="❌ network-compression-threshold", - value="Increase this in server.properties. Recommended: 512.", - inline=True) + value="Increase this in server.properties. Recommended: 512.") if network_compression_threshold != -1 and bungeecord == "true": embed_var.add_field(name="❌ network-compression-threshold", - value="Set this to -1 in server.properties for a bungee server like yours.", - inline=True) + value="Set this to -1 in server.properties for a bungee server like yours.") except KeyError: unchecked = unchecked + 1 try: spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["view-distance"] view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) - if view_distance == 10 and spigot_view_distance == "default": + if view_distance >= 10 and spigot_view_distance == "default": embed_var.add_field(name="❌ view-distance", value="Decrease this from default (10) in spigot.yml. " - "Recommended: 3.", - inline=True) + "Recommended: 3.") except KeyError: unchecked = unchecked + 1 try: chunk_gc_period = int(r["timingsMaster"]["config"]["bukkit"]["chunk-gc"]["period-in-ticks"]) - if chunk_gc_period == 600: + if chunk_gc_period >= 600: embed_var.add_field(name="❌ chunk-gc.period-in-ticks", - value="Decrease this in bukkit.yml.\nRecommended: 400.", - inline=True) + value="Decrease this in bukkit.yml.\nRecommended: 400.") except KeyError: unchecked = unchecked + 1 @@ -396,53 +345,47 @@ class Timings(commands.Cog): ticks_per_monster_spawns = int(r["timingsMaster"]["config"]["bukkit"]["ticks-per"]["monster-spawns"]) if ticks_per_monster_spawns == 1: embed_var.add_field(name="❌ ticks-per.monster-spawns", - value="Increase this in bukkit.yml.\nRecommended: 4.", - inline=True) + value="Increase this in bukkit.yml.\nRecommended: 4.") except KeyError: unchecked = unchecked + 1 try: monsters_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["monsters"]) - if monsters_spawn_limit == 70: + if monsters_spawn_limit >= 70: embed_var.add_field(name="❌ spawn-limits.monsters", - value="Decrease this in bukkit.yml.\nRecommended: 15.", - inline=True) + value="Decrease this in bukkit.yml.\nRecommended: 15.") except KeyError: unchecked = unchecked + 1 try: water_ambient_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["water-ambient"]) - if water_ambient_spawn_limit == 20: + if water_ambient_spawn_limit >= 20: embed_var.add_field(name="❌ spawn-limits.water-ambient", - value="Decrease this in bukkit.yml.\nRecommended: 2.", - inline=True) + value="Decrease this in bukkit.yml.\nRecommended: 2.") except KeyError: unchecked = unchecked + 1 try: ambient_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["ambient"]) - if ambient_spawn_limit == 15: + if ambient_spawn_limit >= 15: embed_var.add_field(name="❌ spawn-limits.ambient", - value="Decrease this in bukkit.yml.\nRecommended: 1.", - inline=True) + value="Decrease this in bukkit.yml.\nRecommended: 1.") except KeyError: unchecked = unchecked + 1 try: animals_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["animals"]) - if animals_spawn_limit == 10: + if animals_spawn_limit >= 10: embed_var.add_field(name="❌ spawn-limits.animals", - value="Decrease this in bukkit.yml.\nRecommended: 3.", - inline=True) + value="Decrease this in bukkit.yml.\nRecommended: 3.") except KeyError: unchecked = unchecked + 1 try: water_animals_spawn_limit = int(r["timingsMaster"]["config"]["bukkit"]["spawn-limits"]["water-animals"]) - if water_animals_spawn_limit == 15: + if water_animals_spawn_limit >= 15: embed_var.add_field(name="❌ spawn-limits.water-animals", - value="Decrease this in bukkit.yml.\nRecommended: 2.", - inline=True) + value="Decrease this in bukkit.yml.\nRecommended: 2.") except KeyError: unchecked = unchecked + 1 @@ -451,16 +394,14 @@ class Timings(commands.Cog): spigot_view_distance = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["view-distance"] if spigot_view_distance == "default": view_distance = int(r["timingsMaster"]["config"]["server.properties"]["view-distance"]) - if mob_spawn_range == 8 and view_distance <= 6: + if mob_spawn_range >= 8 and view_distance <= 6: embed_var.add_field(name="❌ mob-spawn-range", value="Decrease this in spigot.yml. " - "Recommended: " + str(view_distance - 1) + ".", - inline=True) - elif mob_spawn_range == 8 and int(spigot_view_distance) <= 6: + "Recommended: " + str(view_distance - 1) + ".") + elif mob_spawn_range >= 8 and int(spigot_view_distance) <= 6: embed_var.add_field(name="❌ mob-spawn-range", value="Decrease this in spigot.yml. " - "Recommended: " + str(int(spigot_view_distance) - 1) + ".", - inline=True) + "Recommended: " + str(int(spigot_view_distance) - 1) + ".") except KeyError: unchecked = unchecked + 1 @@ -468,11 +409,10 @@ class Timings(commands.Cog): animals_entity_activation_range = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "animals"]) - if animals_entity_activation_range == 32: + if animals_entity_activation_range >= 32: embed_var.add_field(name="❌ entity-activation-range.animals", value="Decrease this in spigot.yml. " - "Recommended: 6.", - inline=True) + "Recommended: 6.") except KeyError: unchecked = unchecked + 1 @@ -480,11 +420,10 @@ class Timings(commands.Cog): monsters_entity_activation_range = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "monsters"]) - if monsters_entity_activation_range == 32: + if monsters_entity_activation_range >= 32: embed_var.add_field(name="❌ entity-activation-range.monsters", value="Decrease this in spigot.yml. " - "Recommended: 16.", - inline=True) + "Recommended: 16.") except KeyError: unchecked = unchecked + 1 @@ -498,22 +437,20 @@ class Timings(commands.Cog): try: misc_entity_activation_range = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"]["misc"]) - if misc_entity_activation_range == 16: + if misc_entity_activation_range >= 16: embed_var.add_field(name="❌ entity-activation-range.misc", value="Decrease this in spigot.yml. " - "Recommended: 4.", - inline=True) + "Recommended: 4.") except KeyError: unchecked = unchecked + 1 try: water_entity_activation_range = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"]["water"]) - if water_entity_activation_range == 16: + if water_entity_activation_range >= 16: embed_var.add_field(name="❌ entity-activation-range.water", value="Decrease this in spigot.yml. " - "Recommended: 12.", - inline=True) + "Recommended: 12.") except KeyError: unchecked = unchecked + 1 @@ -521,11 +458,10 @@ class Timings(commands.Cog): villagers_entity_activation_range = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ "villagers"]) - if villagers_entity_activation_range == 32: + if villagers_entity_activation_range >= 32: embed_var.add_field(name="❌ entity-activation-range.villagers", value="Decrease this in spigot.yml. " - "Recommended: 16.", - inline=True) + "Recommended: 16.") except KeyError: unchecked = unchecked + 1 @@ -542,8 +478,7 @@ class Timings(commands.Cog): "tick-inactive-villagers"] if tick_inactive_villagers == "true": embed_var.add_field(name="❌ tick-inactive-villagers", - value="Disable this in spigot.yml.", - inline=True) + value="Disable this in spigot.yml.") except KeyError: unchecked = unchecked + 1 @@ -551,8 +486,7 @@ class Timings(commands.Cog): nerf_spawner_mobs = r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["nerf-spawner-mobs"] if nerf_spawner_mobs == "false": embed_var.add_field(name="❌ nerf-spawner-mobs", - value="Enable this in spigot.yml.", - inline=True) + value="Enable this in spigot.yml.") except KeyError: unchecked = unchecked + 1 @@ -565,31 +499,29 @@ class Timings(commands.Cog): try: wake_up_inactive_villagers_for = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_villagers_for == 100: + "wake-up-inactive"]["villagers-for"]) + if wake_up_inactive_villagers_for >= 100: embed_var.add_field(name="❌ wake-up-inactive.villagers-for", value="Decrease this in spigot.yml. " - "Recommended: 20.", - inline=True) + "Recommended: 20.") except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_flying_monsters_for = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_flying_monsters_for == 100: + "wake-up-inactive"]["flying-monsters-for"]) + if wake_up_inactive_flying_monsters_for >= 100: embed_var.add_field(name="❌ wake-up-inactive.flying-monsters-for", value="Decrease this in spigot.yml. " - "Recommended: 60.", - inline=True) + "Recommended: 60.") except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_animals_every = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) + "wake-up-inactive"]["animals-every"]) except KeyError: unchecked = unchecked + 1 @@ -597,141 +529,130 @@ class Timings(commands.Cog): try: wake_up_inactive_villagers_max_per_tick = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_villagers_max_per_tick == 4: + "wake-up-inactive"]["villagers-max-per-tick"]) + if wake_up_inactive_villagers_max_per_tick >= 4: embed_var.add_field(name="❌ wake-up-inactive.villagers-max-per-tick", value="Decrease this in spigot.yml. " - "Recommended: 1.", - inline=True) + "Recommended: 1.") except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_animals_for = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_animals_for == 100: + "wake-up-inactive"]["animals-for"]) + if wake_up_inactive_animals_for >= 100: embed_var.add_field(name="❌ wake-up-inactive.animals-for", value="Decrease this in spigot.yml. " - "Recommended: 40.", - inline=True) + "Recommended: 40.") except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_monsters_max_per_tick = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_monsters_max_per_tick == 8: + "wake-up-inactive"]["monsters-max-per-tick"]) + if wake_up_inactive_monsters_max_per_tick >= 8: embed_var.add_field(name="❌ wake-up-inactive.monsters-max-per-tick", value="Decrease this in spigot.yml. " - "Recommended: 4.", - inline=True) + "Recommended: 4.") except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_flying_monsters_max_per_tick = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_flying_monsters_max_per_tick == 8: + "wake-up-inactive"]["flying-monsters-max-per-tick"]) + if wake_up_inactive_flying_monsters_max_per_tick >= 8: embed_var.add_field(name="❌ wake-up-inactive.flying-monsters-max-per-tick", value="Decrease this in spigot.yml. " - "Recommended: 1.", - inline=True) + "Recommended: 1.") except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_flying_monsters_every = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) + "wake-up-inactive"]["flying-monsters-every"]) except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_monsters_every = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) + "wake-up-inactive"]["inactive-monsters-every"]) except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_animals_max_per_tick = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_animals_max_per_tick == 4: + "wake-up-inactive"]["animals-max-per-tick"]) + if wake_up_inactive_animals_max_per_tick >= 4: embed_var.add_field(name="❌ wake-up-inactive.animals-max-per-tick", value="Decrease this in spigot.yml. " - "Recommended: 2.", - inline=True) + "Recommended: 2.") except KeyError: unchecked = unchecked + 1 try: wake_up_inactive_monsters_for = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["villagers-every"]) - if wake_up_inactive_monsters_for == 100: + "wake-up-inactive"]["monsters-for"]) + if wake_up_inactive_monsters_for >= 100: embed_var.add_field(name="❌ wake-up-inactive.monsters-for", value="Decrease this in spigot.yml. " - "Recommended: 60.", - inline=True) + "Recommended: 60.") except KeyError: unchecked = unchecked + 1 try: arrow_despawn_rate = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["arrow-despawn-rate"]) - if arrow_despawn_rate == 1200: + if arrow_despawn_rate >= 1200: embed_var.add_field(name="❌ arrow-despawn-rate", value="Decrease this in spigot.yml. " - "Recommended: 300.", - inline=True) + "Recommended: 300.") except KeyError: unchecked = unchecked + 1 try: item_merge_radius = float( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["merge-radius"]["item"]) - if item_merge_radius == 2.5: + if item_merge_radius <= 2.5: embed_var.add_field(name="❌ merge-radius.item", value="Increase this in spigot.yml. " - "Recommended: 4.0.", - inline=True) + "Recommended: 4.0.") except KeyError: unchecked = unchecked + 1 try: exp_merge_radius = float( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["merge-radius"]["exp"]) - if exp_merge_radius == 3.0: + if exp_merge_radius <= 3.0: embed_var.add_field(name="❌ merge-radius.exp", value="Increase this in spigot.yml. " - "Recommended: 6.0.", - inline=True) + "Recommended: 6.0.") except KeyError: unchecked = unchecked + 1 try: max_entity_collisions = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["max-entity-collisions"]) - if max_entity_collisions == 8: + if max_entity_collisions >= 8: embed_var.add_field(name="❌ max-entity-collisions", value="Decrease this in spigot.yml. " - "Recommended: 2.", - inline=True) + "Recommended: 2.") except KeyError: unchecked = unchecked + 1 try: max_auto_save_chunks_per_tick = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["max-auto-save-chunks-per-tick"]) - if max_auto_save_chunks_per_tick == 24: + if max_auto_save_chunks_per_tick >= 24: embed_var.add_field(name="❌ max-auto-save-chunks-per-tick", value="Decrease this in paper.yml. " - "Recommended: 6.", - inline=True) + "Recommended: 6.") except KeyError: unchecked = unchecked + 1 @@ -740,8 +661,7 @@ class Timings(commands.Cog): "optimize-explosions"] if optimize_explosions == "false": embed_var.add_field(name="❌ optimize-explosions", - value="Enable this in paper.yml.", - inline=True) + value="Enable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -751,8 +671,7 @@ class Timings(commands.Cog): if mob_spawner_tick_rate == 1: embed_var.add_field(name="❌ mob-spawner-tick-rate", value="Increase this in paper.yml. " - "Recommended: 2.", - inline=True) + "Recommended: 2.") except KeyError: unchecked = unchecked + 1 @@ -762,8 +681,7 @@ class Timings(commands.Cog): "disable-chest-cat-detection"] if disable_chest_cat_detection == "false": embed_var.add_field(name="❌ disable-chest-cat-detection", - value="Enable this in paper.yml.", - inline=True) + value="Enable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -773,8 +691,7 @@ class Timings(commands.Cog): if container_update_tick_rate == "false": embed_var.add_field(name="❌ container-update-tick-rate", value="Increase this in paper.yml. " - "Recommended: 3.", - inline=True) + "Recommended: 3.") except KeyError: unchecked = unchecked + 1 @@ -784,29 +701,26 @@ class Timings(commands.Cog): if grass_spread_tick_rate == 1: embed_var.add_field(name="❌ grass-spread-tick-rate", value="Increase this in paper.yml. " - "Recommended: 4", - inline=True) + "Recommended: 4") except KeyError: unchecked = unchecked + 1 try: soft_despawn_range = int( r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["despawn-ranges"]["soft"]) - if soft_despawn_range == 32: + if soft_despawn_range >= 32: embed_var.add_field(name="❌ despawn-ranges.soft", value="Decrease this in paper.yml. " - "Recommended: 28", - inline=True) + "Recommended: 28") except KeyError: unchecked = unchecked + 1 try: hard_despawn_range = int(r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["despawn-ranges"]["soft"]) - if hard_despawn_range == 128: + if hard_despawn_range >= 128: embed_var.add_field(name="❌ despawn-ranges.hard", value="Decrease this in paper.yml. " - "Recommended: 48", - inline=True) + "Recommended: 48") except KeyError: unchecked = unchecked + 1 @@ -815,8 +729,7 @@ class Timings(commands.Cog): "disable-move-event"] if hopper_disable_move_event == "false": embed_var.add_field(name="❌ hopper.disable-move-event", - value="Enable this in paper.yml.", - inline=True) + value="Enable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -826,8 +739,7 @@ class Timings(commands.Cog): if non_player_arrow_despawn_rate == -1: embed_var.add_field(name="❌ non-player-arrow-despawn-rate", value="Set a value in paper.yml. " - "Recommended: 60", - inline=True) + "Recommended: 60") except KeyError: unchecked = unchecked + 1 @@ -837,8 +749,7 @@ class Timings(commands.Cog): if creative_arrow_despawn_rate == -1: embed_var.add_field(name="❌ creative-arrow-despawn-rate", value="Set a value in paper.yml. " - "Recommended: 60", - inline=True) + "Recommended: 60") except KeyError: unchecked = unchecked + 1 @@ -847,8 +758,7 @@ class Timings(commands.Cog): "prevent-moving-into-unloaded-chunks"] if prevent_moving_into_unloaded_chunks == "false": embed_var.add_field(name="❌ prevent-moving-into-unloaded-chunks", - value="Enable this in paper.yml.", - inline=True) + value="Enable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -857,8 +767,7 @@ class Timings(commands.Cog): "use-faster-eigencraft-redstone"] if eigencraft_redstone == "false": embed_var.add_field(name="❌ use-faster-eigencraft-redstone", - value="Enable this in paper.yml.", - inline=True) + value="Enable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -866,8 +775,7 @@ class Timings(commands.Cog): fix_climbing_bypass_gamerule = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["fix-climbing-bypassing-cramming-rule"] if fix_climbing_bypass_gamerule == "false": embed_var.add_field(name="❌ fix-climbing-bypassing-cramming-rule", - value="Enable this in paper.yml.", - inline=True) + value="Enable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -875,8 +783,7 @@ class Timings(commands.Cog): armor_stands_do_collision_entity_lookups = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["armor-stands-do-collision-entity-lookups"] if armor_stands_do_collision_entity_lookups == "true": embed_var.add_field(name="❌ armor-stands-do-collision-entity-lookups", - value="Disable this in paper.yml.", - inline=True) + value="Disable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -885,8 +792,7 @@ class Timings(commands.Cog): armor_stands_tick = r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["armor-stands-tick"] if armor_stands_tick == "true" and "PetBlocks" not in plugins and "BlockBalls" not in plugins and "ArmorStandTools" not in plugins: embed_var.add_field(name="❌ armor-stands-tick", - value="Disable this in paper.yml.", - inline=True) + value="Disable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -895,8 +801,7 @@ class Timings(commands.Cog): "per-player-mob-spawns"] if per_player_mob_spawns == "false": embed_var.add_field(name="❌ per-player-mob-spawns", - value="Enable this in paper.yml.", - inline=True) + value="Enable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -905,8 +810,7 @@ class Timings(commands.Cog): r["timingsMaster"]["config"]["paper"]["world-settings"]["default"]["alt-item-despawn-rate"]["enabled"] if alt_item_despawn_rate_enabled == "false": embed_var.add_field(name="❌ alt-item-despawn-rate.enabled", - value="Enable this in paper.yml.", - inline=True) + value="Enable this in paper.yml.") except KeyError: unchecked = unchecked + 1 @@ -922,14 +826,11 @@ class Timings(commands.Cog): if view_distance >= 4: embed_var.add_field(name="❌ no-tick-view-distance", value="Set a value in paper.yml. " - "Recommended: " + str( - view_distance) + ". And reduce view-distance in server.properties. Recommended: 3.", - inline=True) + "Recommended: " + str(view_distance) + ". And reduce view-distance in server.properties. Recommended: 3.") elif int(spigot_view_distance) >= 4: embed_var.add_field(name="❌ no-tick-view-distance", value="Set a value in paper.yml. " - "Recommended: " + spigot_view_distance + ". And reduce view-distance in spigot.yml. Recommended: 3.", - inline=True) + "Recommended: " + spigot_view_distance + ". And reduce view-distance in spigot.yml. Recommended: 3.") except KeyError: unchecked = unchecked + 1 @@ -938,8 +839,7 @@ class Timings(commands.Cog): "enable-treasure-maps"] if enable_treasure_maps == "true": embed_var.add_field(name="❌ enable-treasure-maps", - value="Disable this in paper.yml. Why? Generating treasure maps is extremely expensive and can hang a server if the structure it's trying to locate is really far away.", - inline=True) + value="Disable this in paper.yml. Why? Generating treasure maps is extremely expensive and can hang a server if the structure it's trying to locate is really far away.") except KeyError: unchecked = unchecked + 1 @@ -948,21 +848,19 @@ class Timings(commands.Cog): "projectile-load-save-per-chunk-limit"]) if projectile_load_save == -1: embed_var.add_field(name="❌ projectile-load-save-per-chunk-limit", - value="Set a value in paper.yml. Recommended: 8.", - inline=True) + value="Set a value in paper.yml. Recommended: 8.") except KeyError: unchecked = unchecked + 1 try: use_alternate_keepalive = r["timingsMaster"]["config"]["purpur"]["settings"]["use-alternate-keepalive"] + plugins = r["timingsMaster"]["plugins"] if use_alternate_keepalive == "false" and "TCPShield" not in plugins: embed_var.add_field(name="❌ use-alternate-keepalive", - value="Enable this in purpur.yml.", - inline=True) + value="Enable this in purpur.yml.") if use_alternate_keepalive == "true" and "TCPShield" in plugins: embed_var.add_field(name="❌ use-alternate-keepalive", - value="Disable this in purpur.yml. It causes issues with TCPShield.", - inline=True) + value="Disable this in purpur.yml. It causes issues with TCPShield.") except KeyError: unchecked = unchecked + 1 @@ -971,8 +869,7 @@ class Timings(commands.Cog): "dont-send-useless-entity-packets"] if dont_send_useless_entity_packets == "false": embed_var.add_field(name="❌ dont-send-useless-entity-packets", - value="Enable this in purpur.yml.", - inline=True) + value="Enable this in purpur.yml.") except KeyError: unchecked = unchecked + 1 @@ -982,8 +879,7 @@ class Timings(commands.Cog): "disable-treasure-searching"] if disable_treasure_searching == "false": embed_var.add_field(name="❌ dolphin.disable-treasure-searching", - value="Enable this in purpur.yml.", - inline=True) + value="Enable this in purpur.yml.") except KeyError: unchecked = unchecked + 1 @@ -994,8 +890,7 @@ class Timings(commands.Cog): if brain_ticks == 1: embed_var.add_field(name="❌ villager.brain-ticks", value="Increase this in purpur.yml. " - "Recommended: 4.", - inline=True) + "Recommended: 4.") except KeyError: unchecked = unchecked + 1 @@ -1006,8 +901,7 @@ class Timings(commands.Cog): if iron_golem_radius == 0: embed_var.add_field(name="❌ spawn-iron-golem.radius", value="Set a value in purpur.yml. " - "Recommended: 32.", - inline=True) + "Recommended: 32.") except KeyError: unchecked = unchecked + 1 @@ -1018,8 +912,7 @@ class Timings(commands.Cog): if iron_golem_limit == 0: embed_var.add_field(name="❌ spawn-iron-golem.limit", value="Set a value in purpur.yml. " - "Recommended: 5.", - inline=True) + "Recommended: 5.") except KeyError: unchecked = unchecked + 1 @@ -1029,8 +922,7 @@ class Timings(commands.Cog): "aggressive-towards-villager-when-lagging"] if aggressive_towards_villager_when_lagging == "true": embed_var.add_field(name="❌ zombie.aggresive-towards-villager-when-lagging", - value="Disable this in purpur.yml.", - inline=True) + value="Disable this in purpur.yml.") except KeyError: unchecked = unchecked + 1 @@ -1040,8 +932,7 @@ class Timings(commands.Cog): "entities-can-use-portals"] if entities_can_use_portals == "true": embed_var.add_field(name="❌ entities-can-use-portals", - value="Disable this in purpur.yml to prevent players from creating chunk anchors.", - inline=True) + value="Disable this in purpur.yml to prevent players from creating chunk anchors.") except KeyError: unchecked = unchecked + 1 @@ -1050,8 +941,7 @@ class Timings(commands.Cog): "lobotomize"]["enabled"] if lobotomize_enabled == "false": embed_var.add_field(name="❌ villager.lobotomize.enabled", - value="Enable this in purpur.yml.", - inline=True) + value="Enable this in purpur.yml.") except KeyError: unchecked = unchecked + 1 @@ -1059,16 +949,12 @@ class Timings(commands.Cog): teleport_if_outside_border = r["timingsMaster"]["config"]["purpur"]["world-settings"]["default"]["gameplay-mechanics"]["player"]["teleport-if-outside-border"] if teleport_if_outside_border == "false": embed_var.add_field(name="❌ player.teleport-if-outside-border", - value="Enable this in purpur.yml.", - inline=True) + value="Enable this in purpur.yml.") except KeyError: unchecked = unchecked + 1 except ValueError: embed_var.add_field(name="❌ Invalid Configuration", - value="At least one of your configuration files had an invalid data type.", - inline=True) - await message.reply(embed=embed_var) - return + value="At least one of your configuration files had an invalid data type.") if len(embed_var.fields) == 0: embed_var.add_field(name="✅ All good", @@ -1078,7 +964,7 @@ class Timings(commands.Cog): issue_count = len(embed_var.fields) if issue_count >= 25: - embed_var.insert_field_at(index=24, name="Plus " + str(issue_count - 24) + " more recommendations", value="Create a new timings report after resolving some of the above issues to see more,", inline=True) + embed_var.insert_field_at(index=24, name="Plus " + str(issue_count - 24) + " more recommendations", value="Create a new timings report after resolving some of the above issues to see more.") if unchecked > 0: embed_var.description = "||" + str(unchecked) + " missing configuration optimizations due to your server version.||" await message.reply(embed=embed_var) From adf94ad42909bb4c31506f17a9df5a8e1a57af80 Mon Sep 17 00:00:00 2001 From: DrBot7 <46543473+DrBot7@users.noreply.github.com> Date: Mon, 11 Jan 2021 15:57:43 -0600 Subject: [PATCH 63/63] Update timings.py --- cogs/timings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/timings.py b/cogs/timings.py index c9c1177..963f59b 100644 --- a/cogs/timings.py +++ b/cogs/timings.py @@ -21,7 +21,7 @@ class Timings(commands.Cog): "https://timings.spigotmc.org/?url="): embed_var = discord.Embed(title="Timings Analysis", color=0x55ffff) embed_var.add_field(name="❌ Spigot", - value="Upgrade to [Purpur](https://ci.pl3x.net/job/Purpur/).") + value="Upgrade to [Purpur](https://purpur.pl3x.net/downloads/#1.16.4).") embed_var.set_footer(text="Requested by " + message.author.name, icon_url=message.author.avatar_url) embed_var.url = timings_url await message.reply(embed=embed_var) @@ -580,7 +580,7 @@ class Timings(commands.Cog): try: wake_up_inactive_monsters_every = int( r["timingsMaster"]["config"]["spigot"]["world-settings"]["default"]["entity-activation-range"][ - "wake-up-inactive"]["inactive-monsters-every"]) + "wake-up-inactive"]["monsters-every"]) except KeyError: unchecked = unchecked + 1