update issue template
This commit is contained in:
parent
67f773d357
commit
91d44b020d
14 changed files with 45 additions and 39 deletions
|
@ -43,7 +43,7 @@ class MessageSession(MS):
|
|||
if isinstance(msgchain, str):
|
||||
msg = msg + (MessageSegment.text(msgchain if msgchain != '' else
|
||||
'发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。'
|
||||
'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='))
|
||||
'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'))
|
||||
elif isinstance(msgchain, (list, tuple)):
|
||||
count = 0
|
||||
for x in msgchain:
|
||||
|
@ -56,7 +56,7 @@ class MessageSession(MS):
|
|||
count += 1
|
||||
else:
|
||||
msg = msg + MessageSegment.text('发生错误:机器人尝试发送非法消息链,请联系机器人开发者解决问题。'
|
||||
'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=')
|
||||
'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+')
|
||||
Logger.info(f'[Bot] -> [{self.target.targetId}]: {msg}')
|
||||
if self.target.targetFrom == 'QQ|Group':
|
||||
send = await bot.send_group_msg(group_id=self.session.target, message=msg)
|
||||
|
|
|
@ -33,7 +33,7 @@ class MessageSession(MS):
|
|||
return await self.sendMessage('https://wdf.ink/6Oup')
|
||||
if isinstance(msgchain, str):
|
||||
if msgchain == '':
|
||||
msgchain = '发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='
|
||||
msgchain = '发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'
|
||||
send = await bot.send_message(self.session.target, msgchain,
|
||||
reply_to_message_id=self.session.message.message_id if quote and self.session.message else None)
|
||||
elif isinstance(msgchain, (list, tuple)):
|
||||
|
@ -61,7 +61,7 @@ class MessageSession(MS):
|
|||
send.append(send_)
|
||||
count += 1
|
||||
else:
|
||||
msgchain = '发生错误:机器人尝试发送非法消息链,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='
|
||||
msgchain = '发生错误:机器人尝试发送非法消息链,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'
|
||||
send = await bot.send_message(self.session.target, msgchain,
|
||||
reply_to_message_id=self.session.message.message_id if quote and self.session.message else None)
|
||||
return MessageSession(target=MsgInfo(targetId=0, senderId=0, senderName='', targetFrom='Telegram|Bot',
|
||||
|
|
|
@ -33,7 +33,7 @@ class MessageSession(MS):
|
|||
return await self.sendMessage('https://wdf.ink/6Oup')
|
||||
if isinstance(msgchain, str):
|
||||
if msgchain == '':
|
||||
msgchain = '发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='
|
||||
msgchain = '发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'
|
||||
send = await self.session.target.send(msgchain,
|
||||
reference=self.session.message if quote and self.session.message else None)
|
||||
elif isinstance(msgchain, (list, tuple)):
|
||||
|
@ -54,7 +54,7 @@ class MessageSession(MS):
|
|||
send.append(send_)
|
||||
count += 1
|
||||
else:
|
||||
msgchain = '发生错误:机器人尝试发送非法消息链,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='
|
||||
msgchain = '发生错误:机器人尝试发送非法消息链,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'
|
||||
send = await self.session.target.send(msgchain,
|
||||
reference=self.session.message if quote and self.session.message else None)
|
||||
return MessageSession(target=MsgInfo(targetId=0, senderId=0, senderName='', targetFrom='Discord|Bot',
|
||||
|
|
|
@ -63,7 +63,7 @@ async def parser(msg: MessageSession):
|
|||
if senderInfo.query.isInBlockList and not senderInfo.query.isInAllowList or len(display) == 0:
|
||||
return
|
||||
if display[0] in command_prefix: # 检查消息前缀
|
||||
if len(display) <= 1:
|
||||
if len(display) <= 1 or (display[0] == '~' and display[1] == '~'):
|
||||
return
|
||||
Logger.info(
|
||||
f'[{msg.target.senderId}{f" ({msg.target.targetId})" if msg.target.targetFrom != msg.target.senderFrom else ""}] -> [Bot]: {display}')
|
||||
|
@ -124,7 +124,7 @@ async def parser(msg: MessageSession):
|
|||
continue
|
||||
if not module.match_list.set:
|
||||
await msg.sendMessage(f'发生错误:{command_first_word}未绑定任何命令,,请联系开发者处理。'
|
||||
f'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=。')
|
||||
f'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+。')
|
||||
continue
|
||||
none_doc = True
|
||||
for func in module.match_list.get(msg.target.targetFrom):
|
||||
|
@ -158,7 +158,7 @@ async def parser(msg: MessageSession):
|
|||
traceback.print_exc()
|
||||
await msg.sendMessage(
|
||||
f'{command_first_word}模块的帮助信息有误,请联系开发者处理。'
|
||||
f'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=')
|
||||
f'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+')
|
||||
continue
|
||||
else:
|
||||
msg.parsed_msg = None
|
||||
|
@ -177,7 +177,7 @@ async def parser(msg: MessageSession):
|
|||
except Exception as e:
|
||||
Logger.error(traceback.format_exc())
|
||||
await msg.sendMessage('执行命令时发生错误,请报告机器人开发者:\n' + str(
|
||||
e) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=')
|
||||
e) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+')
|
||||
continue
|
||||
ExecutionLockList.remove(msg)
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ class Template(MessageSession):
|
|||
image = True
|
||||
voice = False
|
||||
forward = False
|
||||
delete = True
|
||||
|
||||
async def sendMessage(self, msgchain, quote=True) -> MessageSession:
|
||||
if Secret.find(msgchain):
|
||||
|
|
|
@ -23,7 +23,7 @@ from database.logging_message import LoggerMSG
|
|||
async def msgchain_gen(message) -> MessageChain:
|
||||
if isinstance(message, str):
|
||||
if message == '':
|
||||
message = '发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='
|
||||
message = '发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'
|
||||
msgchain = MessageChain.create([Plain(message)])
|
||||
elif isinstance(message, (list, tuple)):
|
||||
msgchain_list = []
|
||||
|
@ -36,13 +36,13 @@ async def msgchain_gen(message) -> MessageChain:
|
|||
msgchain_list.append(Voice().fromLocalFile(filepath=await slk_converter(x.path)))
|
||||
if not msgchain_list:
|
||||
msgchain_list.append(Plain(
|
||||
'发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='))
|
||||
'发生错误:机器人尝试发送空文本消息,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'))
|
||||
msgchain = MessageChain.create(msgchain_list)
|
||||
elif isinstance(message, MessageChain):
|
||||
msgchain = message
|
||||
else:
|
||||
msgchain = MessageChain.create([Plain(
|
||||
'发生错误:机器人尝试发送非法消息链,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=')])
|
||||
'发生错误:机器人尝试发送非法消息链,请联系机器人开发者解决问题。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+')])
|
||||
return msgchain
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ async def bugtracker_get(MojiraID):
|
|||
print(fields['fixVersions'])
|
||||
FixVersion = fields['fixVersions'][0]['name']
|
||||
else:
|
||||
return '发生错误:获取Json失败。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='
|
||||
return '发生错误:获取Json失败。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'
|
||||
msglist = []
|
||||
if errmsg != '':
|
||||
msglist.append(errmsg)
|
||||
|
|
|
@ -62,5 +62,5 @@ Created {time_diff(result['created_at'])} ago | Updated {time_diff(result['updat
|
|||
path=f'https://opengraph.githubassets.com/c9f4179f4d560950b2355c82aa2b7750bffd945744f9b8ea3f93cc24779745a0/{result["full_name"]}')])
|
||||
except Exception as e:
|
||||
await msg.sendMessage('发生错误:' + str(
|
||||
e) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=')
|
||||
e) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+')
|
||||
traceback.print_exc()
|
||||
|
|
|
@ -27,5 +27,5 @@ async def search(msg: MessageSession):
|
|||
await msg.sendMessage(message)
|
||||
except Exception as error:
|
||||
await msg.sendMessage('发生错误:' + str(
|
||||
error) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=')
|
||||
error) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+')
|
||||
traceback.print_exc()
|
||||
|
|
|
@ -43,5 +43,5 @@ Account Created {time_diff(result['created_at'])} ago | Latest activity {time_di
|
|||
await msg.sendMessage(message)
|
||||
except Exception as error:
|
||||
await msg.sendMessage('发生错误:' + str(
|
||||
error) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=')
|
||||
error) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+')
|
||||
traceback.print_exc()
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import asyncio
|
||||
|
||||
from core.component import on_command
|
||||
from core.component import on_command, on_option
|
||||
from core.dirty_check import check
|
||||
from core.elements import MessageSession
|
||||
from database import BotDBUtil
|
||||
from .server import server
|
||||
|
||||
|
||||
on_option('server_disable_revoke', desc='关闭server命令的自动撤回') # 临时解决方案,后续会改动,归属到toggle命令下
|
||||
|
||||
s = on_command('server', alias='s', developers=['_LittleC_', 'OasisAkari'])
|
||||
|
||||
|
||||
|
@ -12,33 +16,34 @@ s = on_command('server', alias='s', developers=['_LittleC_', 'OasisAkari'])
|
|||
'<ServerIP>:<Port> [-r] {获取Minecraft Java/基岩版服务器motd。(原始信息)}',
|
||||
'<ServerIP>:<Port> [-p] {获取Minecraft Java/基岩版服务器motd。(包括玩家信息)}'])
|
||||
async def main(msg: MessageSession):
|
||||
raw = False
|
||||
showplayer = False
|
||||
if msg.parsed_msg['-r']:
|
||||
raw = True
|
||||
if msg.parsed_msg['-p']:
|
||||
showplayer = True
|
||||
enabled_addon = BotDBUtil.Module(msg).check_target_enabled_module('server_disable_revoke')
|
||||
gather_list = []
|
||||
sm = ['j', 'b']
|
||||
for x in sm:
|
||||
gather_list.append(asyncio.ensure_future(s(msg, f'{msg.parsed_msg["<ServerIP>:<Port>"]}', raw, showplayer, x)))
|
||||
gather_list.append(asyncio.ensure_future(s(
|
||||
msg, f'{msg.parsed_msg["<ServerIP>:<Port>"]}', msg.parsed_msg['-r'], msg.parsed_msg['-p'], x, enabled_addon)))
|
||||
g = await asyncio.gather(*gather_list)
|
||||
if g == ['', '']:
|
||||
send = await msg.sendMessage(
|
||||
'发生错误:没有找到任何类型的Minecraft服务器。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=\n[90秒后撤回消息]')
|
||||
await msg.sleep(90)
|
||||
await send.delete()
|
||||
msg_ = '发生错误:没有找到任何类型的Minecraft服务器。' \
|
||||
'\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'
|
||||
if msg.Feature.delete and not enabled_addon:
|
||||
msg_ += '[90秒后撤回消息]'
|
||||
send = await msg.sendMessage(msg_)
|
||||
if msg.Feature.delete and not enabled_addon:
|
||||
await msg.sleep(90)
|
||||
await send.delete()
|
||||
|
||||
|
||||
async def s(msg: MessageSession, address, raw, showplayer, mode):
|
||||
async def s(msg: MessageSession, address, raw, showplayer, mode, enabled_addon):
|
||||
sendmsg = await server(address, raw, showplayer, mode)
|
||||
if sendmsg != '':
|
||||
sendmsg = await check(sendmsg)
|
||||
for x in sendmsg:
|
||||
m = x['content']
|
||||
if msg.Feature.delete:
|
||||
if msg.Feature.delete and not enabled_addon:
|
||||
m += '\n[90秒后撤回消息]'
|
||||
send = await msg.sendMessage(m)
|
||||
await msg.sleep(90)
|
||||
await send.delete()
|
||||
if msg.Feature.delete and not enabled_addon:
|
||||
await msg.sleep(90)
|
||||
await send.delete()
|
||||
return sendmsg
|
||||
|
|
|
@ -76,7 +76,7 @@ async def server(address, raw=False, showplayer=False, mode='j'):
|
|||
except Exception:
|
||||
traceback.print_exc()
|
||||
servers.append(
|
||||
"[JE]\n发生错误:调用API时发生错误。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=")
|
||||
"[JE]\n发生错误:调用API时发生错误。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+")
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
if raw:
|
||||
|
|
|
@ -231,4 +231,4 @@ async def GetUser(wikiurl, username, argv=None):
|
|||
else:
|
||||
traceback.print_exc()
|
||||
return '发生错误:' + str(
|
||||
e) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='
|
||||
e) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'
|
||||
|
|
|
@ -450,7 +450,7 @@ class wikilib:
|
|||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return {'status': 'done', 'text': '发生错误:' + str(
|
||||
e) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='}
|
||||
e) + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'}
|
||||
|
||||
async def main(self, api_endpoint_link, page_name, interwiki=None, template=False, headers=None, tryiw=0):
|
||||
print(api_endpoint_link)
|
||||
|
@ -490,11 +490,11 @@ class wikilib:
|
|||
self.page_raw = await self.get_page_link()
|
||||
except asyncio.exceptions.TimeoutError:
|
||||
return {'status': 'done',
|
||||
'text': '发生错误:请求页面超时。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='}
|
||||
'text': '发生错误:请求页面超时。\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'}
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return {'status': 'done',
|
||||
'text': f'发生错误:{str(e)}\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title='}
|
||||
'text': f'发生错误:{str(e)}\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+'}
|
||||
if 'interwiki' in self.page_raw['query']:
|
||||
iwp = self.page_raw['query']['interwiki'][0]
|
||||
match_interwiki = re.match(r'^' + iwp['iw'] + r':(.*)', iwp['title'])
|
||||
|
@ -517,4 +517,4 @@ class wikilib:
|
|||
return await self.step1()
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
return f'发生错误:{str(e)}' + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=5678.md&title=\n'
|
||||
return f'发生错误:{str(e)}' + '\n错误汇报地址:https://github.com/Teahouse-Studios/bot/issues/new?assignees=OasisAkari&labels=bug&template=report_bug.yaml&title=%5BBUG%5D%3A+\n'
|
||||
|
|
Reference in a new issue