feat: !help command to look similar to Ayana
This commit is contained in:
parent
fb3b0cfd61
commit
a4e43aa9be
@ -230,11 +230,29 @@ async def on_message(message):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if message.content.startswith('!help'):
|
if message.content.startswith('!help'):
|
||||||
await client.send_message(message.channel, "Sorry {}, But the help command is currently broken. \nIf you'd like to help fix it, take a look at the open issue\nhttp://luker.zzzz.io/gitlab/ldooks/dragon-bot/issues/2".format(message.author.mention))
|
#await client.send_message(message.channel, "Sorry {}, But the help command is currently broken. \nIf you'd like to help fix it, take a look at the open issue\nhttp://luker.zzzz.io/gitlab/ldooks/dragon-bot/issues/2".format(message.author.mention))
|
||||||
# await client.send_message(
|
# await client.send_message(
|
||||||
# message.author,
|
# message.author,
|
||||||
# help_methods.parse_message(message.content)
|
# help_methods.parse_message(message.content)
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
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. \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:**
|
||||||
|
johnbest.me""".format(help_methods.parse_message(message.content))
|
||||||
|
|
||||||
|
embed = discord.Embed(title=None, 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)
|
||||||
|
|
||||||
if message.content.startswith('!homepage'):
|
if message.content.startswith('!homepage'):
|
||||||
await client.send_message(
|
await client.send_message(
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import discord
|
||||||
def get_help_message(method):
|
def get_help_message(method):
|
||||||
"""
|
"""
|
||||||
get_help_message(method)
|
get_help_message(method)
|
||||||
@ -103,17 +104,15 @@ def get_help_message(method):
|
|||||||
|
|
||||||
# Print out every help method
|
# Print out every help method
|
||||||
if method == 'show_all':
|
if method == 'show_all':
|
||||||
# Might be a better way to do this, but build a list of method : description
|
commands = ''
|
||||||
build_message = []
|
for key in supported_methods:
|
||||||
for key, value in supported_methods.items():
|
commands += ('`' + key + '`') + ', '
|
||||||
build_message.append("\n{} : {}\n".format(key, ' '.join(supported_methods[key])))
|
message = commands[:-2]
|
||||||
# Join every element of the list with a space
|
|
||||||
message = ' '.join(build_message)
|
|
||||||
else:
|
else:
|
||||||
# Join key : value of the help method they passed in
|
# Join key : value of the help method they passed in
|
||||||
message = "{} : {}".format(method, ' '.join(supported_methods[method]))
|
message = "```css\n{} : {}\n```".format(method, ' '.join(supported_methods[method]))
|
||||||
|
return message
|
||||||
return "\n{}\n".format(message)
|
|
||||||
|
|
||||||
def parse_message(message):
|
def parse_message(message):
|
||||||
method = 'show_all'
|
method = 'show_all'
|
||||||
@ -122,5 +121,5 @@ def parse_message(message):
|
|||||||
try:
|
try:
|
||||||
explanation = get_help_message(method)
|
explanation = get_help_message(method)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return "I can't help you with that"
|
return "This command could not be found."
|
||||||
return "```css\n{}\n```".format(explanation)
|
return explanation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user