refactor: !help command
This commit is contained in:
parent
d28062ca4f
commit
787b4ce5b6
@ -239,20 +239,7 @@ async def on_message(message):
|
||||
if len(message.content) > 5:
|
||||
await client.send_message(message.channel, help_methods.parse_message(message.content))
|
||||
else:
|
||||
description = """Below you can see all the commands I know.
|
||||
If you need further help with something join our [Support Server](http://discordapp.com). \n
|
||||
**Have a nice day!**
|
||||
COMMANDS
|
||||
{} \n
|
||||
**Use `!help <Command>` for more information about a command.** \n
|
||||
**Examples:**
|
||||
`!help dog` for detailed help for the dog command \n
|
||||
**Useful links:**
|
||||
[Support Server](http://discordapp.com), [Twitter](http://twitter.com)""".format(help_methods.parse_message(message.content))
|
||||
|
||||
embed = discord.Embed(description=description, color=0x428bca, type="rich")
|
||||
embed.set_author(name="Hello! I'm {}".format(client.user.name), icon_url=client.user.default_avatar_url)
|
||||
await client.send_message(message.channel, embed=embed)
|
||||
await client.send_message(message.channel, embed=help_methods.get_help_embed(client))
|
||||
|
||||
if message.content.startswith('!homepage'):
|
||||
await client.send_message(
|
||||
|
@ -102,21 +102,37 @@ def get_help_message(method):
|
||||
],
|
||||
}
|
||||
|
||||
# Print out every help method
|
||||
if method == 'show_all':
|
||||
commands = ''
|
||||
for key in supported_methods:
|
||||
commands += ('`' + key + '`') + ', '
|
||||
message = commands[:-2]
|
||||
|
||||
else:
|
||||
# Join key : value of the help method they passed in
|
||||
message = "```css\n{} : {}\n```".format(method, ' '.join(supported_methods[method]))
|
||||
return message
|
||||
return "```css\n{} : {}\n```".format(method, ' '.join(supported_methods[method]))
|
||||
|
||||
def get_help_embed(client):
|
||||
categories = {
|
||||
'fun': ['8ball', 'clap', 'decide', 'dog', 'excuse', 'greentext', 'lewd', 'wallpaper', 'message', 'homepage', 'weather', 'pout', 'smug', 'stock', 'tts'],
|
||||
'users': ['help', 'purge', 'roles', 'source'],
|
||||
'docker': ['docker', 'minecraft'],
|
||||
'admin': ['emoji']
|
||||
}
|
||||
|
||||
description = "\nBelow you can see all the commands I know.\n\n**Have a nice day!**"
|
||||
embed = discord.Embed(description=description, color=0x428bca, type="rich")
|
||||
embed.set_author(name="Hello! I'm {}".format(client.user.name), icon_url=client.user.default_avatar_url)
|
||||
|
||||
for category in categories:
|
||||
|
||||
temp = ''
|
||||
for command in categories[category]:
|
||||
temp += '`' + command + '`' + ', '
|
||||
temp = temp[:-2]
|
||||
embed.add_field(name=str(category).upper(), value=temp)
|
||||
|
||||
description2 = "**Use `!help <Command>` for more information about a command.** \n\n" + \
|
||||
"**Examples:** \n `!help dog` for detailed help for the dog command \n\n" + \
|
||||
"**Useful links:** [Support Server](http://discordapp.com), [Twitter](http://twitter.com)"
|
||||
|
||||
embed.add_field(name="\u200b", value=description2, inline=False)
|
||||
return embed
|
||||
|
||||
def parse_message(message):
|
||||
method = 'show_all'
|
||||
if len(message.split()) > 1:
|
||||
method = message.split()[1]
|
||||
try:
|
||||
explanation = get_help_message(method)
|
||||
|
Loading…
x
Reference in New Issue
Block a user