Multifunctional B-site video analysis tool
Video link analysis and generate basic information , word cloud and content summary based on its content
If a Linux user encounters
libGL.so.1: cannot open shared object file: No such file or directory
error, indicating that the operating environment of OpenGL is missing. You can refer to README in dynamicrender to install the corresponding dependencies and try again.
nb plugin install nonebot-plugin-bilichat
Note: Since nb-cli does not support dependency groups, users who need to enable word cloud and AI summary will install additional dependencies through other package managers.
pip install nonebot-plugin-bilichat[all]
pip install nonebot-plugin-bilichat[all]
pdm add nonebot-plugin-bilichat[all]
poetry add nonebot-plugin-bilichat[all]
conda install nonebot-plugin-bilichat[all]
Open the pyproject.toml
file in the root directory of nonebot2 project and add writes to the [tool.nonebot]
section
plugins = ["nonebot_plugin_bilichat"]
Add the configuration in the following table to the .env
file of the nonebot2 project. All configurations are non-essential items
Generally speaking, you only need to pay attention to the following configuration items
# 对同一视频的响应冷却时间(防止刷屏)
bilichat_cd_time = 120
# 网络请求重试次数
bilichat_neterror_retry = 3
# 是否使用浏览器截图(需要额外依赖)
bilichat_use_browser = True
# 是否开启词云(需要额外依赖)
bilichat_word_cloud = True
# === AI 总结相关 ===
# 官方总结接口
bilichat_official_summary = True
# openai 接口(需要额外依赖)
bilichat_openai_token = sk-xxxxxxx
# 网络代理
bilichat_openai_proxy = "http://127.0.0.1:7890/"
Configuration Items | type | default value | illustrate |
---|---|---|---|
bilicat_block | bool | False | Whether to intercept events (prevent other plug-ins from secondary parsing) |
bilicat_enable_self | bool | False | Whether to allow response to your own messages |
bilicat_only_self | bool | False | Whether to respond only to your own messages, it will cover all other rules after opening (Man-machine integration special supply) |
bilicat_only_to_me | bool | False | Does non-self messages require @机器人 or use the robot's nickname to respond |
bilicat_whitelist | list[str] | [] | The response session list will overwrite the blacklist |
bilicat_blacklist | list[str] | [] | List of unresponsive sessions |
bilicat_dynamic_font | str | None | Fonts used for video information and word cloud pictures |
bilicat_cd_time | int | 120 | Response cooldown time to the same video (prevent screen flushing) |
bilicat_neterror_retry | int | 3 | Number of attempts to request errors to some networks |
bilicat_use_bcut_asr | bool | True | Whether to call the required cut interface to generate subtitles when there are no subtitles |
bilicat_show_error_msg | bool | True | Whether to send error messages when parsing fails |
bilicat_use_browser | bool | Auto | Whether to use a browser, Auto will choose based on whether it contains corresponding dependencies. |
bilicat_browser_shot_quality | int | 75 | The quality of the browser screenshot, the value range is 10-100, the higher the screenshot, the larger the size |
bilicat_cache_serive | str | Auto | The cache type used, the available types include json and mongodb |
bilicat_text_fonts | str | default | Customizable fonts, only for dynamicrender drawings |
bilicat_emoji_fonts | str | default | Customizable fonts, only for dynamicrender drawings |
bilicat_webui_path | str | bilicat | The path to WebUI, if you set it to empty, the WebUI will not be enabled. |
bilicat_subs_limit | int | 5 | Default global subscription number limit |
bilicat_dynamic_interval | int | 90 | Default dynamic polling interval, in seconds |
bilicat_live_interval | int | 30 | Default live polling interval, in seconds |
bilicat_push_delay | int | 3 | Default delay for each push, in seconds |
bilicat_dynamic_method | str | "rest" | The default dynamic push method is "grpc", "rest" and "rss" |
bilicat_rss_base | str | None | The default dynamic RSS subscription address compatible with RSSHub, such as https://rsshub.app/ |
bilicat_rss_key | str | None | The default access control key is compatible with RSSHub. For details, please refer to Note 7. |
Note:
bilichat_enable_self
can actually take effect is also related to it.bilichat_whitelist
exists, bilichat_blacklist
will be disabledbilichat_dynamic_font
can fill in custom font urls, but it is not recommended to modify them.bcut_asr
interface to generate AI subtitles, it may fail to recognize the video duration and network conditions. Bot will prompt BCut-ASR conversion failed due to network error
. You can try to regenerate subtitles by raising bilichat_neterror_retry
number or retry after a few minutesbilichat_cache_serive
is mongodb
, nonebot-plugin-mongodb needs to be installed and configured to be used normallybilichat_rss_base
must be compatible with the file structure and route in RSSHub to be used.bilichat_rss_key
is an optional, used for access control of RSSHub. If no control is required, leave it blank. For details, you can view the RSSHub documentation.bilichat_subs_limit bilichat_dynamic_interval bilichat_live_interval bilichat_push_delay bilichat_dynamic_method bilichat_rss_base bilichat_rss_key
is the global default value. If it is configured in the configuration file, the default value here will be overriddenConfiguration Items | type | default value | illustrate |
---|---|---|---|
bilicat_command_to_me | bool | True | Does the command require @robot |
bilicat_cmd_start | str | "bilicat" | The start word of the command can be set to empty |
bilicat_cmd_add_sub | list[str] | ["Subscribe", "Follow"] | Alias for the "sub" command |
bilicat_cmd_remove_sub | list[str] | ["Unsubscribe", "Unstop"] | The alias for the "unsub" command |
bilicat_cmd_check_sub | list[str] | ["View", "View Subscription"] | Alias for the "check" command |
bilicat_cmd_reset_sub | list[str] | ["Reset", "Reset Configuration"] | Alias for the "reset" command |
bilicat_cmd_at_all | list[str] | ["All Members", "at All"] | Alias for the "atall" command |
bilicat_cmd_dynamic | list[str] | ["Dynamic Notification", "Dynamic Subscription"] | Alias for the "dynamic" command |
bilicat_cmd_live | list[str] | ["Live Notification", "Live Subscription"] | Alias for the "live" command |
bilicat_cmd_checkdynamic | list[str] | ["View Dynamics"] | Alias for the "checkdynamic" command |
bilicat_cmd_fetch | list[str] | ["Get content", "Parse content"] | Alias for the "fetch" command |
bilicat_cmd_check_login | list[str] | ["View login account"] | Alias for the "checklogin" command |
bilicat_cmd_login_qrcode | list[str] | ["Scan the QR code to log in"] | Alias for the "qrlogin" command |
bilicat_cmd_logout | list[str] | ["Login of account"] | Alias for the "logout" command |
bilicat_cmd_modify_cfg | list[str] | ["Modify configuration"] | Alias for the "cfg" command |
Configuration Items | type | default value | illustrate |
---|---|---|---|
bilicat_basic_info | bool | True | Whether to enable basic video information |
bilicat_basic_info_style | str | Auto | The picture style for the video details, see the note below for the available styles |
bilicat_basic_info_url | bool | True | When you enable the video to enter this information, do you reply to a link together? |
bilicat_reply_to_basic_info | bool | True | Whether the subsequent message will reply to the basic information (reply the sender's information if it is closed) |
bilicat_dynamic | bool | True | Whether to start state analysis |
bilicat_dynamic_style | str | Auto | The picture styles for dynamic details, see the note below for available styles |
bilichat_bilibili_cookie | str | None | bilibili's cookie file path, api will automatically create empty files |
bilichat_basic_info_style Except for the default bbot_default that uses PIL drawing (the default selection is selected when the browser is not enabled), the others rely on the browser for rendering (need to set bilichat_use_browser to True or Auto), and the available styles are as follows
bilichat_dynamic_style Except for the default dynamicrender, which uses Skia drawing (the default selection is selected when the browser is not enabled), the others rely on the browser for rendering (need to set bilichat_use_browser to True or Auto), and the available styles are as follows
Turn on this function requires the corresponding dependency nonebot-plugin-bilichat[wordcloud]
Configuration Items | type | default value | illustrate |
---|---|---|---|
bilicat_word_cloud | bool | False | Whether to enable word cloud function |
bilicat_word_cloud_size | list[int] | [1000, 800] | Word cloud picture size |
Turn on this function requires the corresponding dependency nonebot-plugin-bilichat[summary]
Configuration Items | type | default value | illustrate |
---|---|---|---|
bilicat_summary_ignore_null | bool | True | Ignore meaningless summary content |
bilicat_official_summary | bool | False | Whether to enable the official summary, this summary is independent of the AI summary below and can take effect at the same time as the AI summary below |
bilicat_openai_token | str | None | openai apikey, if left blank, openai is disabled. |
bilicat_openai_proxy | str | None | Access the proxy address used by openai or newbing |
bilicat_openai_model | str | gpt-3.5-turbo-0301 | Language Model Names Used |
bilicat_openai_token_limit | int | 3500 | The upper limit of the requested text quantity, please refer to tiktoken for calculation method. |
bilicat_openai_api_base | str | see description | The default is https://api.openai.com , which can be replaced by itself. |
Note:
bilichat_openai_proxy
or global transparent proxy for domestic servers.Just send a video (column) link directly
When sending videos, you can add the following parameters similar to shell instructions to adjust the parsing process. For example
BV12v4y1E7NT --refresh
BV12v4y1E7NT -r # 可以使用简写
BV12v4y1E7NT -r --no-cache # 可以多个参数混用
BV12v4y1E7NT -rn # 可以将简写合并,效果同上一条
-r BV12v4y1E7NT -n # 虽然不建议,但确实可以把参数放前面
instruction | Abbreviation | illustrate |
---|---|---|
--no-cache | -n | This summary disables cache (will not affect existing cache files) |
--refresh | -r | Refresh the word cloud and summary cache for this video (which will overwrite existing cache files) |
--force | -f | Ignore the cd time and force parse the video |
The instruction part consists of指令前缀
and指令名
, where指令前缀
contains three parts: COMMAND_START
bilichat_cmd_start
COMMAND_SEP
, and the default指令前缀
is /bilichat.
, that is, the complete instruction is /bilichat.xxx
指令前缀
part can also be modified. For example, fill in the following settings in .env to achieve no指令前缀
COMMAND_SEP = [""]
COMMAND_START = [""]
bilichat_cmd_start = " "
指令名
is shown in the following table. Except for the login-related instructions, you can refer to the above commands and subscription configuration items.
instruction | Permissions | scope | parameter | illustrate |
---|---|---|---|---|
Sub | Owner | Group chat | UP master's nickname or UID | Add a subscription |
unsub | Owner | Group chat | UP master's nickname or UID, or all | Remove subscription, all will be removed when all |
Check | Unlimited | Group chat | UP master's nickname or UID, or leave it blank | View the subscription list of this group or the configuration of the specified UP master |
reset | Owner | Group chat | UP master's nickname or UID, or all | Reset the push configuration of the specified UP master, reset it when all |
atall | Owner | Group chat | UP master's nickname or UID全局 动态 直播 | Set whether to at all members |
dynamic | Owner | Group chat | UP master's nickname or UID | Whether to enable dynamic notification of this UP |
live | Owner | Group chat | UP master's nickname or UID | Whether to enable the live broadcast notification of this UP |
checkdynamic | Unlimited | Unlimited | UP master's nickname or UID | View the latest update of the specified UP master |
fetch | Unlimited | Unlimited | Dynamic ID, or reply to messages containing this content | Analyze dynamically included pictures |
checklogin | Owner | Unlimited | none | View all currently logged in |
qrlogin | Owner | Unlimited | none | Use the QR code to log in to B station to prevent wind control |
Logout | Owner | Unlimited | The UID of the account | Log out of the specified account |
cfg | Owner | Unlimited | none | View or modify configuration information |
Users who are not masters cannot directly add or remove subscriptions, but can submit an action request with the same instructions and then add it by the master, e.g.
USER: /bilichat.sub 123456
BOT: 已记录此次添加申请,请联系管理员处理
SUPERUSER: /bilichat.handle
BOT: ...
handle
is the master's processing command, which can be triggered at any interactive location (including group chats and private chats). The command is an interactive command, and you can operate according to its prompts.
I would like to thank the following developers (projects) for their contributions to this project: