使用satori时维护一个有昵称的用户列表

get_plugin_session_enable 判断当前使用的适配器
This commit is contained in:
Expliyh
2024-05-16 19:20:54 +08:00
parent 90e7a90bcf
commit 24722447da
11 changed files with 120 additions and 14 deletions

View File

@ -0,0 +1,16 @@
from nonebot.plugin import PluginMetadata
from .auto_update import *
__author__ = "expliyh"
__plugin_meta__ = PluginMetadata(
name="Satori 用户数据自动更新(临时措施)",
description="",
usage="",
type="application",
homepage="https://github.com/snowykami/LiteyukiBot",
extra={
"liteyuki": True,
"toggleable" : True,
"default_enable" : True,
}
)

View File

@ -0,0 +1,16 @@
from liteyuki.utils import satori_utils
from nonebot.message import event_preprocessor
# from nonebot_plugin_alconna.typings import Event
from liteyuki.utils.base.ly_typing import T_MessageEvent
from liteyuki.utils import satori_utils
from nonebot.adapters import satori
from nonebot_plugin_alconna.typings import Event
@event_preprocessor
async def pre_handle(event: Event):
print("UPDATE_USER")
if isinstance(event, satori.MessageEvent):
if event.user.name is not None:
await satori_utils.user_infos.put(event.user)
print(event.user)