Praxis_Bot/commands/implemented/command_help.py
2021-04-16 04:38:07 -04:00

49 lines
1.6 KiB
Python

from abc import ABCMeta
import help_module
from commands.command_base import AbstractCommand
import random
import utilities_script as utilities
class Command_Help(AbstractCommand, metaclass=ABCMeta):
"""
this is the help command.
"""
command = "help"
def __init__(self):
super().__init__(Command_Help.command, n_args=5, command_type=AbstractCommand.CommandType.Praxis)
self.help = ["This is a command to learn more about other commands.",
"\nExample:","help \"COMMAND\""]
self.isCommandEnabled = True
self.blockDecor = "\n================================================================\n"
def do_command(self, bot, user_message):
tempBool = True
if tempBool == True:
tempParsedMessage = user_message.message.split(" ")
i = len(tempParsedMessage)
if i > 1:
targetCommand = bot.commands[tempParsedMessage[1]]
helper = help_module.Help_Module_.help_command_response(targetCommand, help_module.help_command_responseType.fancy)
returnMessage = "\n" + helper.response
bot.return_message(returnMessage)
elif i == 1:
commandsList = "\n" + self.blockDecor + "Commands List:" + self.blockDecor + self.GetCommandsList(bot) + self.blockDecor
bot.return_message(commandsList)
def GetCommandsList(self, bot):
commandsList = ""
i = 0
for cmd in bot.commands:
commandsList = commandsList + cmd + "\n"
return commandsList
def get_help(self):
return self.help