mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-12-01 01:34:45 +08:00
🐾完美言论在线输出
This commit is contained in:
parent
2d67a703bd
commit
996c8c4a00
7
.gitignore
vendored
7
.gitignore
vendored
@ -19,9 +19,10 @@ config.example.yml
|
|||||||
compile.bat
|
compile.bat
|
||||||
src/resources/templates/latest-debug.html
|
src/resources/templates/latest-debug.html
|
||||||
|
|
||||||
src/plugins/trimo_plugin_msctconverter/config
|
src/nonebot_plugins/trimo_plugin_msctconverter/config
|
||||||
src/plugins/trimo_plugin_msctconverter/temp
|
src/nonebot_plugins/trimo_plugin_msctconverter/temp
|
||||||
src/plugins/trimo_plugin_msctconverter/MusicPreview/assets/wav
|
src/nonebot_plugins/trimo_plugin_msctconverter/MusicPreview/assets/wav
|
||||||
|
src/nonebot_plugins/dislink_plugin_ccnd
|
||||||
|
|
||||||
# vuepress
|
# vuepress
|
||||||
.github
|
.github
|
||||||
|
@ -78,7 +78,7 @@ async def every_day_update():
|
|||||||
|
|
||||||
|
|
||||||
def update_yanlun():
|
def update_yanlun():
|
||||||
global yanlun_texts
|
global yanlun_texts, yanlun_seqs
|
||||||
|
|
||||||
solar_datetime = zhDateTime.DateTime.now()
|
solar_datetime = zhDateTime.DateTime.now()
|
||||||
lunar_datetime = solar_datetime.to_lunar()
|
lunar_datetime = solar_datetime.to_lunar()
|
||||||
@ -109,14 +109,26 @@ def update_yanlun():
|
|||||||
nonebot.logger.warning(f"读取言·论信息发生 未知 错误:\n{E}")
|
nonebot.logger.warning(f"读取言·论信息发生 未知 错误:\n{E}")
|
||||||
yanlun_texts = ["灵光焕发 深艺献心"]
|
yanlun_texts = ["灵光焕发 深艺献心"]
|
||||||
|
|
||||||
|
yanlun_seqs = yanlun_texts.copy()
|
||||||
|
random.shuffle(yanlun_seqs)
|
||||||
|
|
||||||
return len(yanlun_texts)
|
return len(yanlun_texts)
|
||||||
|
|
||||||
|
|
||||||
|
yanlun_seqs = []
|
||||||
update_yanlun()
|
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:
|
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]
|
return seq[0], "" if len(seq) == 1 else seq[1]
|
||||||
|
|
||||||
|
|
||||||
@ -213,6 +225,9 @@ async def _(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
yanlun_texts = ["灵光焕发 深艺献心"]
|
yanlun_texts = ["灵光焕发 深艺献心"]
|
||||||
|
|
||||||
|
yanlun_seqs = yanlun_texts.copy()
|
||||||
|
random.shuffle(yanlun_seqs)
|
||||||
if result.options["count"].value:
|
if result.options["count"].value:
|
||||||
authors = [
|
authors = [
|
||||||
(
|
(
|
||||||
@ -269,7 +284,7 @@ async def _(
|
|||||||
(
|
(
|
||||||
await yanlun.finish(
|
await yanlun.finish(
|
||||||
UniMessage.text(
|
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
|
if iill <= 100
|
||||||
else ulang.get("yanlun.length.toolong")
|
else ulang.get("yanlun.length.toolong")
|
||||||
)
|
)
|
||||||
|
@ -78,6 +78,8 @@ from nonebot_plugin_alconna import (
|
|||||||
from nonebot_plugin_apscheduler import scheduler
|
from nonebot_plugin_apscheduler import scheduler
|
||||||
|
|
||||||
|
|
||||||
|
from ..liteyuki_status.status import random_yanlun_text
|
||||||
|
|
||||||
(config_dir := Path(__file__).parent / "config").mkdir(exist_ok=True)
|
(config_dir := Path(__file__).parent / "config").mkdir(exist_ok=True)
|
||||||
(database_dir := Path(__file__).parent / "db").mkdir(exist_ok=True)
|
(database_dir := Path(__file__).parent / "db").mkdir(exist_ok=True)
|
||||||
temporary_dir = Path(__file__).parent / "temp"
|
temporary_dir = Path(__file__).parent / "temp"
|
||||||
@ -1032,7 +1034,8 @@ async def _(
|
|||||||
)
|
)
|
||||||
for fn, res in all_files.items()
|
for fn, res in all_files.items()
|
||||||
]
|
]
|
||||||
),
|
)
|
||||||
|
+ "\n\n### 言·论 \n\n **{}**".format(random_yanlun_text()),
|
||||||
bot,
|
bot,
|
||||||
event=event,
|
event=event,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user