From 1220c6bf331ed98db96c6a12889bc91f4f3eaac2 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 30 Sep 2024 21:59:28 +0800 Subject: [PATCH] feat: add daily status command --- gen/achievement.json | 8 ++++---- misskey_init.py | 8 ++++---- modules/timeline.py | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gen/achievement.json b/gen/achievement.json index 0f31b1b..73a482c 100644 --- a/gen/achievement.json +++ b/gen/achievement.json @@ -282,7 +282,7 @@ "postedAt0min0sec": [ "报时", "在 0 点发布一篇帖子", - "嘣 嘣 嘣 Biu——!" + "报时信号最后一响,零点整" ], "selfQuote": [ "自我引用", @@ -361,8 +361,8 @@ ], "cookieClicked": [ "点击饼干小游戏", - "点击了可疑的饼干", - "是不是软件有问题?" + "点击了饼干", + "用错软件了?" ], "brainDiver": [ "Brain Diver", @@ -387,6 +387,6 @@ "bubbleGameDoubleExplodingHead": [ "两个🤯", "你合成出了2个游戏里最大的Emoji", - "" + "大约能 装满 这些便当盒 🤯 🤯 (比划)" ] } \ No newline at end of file diff --git a/misskey_init.py b/misskey_init.py index 136db84..2905c76 100644 --- a/misskey_init.py +++ b/misskey_init.py @@ -59,10 +59,10 @@ class MisskeyBot(commands.Bot): async def when_start(self, _): await self._router.connect_channel(["main", "home"]) - await self.fetch_offline_notes() - subs = await RevokeAction.get_all_subs(self.tg_user.user_id) - for sub in subs: - await self._router.capture_message(sub) + # await self.fetch_offline_notes() + # subs = await RevokeAction.get_all_subs(self.tg_user.user_id) + # for sub in subs: + # await self._router.capture_message(sub) async def on_ready(self, ws): try: diff --git a/modules/timeline.py b/modules/timeline.py index d1e23ff..99dbc98 100644 --- a/modules/timeline.py +++ b/modules/timeline.py @@ -3,6 +3,8 @@ from datetime import datetime, timedelta from typing import TYPE_CHECKING +from pyrogram import Client, filters + from defs.announcement import UnreadAnnouncement from init import bot from misskey_init import init_misskey_bot, misskey_bot_map @@ -32,4 +34,10 @@ async def daily_status(): for m_bot in misskey_bot_map.values(): with contextlib.suppress(Exception): me = await m_bot.core.api.get_me() + me._MeDetailedOnly__client = me._client await get_unread_announcements(me, m_bot) + + +@Client.on_message(filters.incoming & filters.private & filters.command(["daily_status"])) +async def daily_status_command(_: Client, __): + await daily_status()