Support history data service remove same data

This commit is contained in:
xtaodada 2024-06-04 19:55:49 +08:00
parent 62d74872a9
commit 6cc3be89b5
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 16 additions and 1 deletions

@ -1 +1 @@
Subproject commit 481770502884afbce7d6b38f0448fec9e749885e
Subproject commit b1399182760c135ed8fe2479e329abb3084c7abb

View File

@ -120,6 +120,21 @@ class RefreshHistoryJob(Plugin):
notice_text = NOTICE_TEXT % ("旅行札记历史记录", now, uid, "旅行札记历史记录")
await self.send_notice(context, user_id, notice_text)
@handler.command(command="remove_same_history", block=False, admin=True)
async def remove_same_history(self, update: "Update", _: "ContextTypes.DEFAULT_TYPE"):
user = update.effective_user
logger.info("用户 %s[%s] remove_same_history 命令请求", user.full_name, user.id)
message = update.effective_message
reply = await message.reply_text("正在执行移除相同数据历史记录任务,请稍后...")
text = "移除相同数据历史记录任务完成\n"
num1 = await self.history_data_abyss.remove_same_data()
text += f"混沌回忆数据移除数量:{num1}\n"
num3 = await self.history_data_abyss_story.remove_same_data()
text += f"虚构叙事数据移除数量:{num3}\n"
num2 = await self.history_data_ledger.remove_same_data()
text += f"开拓月历数据移除数量:{num2}\n"
await reply.edit_text(text)
@handler.command(command="refresh_all_history", block=False, admin=True)
async def refresh_all_history(self, update: "Update", context: "ContextTypes.DEFAULT_TYPE"):
user = update.effective_user