Skip to main content

适用于 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_chatrecorder-0.1.7.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_chatrecorder-0.1.7-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_chatrecorder-0.1.7.tar.gz.

File metadata

  • Download URL: nonebot_plugin_chatrecorder-0.1.7.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.4.72-microsoft-standard-WSL2

File hashes

Hashes for nonebot_plugin_chatrecorder-0.1.7.tar.gz
Algorithm Hash digest
SHA256 746b0ea42632351dc07736435ff3c9aaa07c4ba7ef94e87cf848ff630039e465
MD5 60070ac78466f99457e190a757bc3ea9
BLAKE2b-256 ac32fe188fbda923fba0b9ca35f3d6567f741575448d4f6308f3140b60e84948

See more details on using hashes here.

File details

Details for the file nonebot_plugin_chatrecorder-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_chatrecorder-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 833058522748e9083c6c437d9ad894d9f80eb1e318bcadf29171f7e890191764
MD5 95296e6b729423516b6b599d8dbd53b9
BLAKE2b-256 11be79a24218d56bb8b82b903f8a4996d7f6e5b6d604a65d81703bd68e0af5c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page