Archived
1
0
Fork 0
This commit is contained in:
yzhh 2021-10-17 01:01:41 +08:00
parent dadd6b82fe
commit 4b64c00e18
3 changed files with 5 additions and 10 deletions

View file

@ -20,8 +20,7 @@ def on_command(
developers: Union[str, list, tuple] = None,
need_admin: bool = False,
is_base_function: bool = False,
need_superuser: bool = False,
autorun: bool = False
need_superuser: bool = False
):
"""
@ -36,7 +35,6 @@ def on_command(
:param need_admin: 此命令是否需要群聊管理员权限
:param is_base_function: 将此命令设为基础命令设为基础命令后此命令将被强制开启
:param need_superuser: 将此命令设为机器人的超级管理员才可执行
:param autorun: 将此命令设为自动启动类型设为自动启动类型后将会在机器人运行时自动运行同时禁用命令处理功能
:return: 此类型的模块
"""
@ -51,8 +49,7 @@ def on_command(
developers=developers,
is_base_function=is_base_function,
need_admin=need_admin,
need_superuser=need_superuser,
autorun=autorun)
need_superuser=need_superuser)
ModulesManager.add_module(module)
return module

View file

@ -19,8 +19,7 @@ class Command:
developers: Union[str, list, tuple] = None,
need_admin: bool = False,
is_base_function: bool = False,
need_superuser: bool = False,
autorun: bool = False):
need_superuser: bool = False):
self.function = function
self.bind_prefix = bind_prefix
self.alias = alias
@ -32,7 +31,6 @@ class Command:
self.need_admin = need_admin
self.is_base_function = is_base_function
self.need_superuser = need_superuser
self.autorun = autorun
class RegexCommand:

View file

@ -2,14 +2,14 @@ import ujson as json
from core.dirty_check import check
from core.elements import FetchTarget
from core.decorator import on_command
from core.decorator import on_startup
from core.logger import Logger
from core.scheduler import Scheduler
from core.utils import get_url
from modules.utils.UTC8 import UTC8
@on_command('__check_newbie__', need_superuser=True, developers=['OasisAkari'], autorun=True)
@on_startup('__check_newbie__', need_superuser=True, developers=['OasisAkari'])
async def newbie(bot: FetchTarget):
Logger.info('Subbot newbie launched')
url = 'https://minecraft.fandom.com/zh/api.php?action=query&list=logevents&letype=newusers&format=json'