breaking change: alias system;don't use while True in the mcv rss check
rename 'wiki_regex' module to 'wiki_inline' port 'wiki_regex' to 'wiki_inline' port 'enable' to 'module enable' port 'disable' to 'module disable' port 'w' to 'wiki' port 'u' to 'user' port 'p' to 'ping' port 's' to 'server' rewrite 'enable' help rewrite 'disable' help new command parser comming soon.
This commit is contained in:
parent
a991e0a05a
commit
c4723fbcd2
9 changed files with 114 additions and 174 deletions
|
@ -76,38 +76,32 @@ async def parser(kwargs: dict):
|
|||
await sendMessage(kwargs, '你不是本机器人的超级管理员,最多只能并排执行5个命令。')
|
||||
return
|
||||
for command in command_list:
|
||||
command_first_word = command.split(' ')[0] # 切割消息
|
||||
command_spilt = command.split(' ') # 切割消息
|
||||
try:
|
||||
kwargs['trigger_msg'] = command # 触发该命令的消息,去除消息前缀
|
||||
kwargs['bot_modules'] = Modules
|
||||
command_first_word = command_spilt[0]
|
||||
if command_first_word in Modules['alias']:
|
||||
command_spilt[0] = Modules['alias'][command_first_word]
|
||||
command = ' '.join(command_spilt)
|
||||
command_spilt = command.split(' ')
|
||||
command_first_word = command_spilt[0]
|
||||
kwargs['trigger_msg'] = command
|
||||
if command_first_word in Modules['command']: # 检查触发命令是否在模块列表中
|
||||
if Group in kwargs:
|
||||
await Nudge(kwargs)
|
||||
check_command_enable = database.check_enable_modules(kwargs[Group].id,
|
||||
command_first_word) # 检查群组是否开启模块
|
||||
if check_command_enable: # 若开启
|
||||
kwargs['trigger_msg'] = command # 触发该命令的消息,去除消息前缀
|
||||
kwargs['help_list'] = Modules['help'] # 帮助列表
|
||||
await Modules['command'][command_first_word](kwargs) # 将dict传入下游模块
|
||||
else:
|
||||
if not check_command_enable: # 若未开启
|
||||
await sendMessage(kwargs, f'此模块未启用,请管理员在群内发送~enable {command_first_word}启用本模块。')
|
||||
elif 'TEST' in kwargs:
|
||||
kwargs['trigger_msg'] = command # 触发该命令的消息,去除消息前缀
|
||||
kwargs['help_list'] = Modules['help'] # 帮助列表
|
||||
await Modules['command'][command_first_word](kwargs) # 将dict传入下游模块
|
||||
else:
|
||||
kwargs['trigger_msg'] = command
|
||||
kwargs['help_list'] = Modules['help']
|
||||
await Modules['command'][command_first_word](kwargs)
|
||||
return
|
||||
await Modules['command'][command_first_word](kwargs) # 将dict传入下游模块
|
||||
elif command_first_word in Modules['essential']: # 若触发的对象命令为基础命令
|
||||
await Nudge(kwargs)
|
||||
kwargs['trigger_msg'] = command
|
||||
kwargs['function_list'] = Modules['modules_function'] # 所有可用模块列表
|
||||
kwargs['friend_function_list'] = Modules['friend_modules_function']
|
||||
kwargs['help_list'] = Modules['help']
|
||||
if Group in kwargs:
|
||||
await Nudge(kwargs)
|
||||
await Modules['essential'][command_first_word](kwargs)
|
||||
elif command_first_word in Modules['admin']: # 若触发的对象为超管命令
|
||||
if database.check_superuser(kwargs): # 检查是否为超管
|
||||
kwargs['trigger_msg'] = command
|
||||
kwargs['function_list'] = Modules['modules_function']
|
||||
await Modules['admin'][command_first_word](kwargs)
|
||||
else:
|
||||
await sendMessage(kwargs, '权限不足')
|
||||
|
|
|
@ -26,9 +26,6 @@ class BB:
|
|||
c.execute('''CREATE TABLE group_permission
|
||||
(ID INT PRIMARY KEY NOT NULL,
|
||||
ENABLE_MODULES TEXT);''')
|
||||
c.execute('''CREATE TABLE self_permission
|
||||
(ID INT PRIMARY KEY NOT NULL,
|
||||
DISABLE_MODULES TEXT);''')
|
||||
c.execute('''CREATE TABLE friend_permission
|
||||
(ID INT PRIMARY KEY NOT NULL,
|
||||
ENABLE_MODULES TEXT);''')
|
||||
|
@ -53,7 +50,7 @@ class BB:
|
|||
|
||||
def update_modules(self, do, id, modules_name, table='group_permission', value='ENABLE_MODULES'):
|
||||
a = self.c.execute(f"SELECT * FROM {table} WHERE ID={id}").fetchone()
|
||||
if do == 'add':
|
||||
if do == 'enable':
|
||||
if a:
|
||||
enabled_split = a[1].split('|')
|
||||
if modules_name in enabled_split:
|
||||
|
@ -67,7 +64,7 @@ class BB:
|
|||
self.c.execute(f"INSERT INTO {table} (ID, {value}) VALUES (?, ?)", (id, modules_name))
|
||||
self.conn.commit()
|
||||
return '成功:启用模块:' + modules_name
|
||||
elif do == 'del':
|
||||
elif do == 'disable':
|
||||
if a:
|
||||
enabled_split = a[1].split('|')
|
||||
if modules_name in enabled_split:
|
||||
|
@ -100,7 +97,6 @@ class BB:
|
|||
else:
|
||||
return False
|
||||
|
||||
|
||||
def check_enable_modules_all(self, table, modules_name):
|
||||
# 检查表中所有匹配的对象,返回一个list
|
||||
enable_target = []
|
||||
|
|
|
@ -4,13 +4,24 @@ import sqlite3
|
|||
dbpath = os.path.abspath('./database/save.db')
|
||||
conn = sqlite3.connect(dbpath)
|
||||
c = conn.cursor()
|
||||
a = c.execute(f"ALTER TABLE group_adminuser RENAME TO group_adminuser_old")
|
||||
c.execute('''CREATE TABLE group_adminuser
|
||||
(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
TID INT,
|
||||
TGROUP INT);''')
|
||||
t = c.execute(f"SELECT * FROM group_adminuser_old").fetchall()
|
||||
for x in t:
|
||||
c.execute(f"INSERT INTO group_adminuser (TID, TGROUP) VALUES (?, ?)", x)
|
||||
conn.commit()
|
||||
c.close()
|
||||
a = c.execute(f"SELECT * FROM friend_permission").fetchall()
|
||||
for x in a:
|
||||
enabled_split = x[1].split('|')
|
||||
mv = {'mcv_rss_self': 'mcv_rss', 'mcv_jira_rss_self': 'mcv_jira_rss'}
|
||||
for y in mv:
|
||||
if y in enabled_split:
|
||||
enabled_split.remove(y)
|
||||
enabled_split.append(mv[y])
|
||||
c.execute("UPDATE friend_permission SET ENABLE_MODULES=? WHERE ID=?", ('|'.join(enabled_split), x[0]))
|
||||
conn.commit()
|
||||
|
||||
a = c.execute(f"SELECT * FROM group_permission").fetchall()
|
||||
for x in a:
|
||||
enabled_split = x[1].split('|')
|
||||
mv = {'wiki_regex': 'wiki_inline'}
|
||||
for y in mv:
|
||||
if y in enabled_split:
|
||||
enabled_split.remove(y)
|
||||
enabled_split.append(mv[y])
|
||||
c.execute("UPDATE group_permission SET ENABLE_MODULES=? WHERE ID=?", ('|'.join(enabled_split), x[0]))
|
||||
conn.commit()
|
|
@ -7,124 +7,62 @@ from core.template import check_permission, revokeMessage
|
|||
from .admin import *
|
||||
|
||||
|
||||
async def enable_modules(kwargs: dict):
|
||||
async def config_modules(kwargs: dict):
|
||||
"""
|
||||
~enable [self] <modules/all>"""
|
||||
~module <enable/disable> <module/all>"""
|
||||
command = kwargs['trigger_msg'].split(' ')
|
||||
function_list = kwargs['function_list']
|
||||
friend_function_list = kwargs['friend_function_list']
|
||||
if not len(command) > 1:
|
||||
await sendMessage(kwargs, '命令格式错误。' + enable_modules.__doc__)
|
||||
bot_modules = kwargs['bot_modules']
|
||||
function_list = bot_modules['modules_function']
|
||||
friend_function_list = bot_modules['friend_modules_function']
|
||||
alias_list = bot_modules['alias']
|
||||
msg = '命令格式错误。' + config_modules.__doc__
|
||||
if not len(command) > 2:
|
||||
await sendMessage(kwargs, msg)
|
||||
return
|
||||
command_second_word = command[1]
|
||||
do = command[1]
|
||||
command_third_word = command[2]
|
||||
if command_third_word in alias_list:
|
||||
command_third_word = alias_list[command_third_word]
|
||||
if Group in kwargs:
|
||||
if command_second_word == 'self':
|
||||
if not len(command) > 2:
|
||||
await sendMessage(kwargs, '命令格式错误。' + enable_modules.__doc__)
|
||||
return
|
||||
command_third_word = command[2]
|
||||
if command_third_word in function_list:
|
||||
msg = database.update_modules_self('add', kwargs[Member].id, command_third_word)
|
||||
await sendMessage(kwargs, msg)
|
||||
else:
|
||||
await sendMessage(kwargs, '此模块不存在。')
|
||||
elif command_second_word == 'all':
|
||||
if check_permission(kwargs):
|
||||
msglist = []
|
||||
for function in function_list:
|
||||
msg = database.update_modules('add', kwargs[Group].id, function)
|
||||
msglist.append(msg)
|
||||
await sendMessage(kwargs, '\n'.join(msglist))
|
||||
else:
|
||||
await sendMessage(kwargs, '你没有使用该命令的权限。')
|
||||
elif command_second_word in function_list:
|
||||
if check_permission(kwargs):
|
||||
msg = database.update_modules('add', kwargs[Group].id, command_second_word)
|
||||
await sendMessage(kwargs, msg)
|
||||
else:
|
||||
await sendMessage(kwargs, '你没有使用该命令的权限。')
|
||||
if not check_permission(kwargs):
|
||||
await sendMessage(kwargs, '你没有使用该命令的权限。')
|
||||
return
|
||||
if command_third_word == 'all':
|
||||
msglist = []
|
||||
for function in function_list:
|
||||
msg = database.update_modules(do, kwargs[Group].id, function)
|
||||
msglist.append(msg)
|
||||
msg = '\n'.join(msglist)
|
||||
elif command_third_word in function_list:
|
||||
msg = database.update_modules(do, kwargs[Group].id, command_third_word)
|
||||
else:
|
||||
msgchain = MessageChain.create([Plain('此模块不存在。')])
|
||||
await sendMessage(kwargs, msgchain)
|
||||
msg = '此模块不存在。'
|
||||
elif Friend in kwargs:
|
||||
if command_second_word == 'self':
|
||||
if not len(command) > 2:
|
||||
await sendMessage(kwargs, '命令格式错误。' + enable_modules.__doc__)
|
||||
return
|
||||
command_second_word = command[2]
|
||||
do = 'add'
|
||||
if command_second_word in friend_function_list:
|
||||
msg = database.update_modules(do, kwargs[Friend].id, command_second_word, table='friend_permission')
|
||||
await sendMessage(kwargs, msg)
|
||||
if command_third_word in friend_function_list:
|
||||
msg = database.update_modules(do, kwargs[Friend].id, command_third_word, table='friend_permission')
|
||||
else:
|
||||
await sendMessage(kwargs, '此模块不存在。')
|
||||
msg = '此模块不存在。'
|
||||
await sendMessage(kwargs, msg)
|
||||
|
||||
|
||||
async def disable_modules(kwargs: dict):
|
||||
"""
|
||||
~disable [self] <modules/all>"""
|
||||
command = kwargs['trigger_msg'].split(' ')
|
||||
if not len(command) > 1:
|
||||
await sendMessage(kwargs, '命令格式错误。' + disable_modules.__doc__)
|
||||
return
|
||||
function_list = kwargs['function_list']
|
||||
friend_function_list = kwargs['friend_function_list']
|
||||
command_second_word = command[1]
|
||||
if Group in kwargs:
|
||||
if command_second_word == 'self':
|
||||
if not len(command) > 2:
|
||||
await sendMessage(kwargs, '命令格式错误。' + disable_modules.__doc__)
|
||||
return
|
||||
command_third_word = command[2]
|
||||
if command_third_word in function_list:
|
||||
msg = database.update_modules_self('del', kwargs[Member].id, command_third_word)
|
||||
await sendMessage(kwargs, msg)
|
||||
else:
|
||||
await sendMessage(kwargs, '此模块不存在。')
|
||||
elif command_second_word == 'all':
|
||||
if check_permission(kwargs):
|
||||
msglist = []
|
||||
for function in function_list:
|
||||
msg = database.update_modules('del', kwargs[Group].id, function)
|
||||
msglist.append(msg)
|
||||
await sendMessage(kwargs, '\n'.join(msglist))
|
||||
else:
|
||||
await sendMessage(kwargs, '你没有使用该命令的权限。')
|
||||
elif command_second_word in function_list:
|
||||
if check_permission(kwargs):
|
||||
msg = database.update_modules('del', kwargs[Group].id, command_second_word)
|
||||
await sendMessage(kwargs, msg)
|
||||
else:
|
||||
await sendMessage(kwargs, '你没有使用该命令的权限。')
|
||||
else:
|
||||
await sendMessage(kwargs, '此模块不存在。')
|
||||
elif Friend in kwargs:
|
||||
if command_second_word == 'self':
|
||||
if not len(command) > 2:
|
||||
await sendMessage(kwargs, '命令格式错误。' + disable_modules.__doc__)
|
||||
return
|
||||
command_second_word = command[2]
|
||||
do = 'del'
|
||||
if command_second_word in friend_function_list:
|
||||
msg = database.update_modules(do, kwargs[Friend].id, command_second_word, table='friend_permission')
|
||||
await sendMessage(kwargs, msg)
|
||||
else:
|
||||
await sendMessage(kwargs, '此模块不存在。')
|
||||
|
||||
|
||||
async def bot_help(kwargs: dict):
|
||||
help_list = kwargs['help_list']
|
||||
help_list = kwargs['bot_modules']['help']
|
||||
alias = kwargs['bot_modules']['alias']
|
||||
command = kwargs['trigger_msg'].split(' ')
|
||||
try:
|
||||
if len(command) > 1:
|
||||
msg = []
|
||||
if command[1] in help_list:
|
||||
msg.append(help_list[command[1]]['help'])
|
||||
help_name = command[1]
|
||||
if help_name in alias:
|
||||
help_name = alias[help_name].split(' ')[0]
|
||||
if help_name in help_list:
|
||||
msg.append(help_list[help_name]['help'])
|
||||
for x in help_list:
|
||||
if 'depend' in help_list[x]:
|
||||
if help_list[x]['depend'] == command[1]:
|
||||
if help_list[x]['depend'] == help_name:
|
||||
msg.append(help_list[x]['help'])
|
||||
await sendMessage(kwargs, '\n'.join(msg))
|
||||
except:
|
||||
else:
|
||||
print(help_list)
|
||||
help_msg = []
|
||||
help_msg.append('基础命令:')
|
||||
|
@ -145,7 +83,7 @@ async def bot_help(kwargs: dict):
|
|||
module.append(x)
|
||||
help_msg.append(' | '.join(module))
|
||||
print(help_msg)
|
||||
help_msg.append('使用~help <对应模块名>查看详细信息。\n你也可以通过查阅文档获取帮助:\nhttps://bot.teahou.se/modules/')
|
||||
help_msg.append('使用~help <对应模块名>查看详细信息。\n使用~modules查看所有的可用模块。\n你也可以通过查阅文档获取帮助:\nhttps://bot.teahou.se/modules/')
|
||||
if Group in kwargs:
|
||||
help_msg.append('[本消息将在一分钟后撤回]')
|
||||
send = await sendMessage(kwargs, '\n'.join(help_msg))
|
||||
|
@ -155,7 +93,7 @@ async def bot_help(kwargs: dict):
|
|||
|
||||
|
||||
async def modules_help(kwargs: dict):
|
||||
help_list = kwargs['help_list']
|
||||
help_list = kwargs['bot_modules']['help']
|
||||
help_msg = []
|
||||
help_msg.append('当前可用的模块有:')
|
||||
module = []
|
||||
|
@ -194,12 +132,12 @@ async def config_gu(kwargs):
|
|||
await sendMessage(kwargs, database.del_group_adminuser(command[2], kwargs[Group].id))
|
||||
|
||||
|
||||
essential = {'enable': enable_modules, 'disable': disable_modules, 'add_base_su': add_base_su, 'help': bot_help,
|
||||
essential = {'module': config_modules, 'add_base_su': add_base_su, 'help': bot_help,
|
||||
'modules': modules_help, 'version': bot_version, 'admin_user': config_gu}
|
||||
|
||||
admin = {'add_su': add_su, 'del_su': del_su, 'set': set_modules, 'restart': restart_bot, 'update': update_bot,
|
||||
'echo': echo_msg, 'update&restart': update_and_restart_bot}
|
||||
help = {'enable': {'help': '~enable <模块名> - 开启一个模块', 'essential': True},
|
||||
'disable': {'help': '~disable <模块名> - 关闭一个模块', 'essential': True},
|
||||
'module': {'help': '~modules - 查询所有可用模块。'},
|
||||
help = {'module': {'help': '~module <enable/disable> <模块名> - 开启/关闭一个模块', 'essential': True},
|
||||
'modules': {'help': '~modules - 查询所有可用模块。'},
|
||||
'admin_user': {'help': '~admin_user <add/del> <QQ> - 配置群内成员为机器人管理员(无需设置其为群内管理员)'}}
|
||||
|
||||
alias = {'enable': 'module enable', 'disable': 'module disable'}
|
||||
|
|
|
@ -4,14 +4,19 @@ import re
|
|||
import traceback
|
||||
|
||||
import aiohttp
|
||||
from graia.scheduler import GraiaScheduler
|
||||
from graia.scheduler.timers import every_minute
|
||||
from graia.application import MessageChain
|
||||
from graia.application.message.elements.internal import Plain
|
||||
|
||||
from core.loader import logger_info
|
||||
from core.broadcast import bcc
|
||||
from database import BotDB
|
||||
from modules.mcv.mcv import get_data
|
||||
|
||||
|
||||
check_enable_modules_all = BotDB.check_enable_modules_all
|
||||
scheduler = GraiaScheduler(bcc.loop, bcc)
|
||||
|
||||
|
||||
def getfileversions(path):
|
||||
|
@ -24,9 +29,9 @@ def getfileversions(path):
|
|||
return s
|
||||
|
||||
async def mcv_rss(app):
|
||||
url = 'http://launchermeta.mojang.com/mc/game/version_manifest.json'
|
||||
logger_info('Subbot ver launched')
|
||||
while True:
|
||||
@scheduler.schedule(every_minute())
|
||||
async def java_main():
|
||||
url = 'http://launchermeta.mojang.com/mc/game/version_manifest.json'
|
||||
try:
|
||||
version_file = os.path.abspath('./assets/mcversion.txt')
|
||||
logger_info('Checking mcv...')
|
||||
|
@ -43,7 +48,7 @@ async def mcv_rss(app):
|
|||
await asyncio.sleep(0.5)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_rss_self'):
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_rss'):
|
||||
try:
|
||||
await app.sendFriendMessage(int(qqfriend), MessageChain.create(
|
||||
[Plain('启动器已更新' + file['latest']['release'] + '正式版。')]))
|
||||
|
@ -63,7 +68,7 @@ async def mcv_rss(app):
|
|||
await asyncio.sleep(0.5)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_rss_self'):
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_rss'):
|
||||
try:
|
||||
await app.sendFriendMessage(int(qqfriend), MessageChain.create(
|
||||
[Plain('启动器已更新' + file['latest']['snapshot'] + '快照。')]))
|
||||
|
@ -74,16 +79,14 @@ async def mcv_rss(app):
|
|||
addversion.write('\n' + snapshot)
|
||||
addversion.close()
|
||||
logger_info('mcv checked.')
|
||||
await asyncio.sleep(40)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
await asyncio.sleep(20)
|
||||
|
||||
|
||||
async def mcv_jira_rss(app):
|
||||
url = 'https://bugs.mojang.com/rest/api/2/project/10400/versions'
|
||||
logger_info('Subbot jira launched')
|
||||
while True:
|
||||
@scheduler.schedule(every_minute())
|
||||
async def java_jira():
|
||||
url = 'https://bugs.mojang.com/rest/api/2/project/10400/versions'
|
||||
try:
|
||||
version_file = os.path.abspath('./assets/mcversion_jira.txt')
|
||||
logger_info('Checking Jira mcv...')
|
||||
|
@ -103,7 +106,7 @@ async def mcv_jira_rss(app):
|
|||
await asyncio.sleep(0.5)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_jira_rss_self'):
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_jira_rss'):
|
||||
try:
|
||||
await app.sendFriendMessage(int(qqfriend), MessageChain.create(
|
||||
[Plain(f'Jira已更新Java版{x}。\n(Jira上的信息仅作版本号预览用,不代表启动器已更新此版本)')]))
|
||||
|
@ -114,16 +117,14 @@ async def mcv_jira_rss(app):
|
|||
addversion.write('\n' + x)
|
||||
addversion.close()
|
||||
logger_info('jira mcv checked.')
|
||||
await asyncio.sleep(40)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
await asyncio.sleep(20)
|
||||
|
||||
|
||||
async def mcv_jira_rss_bedrock(app):
|
||||
url = 'https://bugs.mojang.com/rest/api/2/project/10200/versions'
|
||||
logger_info('Subbot jira-bedrock launched')
|
||||
while True:
|
||||
@scheduler.schedule(every_minute())
|
||||
async def bedrock_jira():
|
||||
url = 'https://bugs.mojang.com/rest/api/2/project/10200/versions'
|
||||
try:
|
||||
version_file = os.path.abspath('./assets/mcversion_jira-bedrock.txt')
|
||||
logger_info('Checking Jira mcv-bedrock...')
|
||||
|
@ -143,7 +144,7 @@ async def mcv_jira_rss_bedrock(app):
|
|||
await asyncio.sleep(0.5)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_jira_rss_self'):
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_jira_rss'):
|
||||
try:
|
||||
await app.sendFriendMessage(int(qqfriend), MessageChain.create(
|
||||
[Plain(f'Jira已更新基岩版{x}。\n(Jira上的信息仅作版本号预览用,不代表商店已更新此版本)')]))
|
||||
|
@ -154,16 +155,14 @@ async def mcv_jira_rss_bedrock(app):
|
|||
addversion.write('\n' + x)
|
||||
addversion.close()
|
||||
logger_info('jira mcv-bedrock checked.')
|
||||
await asyncio.sleep(90)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
await asyncio.sleep(20)
|
||||
|
||||
|
||||
async def mcv_jira_rss_dungeons(app):
|
||||
url = 'https://bugs.mojang.com/rest/api/2/project/11901/versions'
|
||||
logger_info('Subbot jira-dungeons launched')
|
||||
while True:
|
||||
@scheduler.schedule(every_minute())
|
||||
async def bedrock_dungeons():
|
||||
url = 'https://bugs.mojang.com/rest/api/2/project/11901/versions'
|
||||
try:
|
||||
version_file = os.path.abspath('./assets/mcversion_jira-dungeons.txt')
|
||||
logger_info('Checking Jira mcv-bedrock...')
|
||||
|
@ -183,7 +182,7 @@ async def mcv_jira_rss_dungeons(app):
|
|||
await asyncio.sleep(0.5)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_jira_rss_self'):
|
||||
for qqfriend in check_enable_modules_all('friend_permission', 'mcv_jira_rss'):
|
||||
try:
|
||||
await app.sendFriendMessage(int(qqfriend), MessageChain.create(
|
||||
[Plain(f'Jira已更新Dungeons {x}。\n(Jira上的信息仅作版本号预览用,不代表启动器已更新此版本)')]))
|
||||
|
@ -194,14 +193,13 @@ async def mcv_jira_rss_dungeons(app):
|
|||
addversion.write('\n' + x)
|
||||
addversion.close()
|
||||
logger_info('jira mcv-dungeons checked.')
|
||||
await asyncio.sleep(90)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
await asyncio.sleep(20)
|
||||
|
||||
|
||||
rss = {'mcv_rss': mcv_rss, 'mcv_jira_rss': mcv_jira_rss, 'mcv_bedrock_jira_rss': mcv_jira_rss_bedrock, 'mcv_dungeons_jira_rss': mcv_jira_rss_dungeons}
|
||||
options = ['mcv_rss', 'mcv_jira_rss']
|
||||
friend_options = ['mcv_rss_self', 'mcv_jira_rss_self']
|
||||
friend_options = options
|
||||
alias = {'mcv_rss_self': 'mcv_rss', 'mcv_jira_rss_self': 'mcv_jira_rss'}
|
||||
help = {'mcv_rss': {'help': '订阅Minecraft Java版游戏版本检测。'},
|
||||
'mcv_jira_rss': {'help': '订阅Minecraft Java版游戏版本检测(Jira记录,仅作预览用)。'}}
|
||||
|
|
|
@ -36,5 +36,6 @@ async def s(kwargs, message, raw, showplayer, mode):
|
|||
|
||||
|
||||
command = {'server': main}
|
||||
alias = {'s': 'server'}
|
||||
help = {'server': {
|
||||
'help': '~server <服务器地址>:<服务器端口> - 获取Minecraft Java/基岩版服务器motd。'}}
|
||||
|
|
|
@ -55,6 +55,7 @@ async def main(kwargs: dict):
|
|||
|
||||
|
||||
command = {'user': main}
|
||||
alias = {'u': 'user'}
|
||||
help = {'user': {
|
||||
'help': '~user [~(wiki_name)] <username> - 获取一个Gamepedia用户的信息。' +
|
||||
'\n[-r] - 获取详细信息' +
|
||||
|
|
|
@ -79,6 +79,7 @@ async def ping(kwargs: dict):
|
|||
|
||||
command = {'rc': rc_loader, 'ab': ab_loader, 'newbie': newbie_loader}
|
||||
essential = {'ping': ping}
|
||||
alias = {'p': 'ping'}
|
||||
help = {'rc': {'help': '~rc - 查询Wiki最近更改。'},
|
||||
'ab': {'help': '~ab - 查询Wiki滥用过滤器日志。'},
|
||||
'newbie': {'help': '~newbie - 查询Wiki用户注册日志。'},
|
||||
|
|
|
@ -276,8 +276,8 @@ async def regex_proc(kwargs: dict, display, nudge=True):
|
|||
|
||||
|
||||
command = {'wiki': wiki_loader, 'wiki_start_site': set_start_wiki, 'interwiki': interwiki}
|
||||
regex = {'wiki_regex': regex_wiki}
|
||||
alias = {'wiki_inline': 'wiki_regex'}
|
||||
regex = {'wiki_inline': regex_wiki}
|
||||
alias = {'wiki_regex': 'wiki_inline', 'w': 'wiki'}
|
||||
options = ['wiki_fandom_addon']
|
||||
self_options = options
|
||||
help = {'wiki': {'help': '~wiki [interwiki:]<page_name> - 查询Wiki内容。\n' +
|
||||
|
@ -287,6 +287,6 @@ help = {'wiki': {'help': '~wiki [interwiki:]<page_name> - 查询Wiki内容。\n'
|
|||
'wiki_start_site': {'help': '~wiki_start_site <api_endpoint_link> - 设置起始查询Wiki。'},
|
||||
'interwiki': {
|
||||
'help': '~interwiki <add/del> <interwiki> <wikiurl> - 设置自定义Interwiki跨站查询。'},
|
||||
'wiki_regex': {'help': '[[<page_name>]]|{{<page_name>}} - 当聊天中出现此种Wikitext时进行自动查询。'},
|
||||
'wiki_inline': {'help': '[[<page_name>]]|{{<page_name>}} - 当聊天中出现此种Wikitext时进行自动查询。'},
|
||||
'wiki_fandom_addon': {
|
||||
'help': '为Fandom定制的Wiki查询功能,包含有[[w:c:<wikiname>:[langcode:]<page_name>]]的消息会自动定向查询至Fandom的Wiki。'}}
|
||||
|
|
Reference in a new issue