diff --git a/extensions/greetings.py b/extensions/greetings.py index fad6c64..f8229a8 100644 --- a/extensions/greetings.py +++ b/extensions/greetings.py @@ -28,7 +28,7 @@ class Greetings(commands.Cog): @greetings.group("help", pass_context=True) async def greetings_help(self, ctx: commands.Context): - embed = Embed(title="greetings help") + embed = Embed(title="Greetings help") embed.add_field(name="set ", value="Set the greetings message\n" "`{}` will be replace by the username", inline=False) diff --git a/extensions/help.py b/extensions/help.py index 2e71cbf..f2e38bb 100644 --- a/extensions/help.py +++ b/extensions/help.py @@ -1,8 +1,10 @@ +from discord import Embed from discord.ext import commands from discord.ext.commands import CommandNotFound, MissingRequiredArgument, BadArgument, MissingPermissions +from administrator import config from administrator.logger import logger -from administrator.check import NotOwner +from administrator.check import NotOwner, is_owner extension_name = "help" @@ -16,7 +18,29 @@ class Help(commands.Cog): @commands.command("help", pass_context=True) async def help(self, ctx: commands.Context): - await ctx.send("HALP !") + embed = Embed(title="Help") + embed.add_field(name="Poll", value="Create poll with a simple command\n" + f"`{config.get('prefix')}poll help` for more information", inline=False) + embed.add_field(name="Reminders", value="Create reminders\n" + f"`{config.get('prefix')}reminder help` for more information", + inline=False) + permissions = ctx.channel.permissions_for(ctx.author) + if permissions.manage_messages: + embed.add_field(name="Purge", value="Purge all messages between the command and the next add reaction\n" + f"`{config.get('prefix')}purge help` for more information", inline=False) + if permissions.manage_guild: + embed.add_field(name="Greetings", value="Setup join and leave message\n" + f"`{config.get('prefix')}greetings help` for more information", + inline=False) + embed.add_field(name="Presentation", value="Give role to user who make a presentation in a dedicated " + "channel\n" + f"`{config.get('prefix')}presentation help` for more information", + inline=False) + if await is_owner(ctx): + embed.add_field(name="Extension", value="Manage bot extensions\n" + f"`{config.get('prefix')}extension help` for more information", + inline=False) + await ctx.send(embed=embed) @commands.Cog.listener() async def on_command_error(self, ctx: commands.Context, error): diff --git a/extensions/poll.py b/extensions/poll.py index a47bbf0..d76e42a 100644 --- a/extensions/poll.py +++ b/extensions/poll.py @@ -48,7 +48,7 @@ class Poll(commands.Cog): @poll.group("help", pass_context=True) @commands.guild_only() async def poll_help(self, ctx: commands.Context): - embed = Embed(title="poll help") + embed = Embed(title="Poll help") embed.add_field(name="poll [multi|m] ... ", value="Create a poll, the argument multi (or m) after the name allow multiple response\n" "User the \U0001F5D1 to close the poll", diff --git a/extensions/presentation.py b/extensions/presentation.py index ab6148e..1e78527 100644 --- a/extensions/presentation.py +++ b/extensions/presentation.py @@ -23,7 +23,7 @@ class Presentation(commands.Cog): @presentation.group("help", pass_context=True) async def presentation_help(self, ctx: commands.Context): - embed = Embed(title="greetings help", description="Give a role to a new member after a presentation") + embed = Embed(title="Presentation help", description="Give a role to a new member after a presentation") embed.add_field(name="set <#channel> <@role>", value="Set the presentation channel and the role to give", inline=False) embed.add_field(name="disable", value="Disable the auto role give", inline=False) diff --git a/extensions/purge.py b/extensions/purge.py index 3fcc6ec..eaba4ce 100644 --- a/extensions/purge.py +++ b/extensions/purge.py @@ -17,21 +17,19 @@ class Purge(commands.Cog): @commands.group("purge", pass_context=True) @commands.guild_only() + @commands.has_permissions(manage_messages=True) async def purge(self, ctx: commands.Context): if ctx.invoked_subcommand is None: - if ctx.message.channel.permissions_for(ctx.author).manage_messages: - self.purges[ctx.message.author.id] = ctx.message - await ctx.message.add_reaction("\U0001f44d") + self.purges[ctx.message.author.id] = ctx.message + await ctx.message.add_reaction("\U0001f44d") - await sleep(2*60) - try: - if self.purges[ctx.message.author.id] == ctx.message: - await ctx.message.clear_reactions() - del self.purges[ctx.message.author.id] - except: - pass - else: - await ctx.message.add_reaction("\u274C") + await sleep(2*60) + try: + if self.purges[ctx.message.author.id] == ctx.message: + await ctx.message.clear_reactions() + del self.purges[ctx.message.author.id] + except: + pass @purge.group("help", pass_context=True) @commands.guild_only()