🎉 初次提交
This commit is contained in:
16
nonebot_plugin_watch/__init__.py
Normal file
16
nonebot_plugin_watch/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from nonebot import on_message
|
||||
from nonebot_plugin_alconna.uniseg import UniMsg
|
||||
from nonebot_plugin_uninfo import Uninfo # type: ignore[import-untyped]
|
||||
from plyer import notification # type: ignore[import-untyped]
|
||||
|
||||
from .config import config
|
||||
|
||||
|
||||
@on_message().handle()
|
||||
async def _(session: Uninfo, msg: UniMsg):
|
||||
if session.user.id in config.watch_ids:
|
||||
notification.notify( # type: ignore
|
||||
title=f"{session.user.nick or session.user.name or session.user.id} 发言",
|
||||
message=repr(msg),
|
||||
timeout=10,
|
||||
)
|
||||
9
nonebot_plugin_watch/config.py
Normal file
9
nonebot_plugin_watch/config.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from nonebot.plugin import get_plugin_config
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Config(BaseModel):
|
||||
watch_ids: list[str] = []
|
||||
|
||||
|
||||
config = get_plugin_config(Config)
|
||||
0
nonebot_plugin_watch/py.typed
Normal file
0
nonebot_plugin_watch/py.typed
Normal file
Reference in New Issue
Block a user