cleaning up some code and adding missed methods to the help file

This commit is contained in:
Luke Robles 2018-06-21 20:50:29 -07:00
parent c941b892cc
commit d6c14b828e
2 changed files with 30 additions and 18 deletions

View File

@ -231,9 +231,13 @@ async def on_message(message):
if message.content.startswith('!help'):
if len(message.content.split()) > 1:
await client.send_message(message.channel, help_methods.parse_message(message.content))
await client.send_message(
message.channel, help_methods.parse_message(message.content)
)
else:
await client.send_message(message.channel, embed=help_methods.get_help_embed(client))
await client.send_message(
message.channel, embed=help_methods.get_help_embed(client)
)
if message.content.startswith('!homepage'):
await client.send_message(

View File

@ -17,6 +17,14 @@ def get_help_message(method):
'Returns the avatar for the mentioned user',
'\nUsage: !avatar @somebody'
],
'clap': [
'Returns the shittiest meme created by sassy girls on twitter this century',
'Usage: !clap some text to be meme\'mt'
],
'cleanup': [
'Admin use only. Deletes dragon bot\'s messages from the channel',
'Usage: !cleanup'
],
'decide': [
'Dragon-bot will help make the tough decisions for you',
' If there is only one option, it will give you a yes or no',
@ -26,11 +34,10 @@ def get_help_message(method):
'Returns a definiton of a word from urban dictionary',
'\nUsage: !define loli'
],
'docker': [
'Two supported actions: logs and restart\nlogs: Shows you the',
'last X number of lines from the minecraft server. If no number',
' is specified, defaults to 10.\nrestart: will restart the min',
'ecraft server.'
'minecraft': [
'Allows you to interact with the minecraft server.',
'You can do things like !minecraft logs, or !minecraft map',
' or !minecraft status to get information about the server'
],
'dog': [
'Returns the URL to a G O O D B O Y E or G I R L',
@ -53,6 +60,10 @@ def get_help_message(method):
'help': [
'Shows you this message'
],
'invite': [
'Generates a one time use invite to the current channel.',
'Be quick! It expires in 12 hours'
],
'lewd': [
'Returns a URL for a lewd image.',
'Can only be used in NSFW channels.',
@ -102,15 +113,14 @@ def get_help_message(method):
],
}
# Join key : value of the help method they passed in
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']
'fun': ['clap', 'dog', 'excuse', 'greentext', 'lewd', 'message', 'homepage', 'pout', 'smug'],
'util': ['8ball', 'decide', 'wallpaper', 'weather', 'stock', 'tts'],
'users': ['help', 'invite', 'purge', 'roles', 'source', 'minecraft'],
'admin': ['emoji', 'cleanup']
}
description = "\nBelow you can see all the commands I know.\n\n**Have a nice day!**"
@ -118,16 +128,14 @@ def get_help_embed(client):
embed.set_author(name="Hello! I'm {}".format(client.user.name), icon_url=client.user.default_avatar_url)
for category in categories:
temp = ''
command_list = []
for command in categories[category]:
temp += '`' + command + '`' + ', '
temp = temp[:-2]
embed.add_field(name=str(category).upper(), value=temp)
command_list.append("`{}`".format(command))
embed.add_field(name=str(category).upper(), value=','.join(command_list))
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)"
"**Useful links:** [My source code](http://luker.zzzz.io/gitlab/ldooks/dragon-bot), [Server status](http://luker.zzzz.io/status), [Donate](http://luker.zzzz.io/donate)"
embed.add_field(name="\u200b", value=description2, inline=False)
return embed