适用于 Nonebot2 的聊天记录插件
Project description
nonebot-plugin-chatrecorder
适用于 Nonebot2 的聊天记录插件。
安装
- 使用 nb-cli
nb plugin install nonebot_plugin_chatrecorder
- 使用 pip
pip install nonebot_plugin_chatrecorder
配置
插件会记录机器人收到的消息,可以添加以下配置选择是否记录机器人发出的消息(默认为 true
);如果协议端开启了自身消息上报则需设置为 false
以避免重复
chatrecorder_record_send_msg=true
插件依赖 nonebot-plugin-datastore 插件
消息记录文件存放在 nonebot-plugin-datastore 插件设置的数据目录;同时插件会将消息中 base64 形式的图片、语音等存成文件,放置在 nonebot-plugin-datastore 插件设置的缓存目录,避免消息记录文件体积过大
使用
示例:
from datetime import datetime, timedelta
from nonebot_plugin_chatrecorder import get_message_records
from nonebot.adapters.onebot.v11 import GroupMessageEvent
@matcher.handle()
def handle(event: GroupMessageEvent):
# 获取当前群内成员 '12345' 和 '54321' 1天之内的消息
msgs = await get_message_records(
user_ids=['12345', '54321'],
group_ids=[event.group_id],
time_start=datetime.utcnow() - timedelta(days=1),
)
详细参数及说明见代码注释
TODO
- 咕?
- 咕咕咕!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for nonebot_plugin_chatrecorder-0.1.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1ce02733148b0099390af88d0d7234c704126317f5488e51f7db26e3aaaa5aa |
|
MD5 | 90032153ce2fcda31c457b75a9800fdf |
|
BLAKE2b-256 | a51565824e7dbf18949c6ed2e65ccadd3ddf99ca2eccaf37202341bdbe06bbda |
Close
Hashes for nonebot_plugin_chatrecorder-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c370f8f498cb899624d1c325b97cf58f9ebfdbe6897d93f9a5fc53959358cd83 |
|
MD5 | d064a7b5df0ac4f1b5aaa996d7d1035c |
|
BLAKE2b-256 | a33d1cfd5c7858693ad16581ca47affebf6becf652b02c3d247bbe1477d79e64 |