From 3587a8f8a4a1933f76afd1a27d3da31f6093848f Mon Sep 17 00:00:00 2001 From: Romain J Date: Wed, 11 Nov 2020 01:05:36 +0100 Subject: [PATCH] feat(commands|Utils): add credits and invite commands --- setup.cfg | 4 +- tuxbot/cogs/Admin/admin.py | 3 ++ tuxbot/cogs/Dev/dev.py | 3 ++ tuxbot/cogs/Utils/utils.py | 94 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 2b717cf..49d9f80 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = Tuxbot-bot version = attr: tuxbot.__version__ -url = https://git.gnous.eu/gnouseu/tuxbot-bot/ +url = https://github.com/Rom1-J/tuxbot-bot/ author = Romain J. author_email = romain@gnous.eu maintainer = Romain J. @@ -42,4 +42,4 @@ include = locales/*.po **/locales/*.po data/* - data/**/* \ No newline at end of file + data/**/* diff --git a/tuxbot/cogs/Admin/admin.py b/tuxbot/cogs/Admin/admin.py index a825cbe..3cd2429 100644 --- a/tuxbot/cogs/Admin/admin.py +++ b/tuxbot/cogs/Admin/admin.py @@ -32,6 +32,9 @@ class Admin(commands.Cog, name="Admin"): self.bot.config.Servers, ctx.guild.id, Config.Server, locale=lang ) + # ========================================================================= + # ========================================================================= + @group_extra(name="lang", aliases=["locale", "langue"], deletable=True) @commands.guild_only() @checks.is_admin() diff --git a/tuxbot/cogs/Dev/dev.py b/tuxbot/cogs/Dev/dev.py index 6ed6fac..1c3c2a2 100644 --- a/tuxbot/cogs/Dev/dev.py +++ b/tuxbot/cogs/Dev/dev.py @@ -33,6 +33,9 @@ class Dev(commands.Cog, name="Dev"): password=self.config.password, ) + # ========================================================================= + # ========================================================================= + @group_extra(name="issue", aliases=["issues"], deletable=True) @checks.is_owner() async def _issue(self, ctx: ContextPlus): diff --git a/tuxbot/cogs/Utils/utils.py b/tuxbot/cogs/Utils/utils.py index 12ba61d..ac4f32f 100644 --- a/tuxbot/cogs/Utils/utils.py +++ b/tuxbot/cogs/Utils/utils.py @@ -22,6 +22,9 @@ class Utils(commands.Cog, name="Utils"): def __init__(self, bot: Tux): self.bot = bot + # ========================================================================= + # ========================================================================= + @command_extra(name="info", aliases=["about"]) async def _info(self, ctx: ContextPlus): proc = psutil.Process() @@ -111,3 +114,94 @@ class Utils(commands.Cog, name="Utils"): e.set_footer(text=f"version: {__version__} • prefix: {ctx.prefix}") await ctx.send(embed=e) + + # ========================================================================= + + @command_extra(name="credits", aliases=["contributors", "authors"]) + async def _credits(self, ctx: ContextPlus): + e = discord.Embed( + title=_("Contributors", ctx, self.bot.config), color=0x36393F + ) + + e.add_field( + name="**Romain#5117** ", + value="• [github](https://github.com/Rom1-J)\n" + "• [gitea](https://git.gnous.eu/Romain)\n" + "• romain@gnous.eu", + inline=True, + ) + e.add_field( + name="**Outout#4039** ", + value="• [gitea](https://git.gnous.eu/mael)\n" + "• [@outoutxyz](https://twitter.com/outouxyz)\n" + "• mael@gnous.eu", + inline=True, + ) + + await ctx.send(embed=e) + + # ========================================================================= + + @command_extra(name="invite") + async def _invite(self, ctx: ContextPlus): + basic_perms = discord.Permissions( + add_reactions=True, + read_messages=True, + send_messages=True, + manage_messages=True, + embed_links=True, + attach_files=True, + read_message_history=True, + external_emojis=True, + connect=True, + speak=True, + manage_roles=True, + ) + + admin_perms = discord.Permissions( + create_instant_invite=True, + kick_members=True, + ban_members=True, + add_reactions=True, + read_messages=True, + send_messages=True, + manage_messages=True, + embed_links=True, + attach_files=True, + read_message_history=True, + external_emojis=True, + connect=True, + speak=True, + manage_roles=True, + ) + + e = discord.Embed( + title=_("Invite", ctx, self.bot.config), color=0x36393F + ) + + e.add_field( + name=_("Minimal", ctx, self.bot.config), + value=_( + "The minimum permissions include the strict requirements for " + "the proper functioning of all basics commands.\n", + ctx, + self.bot.config, + ) + + f"[{_('Add!', ctx, self.bot.config, )}]" + f"({discord.utils.oauth_url(self.bot.user.id, basic_perms)})", + inline=False, + ) + e.add_field( + name=_("Admin", ctx, self.bot.config), + value=_( + "All minimal permissions + extra permissions for admin " + "commands such as kick and ban\n", + ctx, + self.bot.config, + ) + + f"[{_('Add!', ctx, self.bot.config, )}]" + f"({discord.utils.oauth_url(self.bot.user.id, admin_perms)})", + inline=False, + ) + + await ctx.send(embed=e)