Browse Source

Update timings.py

master
DrBot7 4 years ago
committed by GitHub
parent
commit
c2fcd4c305
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 49
      cogs/timings.py

49
cogs/timings.py

@ -2,7 +2,6 @@ import discord
from discord.ext import commands from discord.ext import commands
import requests import requests
class Timings(commands.Cog): class Timings(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
@ -24,7 +23,7 @@ class Timings(commands.Cog):
embed_var.add_field(name="❌ Spigot", embed_var.add_field(name="❌ Spigot",
value="Upgrade to [Purpur](https://ci.pl3x.net/job/Purpur/).", value="Upgrade to [Purpur](https://ci.pl3x.net/job/Purpur/).",
inline=True) inline=True)
await message.channel.send(embed=embed_var)
await message.reply(embed=embed_var)
return return
if timings_url == "": if timings_url == "":
return return
@ -41,7 +40,7 @@ class Timings(commands.Cog):
embed_var.add_field(name="❌ Invalid report", embed_var.add_field(name="❌ Invalid report",
value="Create a new timings report.", value="Create a new timings report.",
inline=True) inline=True)
await message.channel.send(embed=embed_var)
await message.reply(embed=embed_var)
return return
embed_var = discord.Embed(title="Timings Analysis", color=0x55ffff) embed_var = discord.Embed(title="Timings Analysis", color=0x55ffff)
@ -175,7 +174,7 @@ class Timings(commands.Cog):
if "LagAssist" in plugins: 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. " 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) inline=True)
if "NoChunkLag" in plugins: if "NoChunkLag" in plugins:
embed_var.add_field(name="❌ NoChunkLag", embed_var.add_field(name="❌ NoChunkLag",
@ -292,11 +291,29 @@ class Timings(commands.Cog):
value="bPermissions is an outdated permission plugin. " 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).", "Consider replacing it with [LuckPerms](https://ci.lucko.me/job/LuckPerms/1243/artifact/bukkit/build/libs/LuckPerms-Bukkit-5.2.77.jar).",
inline=True) 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: 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: except KeyError:
unchecked = unchecked + 1 unchecked = unchecked + 1
@ -1050,23 +1067,21 @@ class Timings(commands.Cog):
embed_var.add_field(name="❌ Invalid Configuration", embed_var.add_field(name="❌ Invalid Configuration",
value="At least one of your configuration files had an invalid data type.", value="At least one of your configuration files had an invalid data type.",
inline=True) inline=True)
await message.channel.send(embed=embed_var)
await message.reply(embed=embed_var)
return return
if len(embed_var.fields) == 0: if len(embed_var.fields) == 0:
embed_var.add_field(name="✅ All good", embed_var.add_field(name="✅ All good",
value="Analyzed with no issues") value="Analyzed with no issues")
await message.channel.send(embed=embed_var)
await message.reply(embed=embed_var)
return return
issue_count = len(embed_var.fields) 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): def setup(bot):

Loading…
Cancel
Save