feat(commands|Utils): add credits and invite commands

This commit is contained in:
Romain J 2020-11-11 01:05:36 +01:00
parent 71576f48e4
commit 3587a8f8a4
4 changed files with 102 additions and 2 deletions

View file

@ -1,7 +1,7 @@
[metadata] [metadata]
name = Tuxbot-bot name = Tuxbot-bot
version = attr: tuxbot.__version__ version = attr: tuxbot.__version__
url = https://git.gnous.eu/gnouseu/tuxbot-bot/ url = https://github.com/Rom1-J/tuxbot-bot/
author = Romain J. author = Romain J.
author_email = romain@gnous.eu author_email = romain@gnous.eu
maintainer = Romain J. maintainer = Romain J.
@ -42,4 +42,4 @@ include =
locales/*.po locales/*.po
**/locales/*.po **/locales/*.po
data/* data/*
data/**/* data/**/*

View file

@ -32,6 +32,9 @@ class Admin(commands.Cog, name="Admin"):
self.bot.config.Servers, ctx.guild.id, Config.Server, locale=lang self.bot.config.Servers, ctx.guild.id, Config.Server, locale=lang
) )
# =========================================================================
# =========================================================================
@group_extra(name="lang", aliases=["locale", "langue"], deletable=True) @group_extra(name="lang", aliases=["locale", "langue"], deletable=True)
@commands.guild_only() @commands.guild_only()
@checks.is_admin() @checks.is_admin()

View file

@ -33,6 +33,9 @@ class Dev(commands.Cog, name="Dev"):
password=self.config.password, password=self.config.password,
) )
# =========================================================================
# =========================================================================
@group_extra(name="issue", aliases=["issues"], deletable=True) @group_extra(name="issue", aliases=["issues"], deletable=True)
@checks.is_owner() @checks.is_owner()
async def _issue(self, ctx: ContextPlus): async def _issue(self, ctx: ContextPlus):

View file

@ -22,6 +22,9 @@ class Utils(commands.Cog, name="Utils"):
def __init__(self, bot: Tux): def __init__(self, bot: Tux):
self.bot = bot self.bot = bot
# =========================================================================
# =========================================================================
@command_extra(name="info", aliases=["about"]) @command_extra(name="info", aliases=["about"])
async def _info(self, ctx: ContextPlus): async def _info(self, ctx: ContextPlus):
proc = psutil.Process() proc = psutil.Process()
@ -111,3 +114,94 @@ class Utils(commands.Cog, name="Utils"):
e.set_footer(text=f"version: {__version__} • prefix: {ctx.prefix}") e.set_footer(text=f"version: {__version__} • prefix: {ctx.prefix}")
await ctx.send(embed=e) 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)