Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/core/decorator.py

26 lines
749 B
Python
Raw Normal View History

2021-07-06 18:00:26 +00:00
from typing import Union, Coroutine, Optional
2021-07-09 09:35:23 +00:00
from .elements import Module
from .loader import ModulesManager
2021-07-06 18:00:26 +00:00
def command(
2021-07-07 16:00:24 +00:00
bind_prefix,
alias=None,
help_doc='',
need_self_process=False,
is_admin_function=False,
is_base_function=False,
is_superuser_function=False,
autorun=False
2021-07-06 18:00:26 +00:00
):
2021-07-07 16:00:24 +00:00
def decorator(function):
2021-07-09 09:35:23 +00:00
plugin = Module(function,
2021-07-07 16:00:24 +00:00
bind_prefix,
alias,
help_doc,
need_self_process,
is_admin_function,
is_base_function,
is_superuser_function,
autorun)
2021-07-09 09:35:23 +00:00
ModulesManager.add_plugin(plugin)
2021-07-06 18:00:26 +00:00
return decorator