mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-24 16:15:03 +08:00
别老是没事输出日志
This commit is contained in:
parent
da2b28c27d
commit
6355f7c935
@ -375,6 +375,7 @@ cmd2struct = on_alconna(
|
|||||||
default="DefaultUser",
|
default="DefaultUser",
|
||||||
args=Args["author", str, "DefaultUser"],
|
args=Args["author", str, "DefaultUser"],
|
||||||
),
|
),
|
||||||
|
Option("--debug", default=False, action=store_true),
|
||||||
),
|
),
|
||||||
aliases={
|
aliases={
|
||||||
"函数转结构",
|
"函数转结构",
|
||||||
@ -569,6 +570,8 @@ async def _(
|
|||||||
buffer.write(
|
buffer.write(
|
||||||
"[ERROR] {}\n".format(e).replace(str(Path(__file__).parent.resolve()), "[]")
|
"[ERROR] {}\n".format(e).replace(str(Path(__file__).parent.resolve()), "[]")
|
||||||
)
|
)
|
||||||
|
if result.options["debug"].value:
|
||||||
|
raise e
|
||||||
|
|
||||||
sys.stdout = sys.__stdout__
|
sys.stdout = sys.__stdout__
|
||||||
sys.stderr = sys.__stderr__
|
sys.stderr = sys.__stderr__
|
||||||
@ -600,13 +603,14 @@ async def _(
|
|||||||
"upload_private_file", user_id=event.user_id, name=fn, file=fp
|
"upload_private_file", user_id=event.user_id, name=fn, file=fp
|
||||||
)
|
)
|
||||||
|
|
||||||
img_bytes = await md_to_pic(
|
if buffer.getvalue().strip():
|
||||||
"##{}\n\n```\n{}\n```".format(
|
img_bytes = await md_to_pic(
|
||||||
MarkdownMessage.escape("日志信息:"),
|
"##{}\n\n```\n{}\n```".format(
|
||||||
buffer.getvalue().replace("\\", "/"),
|
MarkdownMessage.escape("日志信息:"),
|
||||||
),
|
buffer.getvalue().replace("\\", "/"),
|
||||||
)
|
),
|
||||||
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
)
|
||||||
|
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
||||||
|
|
||||||
# nonebot.logger.info(buffer.getvalue())
|
# nonebot.logger.info(buffer.getvalue())
|
||||||
img_bytes = await md_to_pic(
|
img_bytes = await md_to_pic(
|
||||||
|
@ -429,7 +429,9 @@ async def _(
|
|||||||
|
|
||||||
if file_subtype in cache_limit_data.keys():
|
if file_subtype in cache_limit_data.keys():
|
||||||
|
|
||||||
if (file_infomation["size"] > cache_limit_data[file_subtype][0]) and common_permission:
|
if (
|
||||||
|
file_infomation["size"] > cache_limit_data[file_subtype][0]
|
||||||
|
) and common_permission:
|
||||||
await notece_.finish(
|
await notece_.finish(
|
||||||
"文件 {} 大小过大,这不是网盘\n单个{}文件不应大于 {} 千字节".format(
|
"文件 {} 大小过大,这不是网盘\n单个{}文件不应大于 {} 千字节".format(
|
||||||
file_infomation["name"],
|
file_infomation["name"],
|
||||||
@ -921,9 +923,7 @@ async def _(
|
|||||||
buffer.write(ulang.get("convert.break.not_enough_point", NOW=pnt))
|
buffer.write(ulang.get("convert.break.not_enough_point", NOW=pnt))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
await linglun_convert.send(
|
await linglun_convert.send(UniMessage.text(ulang.get("convert.start")))
|
||||||
UniMessage.text(ulang.get("convert.start"))
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@ -1174,13 +1174,14 @@ async def _(
|
|||||||
"upload_private_file", user_id=event.user_id, name=fn, file=fp
|
"upload_private_file", user_id=event.user_id, name=fn, file=fp
|
||||||
)
|
)
|
||||||
|
|
||||||
img_bytes = await md_to_pic(
|
if buffer.getvalue().strip():
|
||||||
"##{}\n\n```\n{}\n```".format(
|
img_bytes = await md_to_pic(
|
||||||
MarkdownMessage.escape("日志信息:"),
|
"##{}\n\n```\n{}\n```".format(
|
||||||
buffer.getvalue().replace("\\", "/"),
|
MarkdownMessage.escape("日志信息:"),
|
||||||
),
|
buffer.getvalue().replace("\\", "/"),
|
||||||
)
|
),
|
||||||
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
)
|
||||||
|
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
||||||
|
|
||||||
# nonebot.logger.info(buffer.getvalue())
|
# nonebot.logger.info(buffer.getvalue())
|
||||||
img_bytes = await md_to_pic(
|
img_bytes = await md_to_pic(
|
||||||
|
@ -89,6 +89,7 @@ mspv_sync = on_alconna(
|
|||||||
default="natural",
|
default="natural",
|
||||||
args=Args["volume-processing-function", str, "natural"],
|
args=Args["volume-processing-function", str, "natural"],
|
||||||
),
|
),
|
||||||
|
Option("--debug", default=False, action=store_true),
|
||||||
),
|
),
|
||||||
aliases={
|
aliases={
|
||||||
"midi合成",
|
"midi合成",
|
||||||
@ -142,6 +143,7 @@ async def _(
|
|||||||
"pitched-note-table": "touch",
|
"pitched-note-table": "touch",
|
||||||
"percussion-note-table": "touch",
|
"percussion-note-table": "touch",
|
||||||
"volume-processing-function": "natural",
|
"volume-processing-function": "natural",
|
||||||
|
"debug": False,
|
||||||
}
|
}
|
||||||
for arg in _args.keys():
|
for arg in _args.keys():
|
||||||
_args[arg] = (
|
_args[arg] = (
|
||||||
@ -395,6 +397,8 @@ async def _(
|
|||||||
buffer.write(
|
buffer.write(
|
||||||
"[ERROR] {}\n".format(e).replace(str(Path(__file__).parent.resolve()), "[]")
|
"[ERROR] {}\n".format(e).replace(str(Path(__file__).parent.resolve()), "[]")
|
||||||
)
|
)
|
||||||
|
if _args["debug"]:
|
||||||
|
raise e
|
||||||
|
|
||||||
sys.stdout = sys.__stdout__
|
sys.stdout = sys.__stdout__
|
||||||
sys.stderr = sys.__stderr__
|
sys.stderr = sys.__stderr__
|
||||||
@ -427,13 +431,14 @@ async def _(
|
|||||||
|
|
||||||
add_file_to_delete(fp, 1)
|
add_file_to_delete(fp, 1)
|
||||||
|
|
||||||
img_bytes = await md_to_pic(
|
if buffer.getvalue().strip():
|
||||||
"##{}\n\n```\n{}\n```".format(
|
img_bytes = await md_to_pic(
|
||||||
MarkdownMessage.escape("日志信息:"),
|
"##{}\n\n```\n{}\n```".format(
|
||||||
buffer.getvalue().replace("\\", "/"),
|
MarkdownMessage.escape("日志信息:"),
|
||||||
),
|
buffer.getvalue().replace("\\", "/"),
|
||||||
)
|
),
|
||||||
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
)
|
||||||
|
await UniMessage.send(UniMessage.image(raw=img_bytes))
|
||||||
|
|
||||||
# nonebot.logger.info(buffer.getvalue())
|
# nonebot.logger.info(buffer.getvalue())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user