Rework help
This commit is contained in:
parent
5846bb7bac
commit
c708509ba9
5 changed files with 39 additions and 17 deletions
|
@ -28,7 +28,7 @@ class Greetings(commands.Cog):
|
||||||
|
|
||||||
@greetings.group("help", pass_context=True)
|
@greetings.group("help", pass_context=True)
|
||||||
async def greetings_help(self, ctx: commands.Context):
|
async def greetings_help(self, ctx: commands.Context):
|
||||||
embed = Embed(title="greetings help")
|
embed = Embed(title="Greetings help")
|
||||||
embed.add_field(name="set <join/leave> <message>", value="Set the greetings message\n"
|
embed.add_field(name="set <join/leave> <message>", value="Set the greetings message\n"
|
||||||
"`{}` will be replace by the username",
|
"`{}` will be replace by the username",
|
||||||
inline=False)
|
inline=False)
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
from discord import Embed
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.ext.commands import CommandNotFound, MissingRequiredArgument, BadArgument, MissingPermissions
|
from discord.ext.commands import CommandNotFound, MissingRequiredArgument, BadArgument, MissingPermissions
|
||||||
|
|
||||||
|
from administrator import config
|
||||||
from administrator.logger import logger
|
from administrator.logger import logger
|
||||||
from administrator.check import NotOwner
|
from administrator.check import NotOwner, is_owner
|
||||||
|
|
||||||
|
|
||||||
extension_name = "help"
|
extension_name = "help"
|
||||||
|
@ -16,7 +18,29 @@ class Help(commands.Cog):
|
||||||
|
|
||||||
@commands.command("help", pass_context=True)
|
@commands.command("help", pass_context=True)
|
||||||
async def help(self, ctx: commands.Context):
|
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()
|
@commands.Cog.listener()
|
||||||
async def on_command_error(self, ctx: commands.Context, error):
|
async def on_command_error(self, ctx: commands.Context, error):
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Poll(commands.Cog):
|
||||||
@poll.group("help", pass_context=True)
|
@poll.group("help", pass_context=True)
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def poll_help(self, ctx: commands.Context):
|
async def poll_help(self, ctx: commands.Context):
|
||||||
embed = Embed(title="poll help")
|
embed = Embed(title="Poll help")
|
||||||
embed.add_field(name="poll <name> [multi|m] <Choice N°1> <Choice N°2> ... <Choice N°11>",
|
embed.add_field(name="poll <name> [multi|m] <Choice N°1> <Choice N°2> ... <Choice N°11>",
|
||||||
value="Create a poll, the argument multi (or m) after the name allow multiple response\n"
|
value="Create a poll, the argument multi (or m) after the name allow multiple response\n"
|
||||||
"User the \U0001F5D1 to close the poll",
|
"User the \U0001F5D1 to close the poll",
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Presentation(commands.Cog):
|
||||||
|
|
||||||
@presentation.group("help", pass_context=True)
|
@presentation.group("help", pass_context=True)
|
||||||
async def presentation_help(self, ctx: commands.Context):
|
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",
|
embed.add_field(name="set <#channel> <@role>", value="Set the presentation channel and the role to give",
|
||||||
inline=False)
|
inline=False)
|
||||||
embed.add_field(name="disable", value="Disable the auto role give", inline=False)
|
embed.add_field(name="disable", value="Disable the auto role give", inline=False)
|
||||||
|
|
|
@ -17,21 +17,19 @@ class Purge(commands.Cog):
|
||||||
|
|
||||||
@commands.group("purge", pass_context=True)
|
@commands.group("purge", pass_context=True)
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
@commands.has_permissions(manage_messages=True)
|
||||||
async def purge(self, ctx: commands.Context):
|
async def purge(self, ctx: commands.Context):
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
if ctx.message.channel.permissions_for(ctx.author).manage_messages:
|
self.purges[ctx.message.author.id] = ctx.message
|
||||||
self.purges[ctx.message.author.id] = ctx.message
|
await ctx.message.add_reaction("\U0001f44d")
|
||||||
await ctx.message.add_reaction("\U0001f44d")
|
|
||||||
|
|
||||||
await sleep(2*60)
|
await sleep(2*60)
|
||||||
try:
|
try:
|
||||||
if self.purges[ctx.message.author.id] == ctx.message:
|
if self.purges[ctx.message.author.id] == ctx.message:
|
||||||
await ctx.message.clear_reactions()
|
await ctx.message.clear_reactions()
|
||||||
del self.purges[ctx.message.author.id]
|
del self.purges[ctx.message.author.id]
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
await ctx.message.add_reaction("\u274C")
|
|
||||||
|
|
||||||
@purge.group("help", pass_context=True)
|
@purge.group("help", pass_context=True)
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
|
Reference in a new issue