feat: add daily status command

This commit is contained in:
xtaodada 2024-09-30 21:59:28 +08:00
parent 4d7fdec769
commit 1220c6bf33
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
3 changed files with 16 additions and 8 deletions

View File

@ -282,7 +282,7 @@
"postedAt0min0sec": [ "postedAt0min0sec": [
"报时", "报时",
"在 0 点发布一篇帖子", "在 0 点发布一篇帖子",
"嘣 嘣 嘣 Biu——" "报时信号最后一响,零点整"
], ],
"selfQuote": [ "selfQuote": [
"自我引用", "自我引用",
@ -361,8 +361,8 @@
], ],
"cookieClicked": [ "cookieClicked": [
"点击饼干小游戏", "点击饼干小游戏",
"点击了可疑的饼干", "点击了饼干",
"是不是软件有问题" "用错软件了"
], ],
"brainDiver": [ "brainDiver": [
"Brain Diver", "Brain Diver",
@ -387,6 +387,6 @@
"bubbleGameDoubleExplodingHead": [ "bubbleGameDoubleExplodingHead": [
"两个🤯", "两个🤯",
"你合成出了2个游戏里最大的Emoji", "你合成出了2个游戏里最大的Emoji",
"" "大约能 装满 这些便当盒 🤯 🤯 (比划)"
] ]
} }

View File

@ -59,10 +59,10 @@ class MisskeyBot(commands.Bot):
async def when_start(self, _): async def when_start(self, _):
await self._router.connect_channel(["main", "home"]) await self._router.connect_channel(["main", "home"])
await self.fetch_offline_notes() # await self.fetch_offline_notes()
subs = await RevokeAction.get_all_subs(self.tg_user.user_id) # subs = await RevokeAction.get_all_subs(self.tg_user.user_id)
for sub in subs: # for sub in subs:
await self._router.capture_message(sub) # await self._router.capture_message(sub)
async def on_ready(self, ws): async def on_ready(self, ws):
try: try:

View File

@ -3,6 +3,8 @@ from datetime import datetime, timedelta
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from pyrogram import Client, filters
from defs.announcement import UnreadAnnouncement from defs.announcement import UnreadAnnouncement
from init import bot from init import bot
from misskey_init import init_misskey_bot, misskey_bot_map 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(): for m_bot in misskey_bot_map.values():
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
me = await m_bot.core.api.get_me() me = await m_bot.core.api.get_me()
me._MeDetailedOnly__client = me._client
await get_unread_announcements(me, m_bot) 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()