This commit is contained in:
felinae98 2022-01-07 01:04:15 +08:00
parent ebfe0d7fa3
commit b32120ca39
No known key found for this signature in database
GPG Key ID: 00C8B010587FF610
4 changed files with 22 additions and 6 deletions

View File

@ -40,3 +40,5 @@
- 增加了help插件`nonebot-plugin-help`
- 修复playwright漏内存的问题
- 增加过滤nonebot日志功能
- 前端可以刷新了(之前居然不可以)
- 在镜像里塞进了浏览器(导致镜像体积起飞)

View File

@ -2,11 +2,9 @@ version: '3'
services:
go-cqhttp:
image: felinae98/go-cqhttp-ffmpeg
image: felinae98/go-cqhttp:v1.0.0-beta8-fix2
volumes:
- ./bot-data:/data
browserless:
image: browserless/chrome
nonebot:
image: felinae98/nonebot-bison
volumes:
@ -17,8 +15,11 @@ services:
# SUPERUSERS: '[<your QQ>]'
BISON_CONFIG_PATH: /data
BISON_BROWSER: ws://browserless:3000
# BISON_OUTER_URL: 'http://<your server ip>:8080/bison'
BISON_FILTER_LOG: true
BISON_USE_PIC: false # 如果需要将文字转为图片发送请改为true
expose:
- 8080:8080
depends_on:
- browserless
- go-cqhttp

View File

@ -75,10 +75,18 @@ sidebar: auto
* `BISON_USE_PIC`: 将文字渲染成图片后进行发送,多用于规避风控
* `BISON_BROWSER`: 本插件使用Chrome来渲染图片
* 使用browserless提供的Chrome管理服务设置为`ws://xxxxxxxx`值为Chrome Endpoint推荐
* 使用cdp连接相关服务设置为`wsc://xxxxxxxxx`
* 使用本地安装的Chrome设置为`local:<chrome path>`,例如`local:/usr/bin/google-chrome-stable`
* 如果不进行配置,那么会在启动时候自动进行安装(不推荐)
* 如果不进行配置那么会在启动时候自动进行安装在官方的docker镜像中已经安装了浏览器
::: warning
截止发布时本项目尚不能完全与browserless兼容目前建议使用镜像内自带的浏览器
不要配置这个变量
:::
* `BISON_OUTER_URL`: 从外部访问服务器的地址,默认为`http://localhost:8080/bison`,如果你的插件部署
在服务器上,建议配置为`http://<你的服务器ip>:8080/bison`
* `BISON_FILTER_LOG`: 是否过滤来自`nonebot`的warning级以下的log如果你的bot只运行了这个插件可以考虑
开启,默认关
* `BISON_USE_QUEUE`: 是否用队列的方式发送消息,降低发送频率,默认开
## 使用
::: warning
本节假设`COMMAND_START`设置中包含`''`如果出现bot不响应的问题请先

View File

@ -50,7 +50,12 @@ class Render(metaclass=Singleton):
executable_path=path, args=['--no-sandbox'])
if plugin_config.bison_browser.startswith('ws:'):
self.remote_browser = True
return await playwright.chromium.connect_over_cdp(plugin_config.bison_browser)
return await playwright.chromium.connect(plugin_config.bison_browser)
if plugin_config.bison_browser.startswith('wsc:'):
self.remote_browser = True
return await playwright.chromium.connect_over_cdp(
'ws:' + plugin_config.bison_browser[4:]
)
raise RuntimeError('bison_BROWSER error')
if plugin_config.bison_use_local:
return await playwright.chromium.launch(