mirror of https://github.com/stijndcl/didier
Fix error message in help, fix help not working with mention prefix, fix error when pinning system messages (by adding an easter egg)
parent
10da82d211
commit
3f5eb6a595
16
cogs/help.py
16
cogs/help.py
|
@ -22,6 +22,10 @@ class HelpCommand(commands.MinimalHelpCommand):
|
||||||
if ctx.bot.locked:
|
if ctx.bot.locked:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# If mention prefix was used, don't count it as a target
|
||||||
|
if ctx.message.content.startswith("<@"):
|
||||||
|
ctx.message.mentions = ctx.message.mentions[1:]
|
||||||
|
|
||||||
if len(ctx.message.mentions) > 5:
|
if len(ctx.message.mentions) > 5:
|
||||||
return await ctx.send("Je kan Help maar naar maximaal 5 mensen doorsturen.")
|
return await ctx.send("Je kan Help maar naar maximaal 5 mensen doorsturen.")
|
||||||
|
|
||||||
|
@ -40,6 +44,10 @@ class HelpCommand(commands.MinimalHelpCommand):
|
||||||
spl = command.split(" ")
|
spl = command.split(" ")
|
||||||
spl = spl[:len(spl) - len(self.ctx.message.mentions)]
|
spl = spl[:len(spl) - len(self.ctx.message.mentions)]
|
||||||
|
|
||||||
|
# A person was mentioned without passing an argument
|
||||||
|
if not spl:
|
||||||
|
return await self.send_bot_help(self.get_bot_mapping())
|
||||||
|
|
||||||
# Turn dic to lowercase to allow proper name searching
|
# Turn dic to lowercase to allow proper name searching
|
||||||
all_commands = dict((k.lower(), v) for k, v in bot.all_commands.items())
|
all_commands = dict((k.lower(), v) for k, v in bot.all_commands.items())
|
||||||
|
|
||||||
|
@ -115,6 +123,10 @@ class HelpCommand(commands.MinimalHelpCommand):
|
||||||
embed.add_field(name=await self.get_command_signature(command),
|
embed.add_field(name=await self.get_command_signature(command),
|
||||||
value=await self.add_aliases_formatting(sorted(command.aliases)) + helpDescription)
|
value=await self.add_aliases_formatting(sorted(command.aliases)) + helpDescription)
|
||||||
for person in await self.get_destination():
|
for person in await self.get_destination():
|
||||||
|
# Can't send to bots
|
||||||
|
if person.bot:
|
||||||
|
continue
|
||||||
|
|
||||||
await person.send(embed=embed)
|
await person.send(embed=embed)
|
||||||
|
|
||||||
async def send_group_help(self, group):
|
async def send_group_help(self, group):
|
||||||
|
@ -139,6 +151,10 @@ class HelpCommand(commands.MinimalHelpCommand):
|
||||||
helpFile[self.get_name(subcommand).lower()], inline=False)
|
helpFile[self.get_name(subcommand).lower()], inline=False)
|
||||||
|
|
||||||
for person in await self.get_destination():
|
for person in await self.get_destination():
|
||||||
|
# Can't send to bots
|
||||||
|
if person.bot:
|
||||||
|
continue
|
||||||
|
|
||||||
await person.send(embed=embed)
|
await person.send(embed=embed)
|
||||||
|
|
||||||
# Allow mentioning people to send it to them instead
|
# Allow mentioning people to send it to them instead
|
||||||
|
|
|
@ -96,8 +96,11 @@ class School(commands.Cog):
|
||||||
if ctx.author.id in blacklist:
|
if ctx.author.id in blacklist:
|
||||||
return
|
return
|
||||||
|
|
||||||
await ctx.message.add_reaction("✅")
|
if message.is_system():
|
||||||
|
return await ctx.send("Dus jij wil system messages pinnen?\nMag niet.")
|
||||||
|
|
||||||
await message.pin(reason="Didier Pin door {}".format(ctx.author.display_name))
|
await message.pin(reason="Didier Pin door {}".format(ctx.author.display_name))
|
||||||
|
await ctx.message.add_reaction("✅")
|
||||||
|
|
||||||
|
|
||||||
def setup(client):
|
def setup(client):
|
||||||
|
|
Loading…
Reference in New Issue