From 1f137624c524e4ac0b6173dd7451075784bb9b4e Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Wed, 9 Mar 2022 15:02:50 +0800 Subject: [PATCH 1/3] rm wechat --- src/plugins/nonebot_bison/platform/wechat.py | 77 -------------------- 1 file changed, 77 deletions(-) delete mode 100644 src/plugins/nonebot_bison/platform/wechat.py diff --git a/src/plugins/nonebot_bison/platform/wechat.py b/src/plugins/nonebot_bison/platform/wechat.py deleted file mode 100644 index f0d0d11..0000000 --- a/src/plugins/nonebot_bison/platform/wechat.py +++ /dev/null @@ -1,77 +0,0 @@ -import hashlib -import json -import re -from datetime import datetime -from typing import Any, Optional - -import httpx -from bs4 import BeautifulSoup as bs - -from ..types import * - -# from .platform import Platform - - -# class Wechat(Platform): - -# categories = {} -# enable_tag = False -# platform_name = 'wechat' -# enabled = False -# is_common = False -# name = '微信公众号' - -# @classmethod -# def _get_query_url(cls, target: Target): -# return 'https://weixin.sogou.com/weixin?type=1&s_from=input&query={}&ie=utf8&_sug_=n&_sug_type_='.format(target) - -# @classmethod -# async def _get_target_soup(cls, target: Target) -> Optional[bs]: -# target_url = cls._get_query_url(target) -# async with httpx.AsyncClient() as client: -# res = await client.get(target_url) -# soup = bs(res.text, 'html.parser') -# blocks = soup.find(class_='news-list2').find_all('li',recursive=False) -# for block in blocks: -# if block.find(string=[target]): -# return block - -# @classmethod -# async def get_account_name(cls, target: Target) -> Optional[str]: -# if not (block := await cls._get_target_soup(target)): -# return None -# return block.find('p', class_='tit').find('a').text - -# async def get_sub_list(self, target: Target) -> list[RawPost]: -# block = await self._get_target_soup(target) -# if (last_post_dt := block.find('dt', string='最近文章:')): -# post = { -# 'title': last_post_dt.find_parent().find('a').text, -# 'target': target, -# 'page_url': self._get_query_url(target), -# 'name': block.find('p', class_='tit').find('a').text -# } -# return [post] -# else: -# return [] - -# def get_id(self, post: RawPost) -> Any: -# return post['title'] - -# def get_date(self, post: RawPost): -# return None - -# def get_tags(self, post: RawPost): -# return None - -# def get_category(self, post: RawPost): -# return None - -# async def parse(self, raw_post: RawPost) -> Post: -# # TODO get content of post -# return Post(target_type='wechat', -# text='{}\n详细内容请自行查看公众号'.format(raw_post['title']), -# target_name=raw_post['name'], -# pics=[], -# url='' -# ) From 1e2ccb7653564f2bf9e52e28e13e1e8e223400a8 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Wed, 9 Mar 2022 15:03:24 +0800 Subject: [PATCH 2/3] default not retry --- CHANGELOG.md | 5 +++++ src/plugins/nonebot_bison/plugin_config.py | 1 + src/plugins/nonebot_bison/send.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d275977..953fae6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,3 +63,8 @@ - 添加了 FF14 - 去掉了自己维护的 playwright,转向[nonebot-plugin-htmlrender](https://github.com/kexue-z/nonebot-plugin-htmlrender) - 支持了 nonebot 2.0.0beta + +## [0.5.1] + +- 使用了新的私聊进行群管理的方式 +- 默认关闭自动重发功能 diff --git a/src/plugins/nonebot_bison/plugin_config.py b/src/plugins/nonebot_bison/plugin_config.py index 927dfa4..1a653a1 100644 --- a/src/plugins/nonebot_bison/plugin_config.py +++ b/src/plugins/nonebot_bison/plugin_config.py @@ -12,6 +12,7 @@ class PlugConfig(BaseSettings): bison_filter_log: bool = False bison_to_me: bool = True bison_skip_browser_check: bool = False + bison_resend_times: int = 0 class Config: extra = "ignore" diff --git a/src/plugins/nonebot_bison/send.py b/src/plugins/nonebot_bison/send.py index 1518636..10adaa4 100644 --- a/src/plugins/nonebot_bison/send.py +++ b/src/plugins/nonebot_bison/send.py @@ -42,7 +42,7 @@ async def do_send_msgs(): async def send_msgs(bot: Bot, user, user_type: Literal["private", "group"], msgs: list): if plugin_config.bison_use_queue: for msg in msgs: - QUEUE.append((bot, user, user_type, msg, 2)) + QUEUE.append((bot, user, user_type, msg, plugin_config.bison_resend_times)) else: for msg in msgs: await _do_send(bot, user, user_type, msg) From 02870d17fa2678553181a7e2a344e4bd14955c65 Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Wed, 9 Mar 2022 15:15:08 +0800 Subject: [PATCH 3/3] update doc --- docker-compose.yml | 1 - docs/usage/README.md | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5f2a0d1..e6843ca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,6 @@ services: HOST: 0.0.0.0 # SUPERUSERS: '[]' BISON_CONFIG_PATH: /data - BISON_BROWSER: ws://browserless:3000 # BISON_OUTER_URL: 'http://:8080/bison' BISON_FILTER_LOG: true BISON_USE_PIC: false # 如果需要将文字转为图片发送请改为true diff --git a/docs/usage/README.md b/docs/usage/README.md index 57ad323..ed88c54 100644 --- a/docs/usage/README.md +++ b/docs/usage/README.md @@ -42,7 +42,7 @@ sidebar: auto servers: - ws-reverse: - universal: ws://nonebot:8080/cqhttp/ws # 将这个字段写为这个值 + universal: ws://nonebot:8080/onebot/v11/ws/ # 将这个字段写为这个值 ``` 3. 登录 go-cqhttp @@ -107,11 +107,14 @@ sidebar: auto 截止发布时,本项目尚不能完全与 browserless 兼容,目前建议使用镜像内自带的浏览器,即 不要配置这个变量 ::: +- `BISON_SKIP_BROWSER_CHECK`: 是否在启动时自动下载浏览器,如果选择`False`会在用到浏览器时自动下载, + 默认`True` - `BISON_OUTER_URL`: 从外部访问服务器的地址,默认为`http://localhost:8080/bison`,如果你的插件部署 在服务器上,建议配置为`http://<你的服务器ip>:8080/bison` - `BISON_FILTER_LOG`: 是否过滤来自`nonebot`的 warning 级以下的 log,如果你的 bot 只运行了这个插件可以考虑 开启,默认关 - `BISON_USE_QUEUE`: 是否用队列的方式发送消息,降低发送频率,默认开 +- `BISON_RESEND_TIMES`: 最大重发次数,默认 0 ## 使用