1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2026-05-16 10:56:46 +08:00

feat: 支持关闭获取对话记录功能

This commit is contained in:
涵曦
2025-01-01 14:32:41 +08:00
parent a28c65febf
commit bf2d29790a
3 changed files with 14 additions and 0 deletions

View File

@@ -170,6 +170,9 @@ class Config:
os.getenv("XIAOMUSIC_CONTINUE_PLAY", "false").lower() == "true"
)
pull_ask_sec: int = int(os.getenv("XIAOMUSIC_PULL_ASK_SEC", "1"))
enable_pull_ask: bool = (
os.getenv("XIAOMUSIC_ENABLE_PULL_ASK", "true").lower() == "true"
)
crontab_json: str = os.getenv("XIAOMUSIC_CRONTAB_JSON", "") # 定时任务
enable_yt_dlp_cookies: bool = (
os.getenv("XIAOMUSIC_ENABLE_YT_DLP_COOKIES", "false").lower() == "true"

View File

@@ -170,6 +170,12 @@ var vConsole = new window.VConsole();
<option value="false" selected>false</option>
</select>
<label for="enable_pull_ask">获取对话记录:</label>
<select id="enable_pull_ask">
<option value="true" selected>true</option>
<option value="false">false</option>
</select>
<label for="pull_ask_sec">获取对话记录间隔(秒):</label>
<input id="pull_ask_sec" type="number" value="1" />

View File

@@ -178,6 +178,11 @@ class XiaoMusic:
async def poll_latest_ask(self):
async with ClientSession() as session:
while True:
if not self.config.enable_pull_ask:
self.log.debug("Listening new message disabled")
await asyncio.sleep(5)
continue
self.log.debug(
f"Listening new message, timestamp: {self.last_timestamp}"
)