25 lines
769 B
Python
25 lines
769 B
Python
from abc import ABCMeta, abstractmethod
|
|
|
|
|
|
class AbstractCommand(metaclass=ABCMeta):
|
|
"""
|
|
This is the base class for commands. In order to load a command a few conditions must be met:
|
|
1) The class name MUST begin with 'Command' i.e. CommandTTS, CommandBan, etc...
|
|
2) the class MUST extend AbstractCommand
|
|
|
|
Generally, it would be advisable to define the command (something like !so, !tts, !songrequest) as a variable of the
|
|
class and to then call super().__init__(command)
|
|
"""
|
|
def __init__(self, command: str):
|
|
self.command = command
|
|
|
|
def honk(self):
|
|
print("Success! %s" % self.command)
|
|
|
|
def get_command(self) -> str:
|
|
return self.command
|
|
|
|
@abstractmethod
|
|
def do_command(self, fulltext):
|
|
pass
|