Merged in help_method (pull request #6)
creating a new funciton for help methods that we can call from anywhere in the bot
This commit is contained in:
commit
2ba5d1abe9
@ -2,6 +2,7 @@ import random
|
|||||||
import sys
|
import sys
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
import help_methods
|
||||||
import discord
|
import discord
|
||||||
import docker
|
import docker
|
||||||
from pybooru import Danbooru
|
from pybooru import Danbooru
|
||||||
@ -128,25 +129,25 @@ async def on_message(message):
|
|||||||
await client.send_message(message.channel, "`{}`\n```{}```".format(' '.join(word), definition))
|
await client.send_message(message.channel, "`{}`\n```{}```".format(' '.join(word), definition))
|
||||||
|
|
||||||
if message.content.startswith('!help'):
|
if message.content.startswith('!help'):
|
||||||
supported_methods = {
|
|
||||||
'decide': 'Dragon-bot will help make the tough decisions for you\n!decide option 1 or option 2.\n\nIf only one option, it will give you a yes or no',
|
|
||||||
'deine': 'Returns a definiton of a word from urban dictionary\n\nUsage: !define loli',
|
|
||||||
'docker': 'Two supported actions: logs and restart\n\nlogs: Shows you the last X number of lines from the minecraft server. If no number is specified, defaults to 10.\n\nrestart: will restart the minecraft server if something is fucky',
|
|
||||||
'excuse': 'Generates a random excuse you can give your boss',
|
|
||||||
'help': 'Prints out a list of everything dragon-bot can do',
|
|
||||||
'lewd': 'Returns a URL for a lewd image. Can only be used in NSFW channels',
|
|
||||||
'purge': 'Deletes the last 100 messages you sent from the channel you typed purge in',
|
|
||||||
'triggered': 'REEEEEEEEEEEEEEEEEE',
|
|
||||||
'wallpaper': 'Returns the URL for a 4k wallpaper. You can enter a search term as well, for example, !wallpaper, or, !wallpaper flowers',
|
|
||||||
}
|
|
||||||
if len(message.content.split()) > 1:
|
if len(message.content.split()) > 1:
|
||||||
method = message.content.split()[1]
|
method = message.content.split()[1]
|
||||||
if method not in supported_methods.keys():
|
try:
|
||||||
await client.send_message(message.channel, "I cant help you with that")
|
explanation = help_methods.return_help_message(method)
|
||||||
|
except KeyError:
|
||||||
|
await client.send_message(
|
||||||
|
message.channel,
|
||||||
|
"I can't help you with that"
|
||||||
|
)
|
||||||
return
|
return
|
||||||
await client.send_message(message.channel, "```{}```".format(supported_methods[method]))
|
await client.send_message(
|
||||||
|
message.channel,
|
||||||
|
"```{}```".format(explanation)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
await client.send_message(message.channel, "I currently have {} methods,\n\n```{}```\n\nYou can get information about a specific method by typing !help <method>".format(len(supported_methods), ', '.join(supported_methods.keys())))
|
await client.send_message(
|
||||||
|
message.channel,
|
||||||
|
help_methods.return_help_message('show_all')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if 'autis' in message.content or message.content.startswith('!triggered'):
|
if 'autis' in message.content or message.content.startswith('!triggered'):
|
||||||
|
47
help_methods.py
Normal file
47
help_methods.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
def return_help_message(method):
|
||||||
|
supported_methods = {
|
||||||
|
'decide': [
|
||||||
|
'Dragon-bot will help make the tough decisions for you',
|
||||||
|
'\n\n!decide option 1 or option 2.\n\nIf thre is only',
|
||||||
|
'one option, it will give you a yes or no'
|
||||||
|
],
|
||||||
|
'deine': [
|
||||||
|
'Returns a definiton of a word from urban dictionary',
|
||||||
|
'\n\nUsage: !define loli'
|
||||||
|
],
|
||||||
|
'docker': [
|
||||||
|
'Two supported actions: logs and restart\n\nlogs: Shows you the',
|
||||||
|
'last X number of lines from the minecraft server. If no number',
|
||||||
|
'is specified, defaults to 10.\n\nrestart: will restart the min',
|
||||||
|
'ecraft server if something is fucky'
|
||||||
|
],
|
||||||
|
'excuse': [
|
||||||
|
'Generates a random excuse you can give your boss'],
|
||||||
|
'help': [
|
||||||
|
'Prints out a list of everything dragon-bot can do'
|
||||||
|
],
|
||||||
|
'lewd': [
|
||||||
|
'Returns a URL for a lewd image.',
|
||||||
|
'Can only be used in NSFW channels'
|
||||||
|
],
|
||||||
|
'purge': [
|
||||||
|
'Deletes the last 100 messages you sent from the channel you',
|
||||||
|
'typed purge in'
|
||||||
|
],
|
||||||
|
'triggered': [
|
||||||
|
'REEEEEEEEEEEEEEEEEE'],
|
||||||
|
'wallpaper': [
|
||||||
|
'Returns the URL for a 4k wallpaper. You can enter',
|
||||||
|
'a search term as well, for example, !wallpaper, or',
|
||||||
|
', !wallpaper flowers'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if method == 'show_all':
|
||||||
|
count = len(supported_methods)
|
||||||
|
keys = ', '.join(supported_methods.keys())
|
||||||
|
|
||||||
|
message = "I currently have `{}` methods,\n\n```{}```\n\nYou can get in formation about a specific method by typing !help <method>".format(count, keys)
|
||||||
|
else:
|
||||||
|
message = ' '.join(supported_methods[method])
|
||||||
|
return message
|
Loading…
x
Reference in New Issue
Block a user