diff --git a/.gitignore b/.gitignore index 6fc17df..c0b83fb 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,10 @@ config.example.yml compile.bat src/resources/templates/latest-debug.html -src/plugins/trimo_plugin_msctconverter/config -src/plugins/trimo_plugin_msctconverter/temp -src/plugins/trimo_plugin_msctconverter/MusicPreview/assets/wav +src/nonebot_plugins/trimo_plugin_msctconverter/config +src/nonebot_plugins/trimo_plugin_msctconverter/temp +src/nonebot_plugins/trimo_plugin_msctconverter/MusicPreview/assets/wav +src/nonebot_plugins/dislink_plugin_ccnd # vuepress .github diff --git a/src/nonebot_plugins/liteyuki_status/status.py b/src/nonebot_plugins/liteyuki_status/status.py index 5e85371..a779914 100644 --- a/src/nonebot_plugins/liteyuki_status/status.py +++ b/src/nonebot_plugins/liteyuki_status/status.py @@ -78,7 +78,7 @@ async def every_day_update(): def update_yanlun(): - global yanlun_texts + global yanlun_texts, yanlun_seqs solar_datetime = zhDateTime.DateTime.now() lunar_datetime = solar_datetime.to_lunar() @@ -109,14 +109,26 @@ def update_yanlun(): nonebot.logger.warning(f"读取言·论信息发生 未知 错误:\n{E}") yanlun_texts = ["灵光焕发 深艺献心"] + yanlun_seqs = yanlun_texts.copy() + random.shuffle(yanlun_seqs) + return len(yanlun_texts) +yanlun_seqs = [] update_yanlun() +def random_yanlun_text() -> str: + global yanlun_texts, yanlun_seqs + if not yanlun_seqs: + yanlun_seqs = yanlun_texts.copy() + random.shuffle(yanlun_seqs) + return yanlun_seqs.pop() + + def random_yanlun() -> tuple: - seq = random.choice(yanlun_texts).replace(" ", "\t").split("\t——", 1) + seq = random_yanlun_text().replace(" ", "\t").split("\t——", 1) return seq[0], "" if len(seq) == 1 else seq[1] @@ -213,6 +225,9 @@ async def _( ) ) yanlun_texts = ["灵光焕发 深艺献心"] + + yanlun_seqs = yanlun_texts.copy() + random.shuffle(yanlun_seqs) if result.options["count"].value: authors = [ ( @@ -269,7 +284,7 @@ async def _( ( await yanlun.finish( UniMessage.text( - "\n".join([random.choice(yanlun_texts) for i in range(iill)]) + "\n".join([random_yanlun_text() for i in range(iill)]) if iill <= 100 else ulang.get("yanlun.length.toolong") ) diff --git a/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py b/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py index 4ac91a9..bf6eccc 100644 --- a/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py +++ b/src/nonebot_plugins/trimo_plugin_msctconverter/msctexec.py @@ -78,6 +78,8 @@ from nonebot_plugin_alconna import ( from nonebot_plugin_apscheduler import scheduler +from ..liteyuki_status.status import random_yanlun_text + (config_dir := Path(__file__).parent / "config").mkdir(exist_ok=True) (database_dir := Path(__file__).parent / "db").mkdir(exist_ok=True) temporary_dir = Path(__file__).parent / "temp" @@ -1032,7 +1034,8 @@ async def _( ) for fn, res in all_files.items() ] - ), + ) + + "\n\n### 言·论 \n\n **{}**".format(random_yanlun_text()), bot, event=event, )