diff --git a/CHANGELOG.md b/CHANGELOG.md index ec4ce98..b54bcd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased ### Added - Prefix can now be passed as argument to init +- Pre-made help module ### Fixed - Buggy 'default' cached_property diff --git a/README.md b/README.md index 62d1156..142d880 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ This first part shows the three important variables in any module. def pre_start(self): self.some_var = 'a value needed for working' ``` + The pre_start function is where you define any variables which should be created before any daemons are started or commands are run. I don't recommend overwriting `__init__`, as this might break compatibility with future versions of Frank. diff --git a/frank/frank.py b/frank/frank.py index 90fbe6f..62c52ab 100644 --- a/frank/frank.py +++ b/frank/frank.py @@ -46,7 +46,9 @@ class Frank(discord.Client): self._config = None async def on_ready(self): - """Runs when the bot has succesfully connected to Discord""" + """ + Runs when the bot has succesfully connected to Discord + """ print('Connected') @@ -64,7 +66,9 @@ class Frank(discord.Client): print('All modules loaded') async def stop(self): - """Stop all module daemons and exit.""" + """ + Stop all module daemons and exit. + """ for module in self._loaded_modules: await module.stop() diff --git a/frank/module/module.py b/frank/module/module.py index 2b3e265..5facd13 100644 --- a/frank/module/module.py +++ b/frank/module/module.py @@ -24,17 +24,25 @@ if TYPE_CHECKING: class Module(ModuleMeta): - """Base class for modules; all custom modules should inherit from this.""" + """ + Base class for modules; all custom modules should inherit from this. + """ PREFIX = [] - """Prefix to activate this module.""" + """ + Prefix to activate this module. + """ NAME = '' - """The name is used in various places, such as the config file and the - help function.""" + """ + The name is used in various places, such as the config file and the + help function. + """ HELP = '' - """Short description of the module to use in the help function.""" + """ + Short description of the module to use in the help function. + """ def __init__(self, client: Frank, config: Dict = None): """ @@ -43,6 +51,7 @@ class Module(ModuleMeta): config: dict containing the config for this module (Frank client reads this from the config file). """ + super().__init__() self._client = client @@ -68,7 +77,9 @@ class Module(ModuleMeta): self._tasks.append(task) async def stop(self): - """Stop all tasks for this module.""" + """ + Stop all tasks for this module. + """ for task in self._tasks: task.cancel() diff --git a/setup.py b/setup.py index 55b978a..733b93d 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ setuptools.setup( long_description=long_description, long_description_content_type='text/markdown', url='https://gitlab.com/Chewing_Bever/frank', - packages=setuptools.find_packages(), + packages=setuptools.find_packages(exclude=('tests',)), classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: No Input/Output (Daemon)',