1
0
Fork 0

Merge pull request #52 from flifloo/utils

Utils
This commit is contained in:
Ethanell 2020-11-05 16:54:28 +01:00
commit 96ea845a2b
3 changed files with 24 additions and 5 deletions

View file

@ -41,7 +41,7 @@ class Extension(commands.Cog):
pass pass
if not embed.fields: if not embed.fields:
raise MissingPermissions(None) raise MissingPermissions("")
await ctx.send(embed=embed) await ctx.send(embed=embed)
@extension.group("list", pass_context=True) @extension.group("list", pass_context=True)

View file

@ -74,7 +74,7 @@ class PCP(commands.Cog):
if await self.pcp_unpin.can_run(ctx): if await self.pcp_unpin.can_run(ctx):
embed.add_field(name="pcp unpin <url>", value="Unpin a message with the url", inline=False) embed.add_field(name="pcp unpin <url>", value="Unpin a message with the url", inline=False)
if not embed.fields: if not embed.fields:
raise MissingPermissions(None) raise MissingPermissions("")
await ctx.send(embed=embed) await ctx.send(embed=embed)
@pcp.group("pin", pass_context=True) @pcp.group("pin", pass_context=True)

View file

@ -2,7 +2,7 @@ from datetime import datetime
from discord import Embed, Member, Guild from discord import Embed, Member, Guild
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import BadArgument from discord.ext.commands import BadArgument, CommandError
from administrator.check import is_enabled from administrator.check import is_enabled
from administrator.logger import logger from administrator.logger import logger
@ -28,9 +28,13 @@ class Utils(commands.Cog):
@utils.group("help", pass_context=True) @utils.group("help", pass_context=True)
async def utils_help(self, ctx: commands.Context): async def utils_help(self, ctx: commands.Context):
embed = Embed(title="Utils help") embed = Embed(title="Utils help")
if self.eval.can_run(ctx): try:
embed.add_field(name="eval \`\`\`code\`\`\`", value="Execute some code", inline=False) if await self.eval.can_run(ctx):
embed.add_field(name="eval \`\`\`code\`\`\`", value="Execute some code", inline=False)
except CommandError:
pass
embed.add_field(name="ping", value="Return the ping with the discord API", inline=False) embed.add_field(name="ping", value="Return the ping with the discord API", inline=False)
embed.add_field(name="info [@user]", value="Show information on guild or user specified", inline=False)
await ctx.send(embed=embed) await ctx.send(embed=embed)
@commands.group("eval", pass_context=True) @commands.group("eval", pass_context=True)
@ -127,6 +131,21 @@ class Utils(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
@commands.group("about", pass_context=True)
@is_enabled()
async def about(self, ctx: commands.Context):
embed = Embed(title=self.bot.user.display_name, description=self.bot.description)
embed.set_author(name="Administrator", icon_url=self.bot.user.avatar_url, url="https://github.com/flifloo")
flifloo = self.bot.get_user(177393521051959306)
embed.set_footer(text=f"Made with ❤️ by {flifloo.display_name}", icon_url=flifloo.avatar_url)
embed.add_field(name="Owned by",
value=(await self.bot.application_info()).owner.display_name)
embed.add_field(name="Guilds", value=str(len(self.bot.guilds)))
embed.add_field(name="Extensions", value=str(len(self.bot.extensions)))
embed.add_field(name="Commands", value=str(len(self.bot.all_commands)))
embed.add_field(name="Latency", value=f"{round(self.bot.latency*1000)} ms")
await ctx.send(embed=embed)
def setup(bot): def setup(bot):
logger.info(f"Loading...") logger.info(f"Loading...")