🐾完美言论在线输出

This commit is contained in:
EillesWan 2024-08-13 15:02:26 +08:00
parent 2d67a703bd
commit 996c8c4a00
3 changed files with 26 additions and 7 deletions

7
.gitignore vendored
View File

@ -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

View File

@ -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")
)

View File

@ -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,
)