🐛 补上 require
This commit is contained in:
@@ -1,16 +1,6 @@
|
|||||||
from nonebot import on_message
|
from nonebot import require
|
||||||
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
|
require("nonebot_plugin_alconna")
|
||||||
|
require("nonebot_plugin_uninfo")
|
||||||
|
|
||||||
|
from . import matcher # noqa: E402, F401
|
||||||
@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,
|
|
||||||
)
|
|
||||||
|
|||||||
16
nonebot_plugin_watch/matcher.py
Normal file
16
nonebot_plugin_watch/matcher.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,
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user