forked from cpssd-students/steely
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelp.py
25 lines (21 loc) · 877 Bytes
/
help.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from formatting import *
from paths import CONFIG
__author__ = 'devoxel'
COMMAND = 'help'
def main(bot, author_id, message, thread_id, thread_type, **kwargs):
def send_message(message):
bot.sendMessage(message, thread_id=thread_id, thread_type=thread_type)
message_parts = message.split()
if not message_parts:
commands = ', '.join((CONFIG.COMMAND_PREFIX + command
for command in bot.plugins.keys()
if command))
send_message(f'available commands: {commands}')
else:
plugin = message_parts[0]
if plugin.startswith(CONFIG.COMMAND_PREFIX):
plugin = plugin[1:]
if not plugin in bot.plugin_helps:
send_message(f'help not found for command {plugin!r}')
return
send_message(code_block(bot.plugin_helps[plugin]))