mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-03 09:56:45 +08:00
Merge branch 'dev' into AzideCupric/main
This commit is contained in:
commit
ffb5a01e7e
@ -63,3 +63,8 @@
|
||||
- 添加了 FF14
|
||||
- 去掉了自己维护的 playwright,转向[nonebot-plugin-htmlrender](https://github.com/kexue-z/nonebot-plugin-htmlrender)
|
||||
- 支持了 nonebot 2.0.0beta
|
||||
|
||||
## [0.5.1]
|
||||
|
||||
- 使用了新的私聊进行群管理的方式
|
||||
- 默认关闭自动重发功能
|
||||
|
@ -14,7 +14,6 @@ services:
|
||||
HOST: 0.0.0.0
|
||||
# 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
|
||||
|
@ -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
|
||||
|
||||
## 使用
|
||||
|
||||
|
@ -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=''
|
||||
# )
|
@ -14,6 +14,8 @@ class PlugConfig(BaseSettings):
|
||||
bison_skip_browser_check: bool = False
|
||||
bison_use_pic_merge: int = 0 # 多图片时启用图片合并转发(仅限群),当bison_use_queue为False时该配置不会生效
|
||||
# 0:不启用;1:首条消息单独发送,剩余照片合并转发;2以及以上:所有消息全部合并转发
|
||||
bison_resend_times: int = 0
|
||||
|
||||
class Config:
|
||||
extra = "ignore"
|
||||
|
||||
|
@ -59,7 +59,7 @@ async def _send_msgs_dispatch(
|
||||
msg: Union[str, Message],
|
||||
):
|
||||
if plugin_config.bison_use_queue:
|
||||
QUEUE.append((bot, user, user_type, msg, 2))
|
||||
QUEUE.append((bot, user, user_type, msg, plugin_config.bison_resend_times))
|
||||
else:
|
||||
await _do_send(bot, user, user_type, msg)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user