适用于 Nonebot2 的聊天记录插件
Project description
nonebot-plugin-chatrecorder
适用于 Nonebot2 的聊天记录插件。
安装
- 使用 nb-cli
nb plugin install nonebot_plugin_chatrecorder
- 使用 pip
pip install nonebot_plugin_chatrecorder
配置
插件依赖 nonebot-plugin-datastore 插件
需要在配置文件中添加:
datastore_enable_database=true
插件会记录机器人收到的消息,可以添加以下配置选择是否记录机器人发出的消息(默认为 true
);如果协议端开启了自身消息上报则需设置为 false
以避免重复
chatrecorder_record_send_msg=true
消息记录文件存放在 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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1aec45a722366a6cde0661d8b18d32bc054aeddff8e42272fc913c07c57c2c9 |
|
MD5 | 68ec2ec7e7494d3f8475ff5612cd34f8 |
|
BLAKE2b-256 | 3b380881934d903dcf9286181fb2b64f81f42c58de0a8566853cc13438eb000c |
Close
Hashes for nonebot_plugin_chatrecorder-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d47128b5a6d5d34cf11a8204bd878142ea2445b8c17c30489ca23a40bfb18b3 |
|
MD5 | 78d2334c9f0ba7d225870abc08680ebd |
|
BLAKE2b-256 | 8e4c45a7bfba1d321f8fe4ad67c0e3fd80062e75473b8d63c267d2ab8155089a |