mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-04 03:10:01 +08:00
优化开箱次数判断
This commit is contained in:
+2
-2
@@ -10,9 +10,9 @@ async def init_rank(
|
||||
title: str, all_user_id: List[int], all_user_data: List[int], group_id: int, total_count: int = 10
|
||||
) -> BuildMat:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
初始化通用的数据排行榜
|
||||
参数:
|
||||
参数:
|
||||
:param title: 排行榜标题
|
||||
:param all_user_id: 所有用户的qq号
|
||||
:param all_user_data: 所有用户需要排行的对应数据
|
||||
|
||||
+16
-16
@@ -37,9 +37,9 @@ class AsyncHttpx:
|
||||
**kwargs,
|
||||
) -> Response:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
Get
|
||||
参数:
|
||||
参数:
|
||||
:param url: url
|
||||
:param params: params
|
||||
:param headers: 请求头
|
||||
@@ -80,9 +80,9 @@ class AsyncHttpx:
|
||||
**kwargs,
|
||||
) -> Response:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
Post
|
||||
参数:
|
||||
参数:
|
||||
:param url: url
|
||||
:param data: data
|
||||
:param content: content
|
||||
@@ -129,9 +129,9 @@ class AsyncHttpx:
|
||||
**kwargs,
|
||||
) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
下载文件
|
||||
参数:
|
||||
参数:
|
||||
:param url: url
|
||||
:param path: 存储路径
|
||||
:param params: params
|
||||
@@ -224,9 +224,9 @@ class AsyncHttpx:
|
||||
**kwargs,
|
||||
) -> List[bool]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
分组同时下载文件
|
||||
参数:
|
||||
参数:
|
||||
:param url_list: url列表
|
||||
:param path_list: 存储路径列表
|
||||
:param limit_async_number: 限制同时请求数量
|
||||
@@ -288,9 +288,9 @@ class AsyncPlaywright:
|
||||
@classmethod
|
||||
async def _new_page(cls, user_agent: Optional[str] = None, **kwargs) -> Page:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取一个新页面
|
||||
参数:
|
||||
参数:
|
||||
:param user_agent: 请求头
|
||||
"""
|
||||
browser = await get_browser()
|
||||
@@ -301,9 +301,9 @@ class AsyncPlaywright:
|
||||
@classmethod
|
||||
async def new_context(cls, user_agent: Optional[str] = None, **kwargs) -> BrowserContext:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取一个新上下文
|
||||
参数:
|
||||
参数:
|
||||
:param user_agent: 请求头
|
||||
"""
|
||||
browser = await get_browser()
|
||||
@@ -324,9 +324,9 @@ class AsyncPlaywright:
|
||||
**kwargs
|
||||
) -> Optional[Page]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
goto
|
||||
参数:
|
||||
参数:
|
||||
:param url: 网址
|
||||
:param timeout: 超时限制
|
||||
:param wait_until: 等待类型
|
||||
@@ -360,9 +360,9 @@ class AsyncPlaywright:
|
||||
**kwargs
|
||||
) -> Optional[MessageSegment]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
截图,该方法仅用于简单快捷截图,复杂截图请操作 page
|
||||
参数:
|
||||
参数:
|
||||
:param url: 网址
|
||||
:param path: 存储路径
|
||||
:param element: 元素选择
|
||||
|
||||
+109
-109
@@ -24,9 +24,9 @@ def compare_image_with_hash(
|
||||
image_file1: str, image_file2: str, max_dif: int = 1.5
|
||||
) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
比较两张图片的hash值是否相同
|
||||
参数:
|
||||
参数:
|
||||
:param image_file1: 图片文件路径
|
||||
:param image_file2: 图片文件路径
|
||||
:param max_dif: 允许最大hash差值, 越小越精确,最小为0
|
||||
@@ -45,9 +45,9 @@ def compare_image_with_hash(
|
||||
|
||||
def get_img_hash(image_file: Union[str, Path]) -> ImageHash:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取图片的hash值
|
||||
参数:
|
||||
参数:
|
||||
:param image_file: 图片文件路径
|
||||
"""
|
||||
with open(image_file, "rb") as fp:
|
||||
@@ -59,9 +59,9 @@ def compressed_image(
|
||||
in_file: Union[str, Path], out_file: Union[str, Path] = None, ratio: float = 0.9
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
压缩图片
|
||||
参数:
|
||||
参数:
|
||||
:param in_file: 被压缩的文件路径
|
||||
:param out_file: 压缩后输出的文件路径
|
||||
:param ratio: 压缩率,宽高 * 压缩率
|
||||
@@ -80,9 +80,9 @@ def compressed_image(
|
||||
|
||||
def alpha2white_pil(pic: Image) -> Image:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
将图片透明背景转化为白色
|
||||
参数:
|
||||
参数:
|
||||
:param pic: 通过PIL打开的图片文件
|
||||
"""
|
||||
img = pic.convert("RGBA")
|
||||
@@ -99,9 +99,9 @@ def alpha2white_pil(pic: Image) -> Image:
|
||||
|
||||
def pic2b64(pic: Image) -> str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
PIL图片转base64
|
||||
参数:
|
||||
参数:
|
||||
:param pic: 通过PIL打开的图片文件
|
||||
"""
|
||||
buf = BytesIO()
|
||||
@@ -112,9 +112,9 @@ def pic2b64(pic: Image) -> str:
|
||||
|
||||
def fig2b64(plt_: plt) -> str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
matplotlib图片转base64
|
||||
参数:
|
||||
参数:
|
||||
:param plt_: matplotlib生成的图片
|
||||
"""
|
||||
buf = BytesIO()
|
||||
@@ -125,9 +125,9 @@ def fig2b64(plt_: plt) -> str:
|
||||
|
||||
def is_valid(file: Union[str, Path]) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
判断图片是否损坏
|
||||
参数:
|
||||
参数:
|
||||
:param file: 图片文件路径
|
||||
"""
|
||||
valid = True
|
||||
@@ -160,7 +160,7 @@ class BuildImage:
|
||||
font_color: Optional[Union[str, Tuple[int, int, int]]] = None,
|
||||
):
|
||||
"""
|
||||
参数:
|
||||
参数:
|
||||
:param w: 自定义图片的宽度,w=0时为图片原本宽度
|
||||
:param h: 自定义图片的高度,h=0时为图片原本高度
|
||||
:param paste_image_width: 当图片做为背景图时,设置贴图的宽度,用于贴图自动换行
|
||||
@@ -241,9 +241,9 @@ class BuildImage:
|
||||
center_type: Optional[Literal["center", "by_height", "by_width"]] = None,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 贴图
|
||||
参数:
|
||||
参数:
|
||||
:param img: 已打开的图片文件,可以为 BuildImage 或 Image
|
||||
:param pos: 贴图位置(左上角)
|
||||
:param alpha: 图片背景是否为透明
|
||||
@@ -259,9 +259,9 @@ class BuildImage:
|
||||
center_type: Optional[Literal["center", "by_height", "by_width"]] = None,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
贴图
|
||||
参数:
|
||||
参数:
|
||||
:param img: 已打开的图片文件,可以为 BuildImage 或 Image
|
||||
:param pos: 贴图位置(左上角)
|
||||
:param alpha: 图片背景是否为透明
|
||||
@@ -304,9 +304,9 @@ class BuildImage:
|
||||
|
||||
def getsize(self, msg: str) -> Tuple[int, int]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取文字在该图片 font_size 下所需要的空间
|
||||
参数:
|
||||
参数:
|
||||
:param msg: 文字内容
|
||||
"""
|
||||
return self.font.getsize(msg)
|
||||
@@ -315,9 +315,9 @@ class BuildImage:
|
||||
self, pos: Tuple[int, int], fill: Optional[Tuple[int, int, int]] = None
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 绘制多个或单独的像素
|
||||
参数:
|
||||
参数:
|
||||
:param pos: 坐标
|
||||
:param fill: 填错颜色
|
||||
"""
|
||||
@@ -325,9 +325,9 @@ class BuildImage:
|
||||
|
||||
def point(self, pos: Tuple[int, int], fill: Optional[Tuple[int, int, int]] = None):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
绘制多个或单独的像素
|
||||
参数:
|
||||
参数:
|
||||
:param pos: 坐标
|
||||
:param fill: 填错颜色
|
||||
"""
|
||||
@@ -341,9 +341,9 @@ class BuildImage:
|
||||
width: int = 1,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 绘制圆
|
||||
参数:
|
||||
参数:
|
||||
:param pos: 坐标范围
|
||||
:param fill: 填充颜色
|
||||
:param outline: 描线颜色
|
||||
@@ -359,9 +359,9 @@ class BuildImage:
|
||||
width: int = 1,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
绘制圆
|
||||
参数:
|
||||
参数:
|
||||
:param pos: 坐标范围
|
||||
:param fill: 填充颜色
|
||||
:param outline: 描线颜色
|
||||
@@ -377,9 +377,9 @@ class BuildImage:
|
||||
center_type: Optional[Literal["center", "by_height", "by_width"]] = None,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 在图片上添加文字
|
||||
参数:
|
||||
参数:
|
||||
:param pos: 文字位置
|
||||
:param text: 文字内容
|
||||
:param fill: 文字颜色
|
||||
@@ -395,9 +395,9 @@ class BuildImage:
|
||||
center_type: Optional[Literal["center", "by_height", "by_width"]] = None,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
在图片上添加文字
|
||||
参数:
|
||||
参数:
|
||||
:param pos: 文字位置
|
||||
:param text: 文字内容
|
||||
:param fill: 文字颜色
|
||||
@@ -424,18 +424,18 @@ class BuildImage:
|
||||
|
||||
async def asave(self, path: Optional[Union[str, Path]] = None):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 保存图片
|
||||
参数:
|
||||
参数:
|
||||
:param path: 图片路径
|
||||
"""
|
||||
await self.loop.run_in_executor(None, self.save, path)
|
||||
|
||||
def save(self, path: Optional[Union[str, Path]] = None):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
保存图片
|
||||
参数:
|
||||
参数:
|
||||
:param path: 图片路径
|
||||
"""
|
||||
if not path:
|
||||
@@ -444,16 +444,16 @@ class BuildImage:
|
||||
|
||||
def show(self):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
显示图片
|
||||
"""
|
||||
self.markImg.show(self.markImg)
|
||||
|
||||
async def aresize(self, ratio: float = 0, w: int = 0, h: int = 0):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 压缩图片
|
||||
参数:
|
||||
参数:
|
||||
:param ratio: 压缩倍率
|
||||
:param w: 压缩图片宽度至 w
|
||||
:param h: 压缩图片高度至 h
|
||||
@@ -462,9 +462,9 @@ class BuildImage:
|
||||
|
||||
def resize(self, ratio: float = 0, w: int = 0, h: int = 0):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
压缩图片
|
||||
参数:
|
||||
参数:
|
||||
:param ratio: 压缩倍率
|
||||
:param w: 压缩图片宽度至 w
|
||||
:param h: 压缩图片高度至 h
|
||||
@@ -481,18 +481,18 @@ class BuildImage:
|
||||
|
||||
async def acrop(self, box: Tuple[int, int, int, int]):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 裁剪图片
|
||||
参数:
|
||||
参数:
|
||||
:param box: 左上角坐标,右下角坐标 (left, upper, right, lower)
|
||||
"""
|
||||
await self.loop.run_in_executor(None, self.crop, box)
|
||||
|
||||
def crop(self, box: Tuple[int, int, int, int]):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
裁剪图片
|
||||
参数:
|
||||
参数:
|
||||
:param box: 左上角坐标,右下角坐标 (left, upper, right, lower)
|
||||
"""
|
||||
self.markImg = self.markImg.crop(box)
|
||||
@@ -502,18 +502,18 @@ class BuildImage:
|
||||
|
||||
def check_font_size(self, word: str) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
检查文本所需宽度是否大于图片宽度
|
||||
参数:
|
||||
参数:
|
||||
:param word: 文本内容
|
||||
"""
|
||||
return self.font.getsize(word)[0] > self.w
|
||||
|
||||
async def atransparent(self, alpha_ratio: float = 1, n: int = 0):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 图片透明化
|
||||
参数:
|
||||
参数:
|
||||
:param alpha_ratio: 透明化程度
|
||||
:param n: 透明化大小内边距
|
||||
"""
|
||||
@@ -521,9 +521,9 @@ class BuildImage:
|
||||
|
||||
def transparent(self, alpha_ratio: float = 1, n: int = 0):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
图片透明化
|
||||
参数:
|
||||
参数:
|
||||
:param alpha_ratio: 透明化程度
|
||||
:param n: 透明化大小内边距
|
||||
"""
|
||||
@@ -538,7 +538,7 @@ class BuildImage:
|
||||
|
||||
def pic2bs4(self) -> str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
BuildImage 转 base64
|
||||
"""
|
||||
buf = BytesIO()
|
||||
@@ -548,9 +548,9 @@ class BuildImage:
|
||||
|
||||
def convert(self, type_: str):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
修改图片类型
|
||||
参数:
|
||||
参数:
|
||||
:param type_: 类型
|
||||
"""
|
||||
self.markImg = self.markImg.convert(type_)
|
||||
@@ -563,9 +563,9 @@ class BuildImage:
|
||||
width: int = 1,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 画框
|
||||
参数:
|
||||
参数:
|
||||
:param xy: 坐标
|
||||
:param fill: 填充颜色
|
||||
:param outline: 轮廓颜色
|
||||
@@ -581,9 +581,9 @@ class BuildImage:
|
||||
width: int = 1,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
画框
|
||||
参数:
|
||||
参数:
|
||||
:param xy: 坐标
|
||||
:param fill: 填充颜色
|
||||
:param outline: 轮廓颜色
|
||||
@@ -600,7 +600,7 @@ class BuildImage:
|
||||
"""
|
||||
说明:
|
||||
异步 画多边形
|
||||
参数:
|
||||
参数:
|
||||
:param xy: 坐标
|
||||
:param fill: 颜色
|
||||
:param outline: 线宽
|
||||
@@ -616,7 +616,7 @@ class BuildImage:
|
||||
"""
|
||||
说明:
|
||||
画多边形
|
||||
参数:
|
||||
参数:
|
||||
:param xy: 坐标
|
||||
:param fill: 颜色
|
||||
:param outline: 线宽
|
||||
@@ -630,9 +630,9 @@ class BuildImage:
|
||||
width: int = 1,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 画线
|
||||
参数:
|
||||
参数:
|
||||
:param xy: 坐标
|
||||
:param fill: 填充
|
||||
:param width: 线宽
|
||||
@@ -646,9 +646,9 @@ class BuildImage:
|
||||
width: int = 1,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
画线
|
||||
参数:
|
||||
参数:
|
||||
:param xy: 坐标
|
||||
:param fill: 填充
|
||||
:param width: 线宽
|
||||
@@ -657,14 +657,14 @@ class BuildImage:
|
||||
|
||||
async def acircle(self):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 将 BuildImage 图片变为圆形
|
||||
"""
|
||||
await self.loop.run_in_executor(None, self.circle)
|
||||
|
||||
def circle(self):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
使图像变圆
|
||||
"""
|
||||
self.markImg.convert("RGBA")
|
||||
@@ -693,18 +693,18 @@ class BuildImage:
|
||||
|
||||
async def acircle_corner(self, radii: int = 30):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 矩形四角变圆
|
||||
参数:
|
||||
参数:
|
||||
:param radii: 半径
|
||||
"""
|
||||
await self.loop.run_in_executor(None, self.circle_corner, radii)
|
||||
|
||||
def circle_corner(self, radii: int = 30):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
矩形四角变圆
|
||||
参数:
|
||||
参数:
|
||||
:param radii: 半径
|
||||
"""
|
||||
# 画圆(用于分离4个角)
|
||||
@@ -724,9 +724,9 @@ class BuildImage:
|
||||
|
||||
async def arotate(self, angle: int, expand: bool = False):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 旋转图片
|
||||
参数:
|
||||
参数:
|
||||
:param angle: 角度
|
||||
:param expand: 放大图片适应角度
|
||||
"""
|
||||
@@ -734,9 +734,9 @@ class BuildImage:
|
||||
|
||||
def rotate(self, angle: int, expand: bool = False):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
旋转图片
|
||||
参数:
|
||||
参数:
|
||||
:param angle: 角度
|
||||
:param expand: 放大图片适应角度
|
||||
"""
|
||||
@@ -744,27 +744,27 @@ class BuildImage:
|
||||
|
||||
async def atranspose(self, angle: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 旋转图片(包括边框)
|
||||
参数:
|
||||
参数:
|
||||
:param angle: 角度
|
||||
"""
|
||||
await self.loop.run_in_executor(None, self.transpose, angle)
|
||||
|
||||
def transpose(self, angle: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
旋转图片(包括边框)
|
||||
参数:
|
||||
参数:
|
||||
:param angle: 角度
|
||||
"""
|
||||
self.markImg.transpose(angle)
|
||||
|
||||
async def afilter(self, filter_: str, aud: int = None):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 图片变化
|
||||
参数:
|
||||
参数:
|
||||
:param filter_: 变化效果
|
||||
:param aud: 利率
|
||||
"""
|
||||
@@ -772,9 +772,9 @@ class BuildImage:
|
||||
|
||||
def filter(self, filter_: str, aud: int = None):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
图片变化
|
||||
参数:
|
||||
参数:
|
||||
:param filter_: 变化效果
|
||||
:param aud: 利率
|
||||
"""
|
||||
@@ -804,9 +804,9 @@ class BuildImage:
|
||||
replace_color: Tuple[int, int, int],
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
异步 颜色替换
|
||||
参数:
|
||||
参数:
|
||||
:param src_color: 目标颜色,或者使用列表,设置阈值
|
||||
:param replace_color: 替换颜色
|
||||
"""
|
||||
@@ -822,9 +822,9 @@ class BuildImage:
|
||||
replace_color: Tuple[int, int, int],
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
颜色替换
|
||||
参数:
|
||||
参数:
|
||||
:param src_color: 目标颜色,或者使用元祖,设置阈值
|
||||
:param replace_color: 替换颜色
|
||||
"""
|
||||
@@ -880,9 +880,9 @@ class BuildMat:
|
||||
bar_color: Optional[List[Union[str, Tuple[int, int, int]]]] = None,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
初始化 BuildMat
|
||||
参数:
|
||||
参数:
|
||||
:param y: 坐标值
|
||||
:param mat_type: 图像类型 可能的值:[line]: 折线图,[bar]: 柱状图,[barh]: 横向柱状图
|
||||
:param x_name: 横坐标名称
|
||||
@@ -981,7 +981,7 @@ class BuildMat:
|
||||
"""
|
||||
说明:
|
||||
给坐标点设置新值
|
||||
参数:
|
||||
参数:
|
||||
:param y: 坐标点
|
||||
"""
|
||||
self._check_value(y, self.y_index)
|
||||
@@ -991,7 +991,7 @@ class BuildMat:
|
||||
"""
|
||||
说明:
|
||||
设置y轴坐标值
|
||||
参数:
|
||||
参数:
|
||||
:param y_index: y轴坐标值
|
||||
"""
|
||||
self._check_value(self.y, y_index)
|
||||
@@ -999,9 +999,9 @@ class BuildMat:
|
||||
|
||||
def set_title(self, title: str, color: Optional[Union[str, Tuple[int, int, int]]]):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
设置标题
|
||||
参数:
|
||||
参数:
|
||||
:param title: 标题
|
||||
:param color: 字体颜色
|
||||
"""
|
||||
@@ -1013,9 +1013,9 @@ class BuildMat:
|
||||
self, background: Optional[List[str]], type_: Optional[str] = None
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
设置背景图片
|
||||
参数:
|
||||
参数:
|
||||
:param background: 图片路径列表
|
||||
:param type_: 填充类型
|
||||
"""
|
||||
@@ -1024,32 +1024,32 @@ class BuildMat:
|
||||
|
||||
def show(self):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
展示图像
|
||||
"""
|
||||
self.markImg.show()
|
||||
|
||||
def pic2bs4(self) -> str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
转base64
|
||||
"""
|
||||
return self.markImg.pic2bs4()
|
||||
|
||||
def resize(self, ratio: float = 0.9):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
调整图像大小
|
||||
参数:
|
||||
参数:
|
||||
:param ratio: 比例
|
||||
"""
|
||||
self.markImg.resize(ratio)
|
||||
|
||||
def save(self, path: Union[str, Path]):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
保存图片
|
||||
参数:
|
||||
参数:
|
||||
:param path: 路径
|
||||
"""
|
||||
self.markImg.save(path)
|
||||
@@ -1063,7 +1063,7 @@ class BuildMat:
|
||||
"""
|
||||
说明:
|
||||
检查值合法性
|
||||
参数:
|
||||
参数:
|
||||
:param y: 坐标值
|
||||
:param y_index: y轴坐标值
|
||||
:param x_index: x轴坐标值
|
||||
@@ -1087,7 +1087,7 @@ class BuildMat:
|
||||
"""
|
||||
说明:
|
||||
生成折线图
|
||||
参数:
|
||||
参数:
|
||||
:param y: 坐标点
|
||||
:param display_num: 显示该点的值
|
||||
"""
|
||||
@@ -1134,9 +1134,9 @@ class BuildMat:
|
||||
is_barh: bool = False,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成柱状图
|
||||
参数:
|
||||
参数:
|
||||
:param y: 坐标值
|
||||
:param display_num: 是否显示数值
|
||||
:param is_barh: 横柱状图
|
||||
@@ -1216,9 +1216,9 @@ class BuildMat:
|
||||
is_grid: bool = False,
|
||||
) -> BuildImage:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
初始化图像,生成xy轴
|
||||
参数:
|
||||
参数:
|
||||
:param x_name: x轴名称
|
||||
:param y_name: y轴名称
|
||||
:param x_index: x轴坐标值
|
||||
@@ -1347,7 +1347,7 @@ async def text2image(
|
||||
_add_height: float = 0,
|
||||
) -> BuildImage:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
解析文本并转为图片
|
||||
使用标签
|
||||
<f> </f>
|
||||
@@ -1359,7 +1359,7 @@ async def text2image(
|
||||
在不在,<f font=YSHaoShenTi-2.ttf font_size=30 font_color=red>HibiKi小姐</f>,
|
||||
你最近还好吗,<f font_size=15 font_color=black>我非常想你</f>,这段时间我非常不好过,
|
||||
<f font_size=25>抽卡抽不到金色</f>,这让我很痛苦
|
||||
参数:
|
||||
参数:
|
||||
:param text: 文本
|
||||
:param auto_parse: 是否自动解析,否则原样发送
|
||||
:param font_size: 普通字体大小
|
||||
|
||||
@@ -31,9 +31,9 @@ class GroupManager(StaticData):
|
||||
|
||||
def block_plugin(self, module: str, group_id: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
锁定插件
|
||||
参数:
|
||||
参数:
|
||||
:param module: 功能模块名
|
||||
:param group_id: 群组,None时为超级用户禁用
|
||||
"""
|
||||
@@ -41,9 +41,9 @@ class GroupManager(StaticData):
|
||||
|
||||
def unblock_plugin(self, module: str, group_id: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
解锁插件
|
||||
参数:
|
||||
参数:
|
||||
:param module: 功能模块名
|
||||
:param group_id: 群组
|
||||
"""
|
||||
@@ -51,27 +51,27 @@ class GroupManager(StaticData):
|
||||
|
||||
def turn_on_group_bot_status(self, group_id: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
开启群bot开关
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
self._set_group_bot_status(group_id, True)
|
||||
|
||||
def shutdown_group_bot_status(self, group_id: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
关闭群bot开关
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
self._set_group_bot_status(group_id, False)
|
||||
|
||||
def check_group_bot_status(self, group_id: int) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
检查群聊bot总开关状态
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 说明
|
||||
"""
|
||||
group_id = str(group_id)
|
||||
@@ -86,9 +86,9 @@ class GroupManager(StaticData):
|
||||
|
||||
def set_group_level(self, group_id: int, level: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
设置群权限
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群组
|
||||
:param level: 权限等级
|
||||
"""
|
||||
@@ -100,9 +100,9 @@ class GroupManager(StaticData):
|
||||
|
||||
def get_plugin_status(self, module: str, group_id: int) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取插件状态
|
||||
参数:
|
||||
参数:
|
||||
:param module: 功能模块名
|
||||
:param group_id: 群组
|
||||
"""
|
||||
@@ -116,9 +116,9 @@ class GroupManager(StaticData):
|
||||
|
||||
def get_group_level(self, group_id: int) -> int:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取群等级
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
group_id = str(group_id)
|
||||
@@ -128,18 +128,18 @@ class GroupManager(StaticData):
|
||||
|
||||
def check_group_is_white(self, group_id: int) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
检测群聊是否在白名单
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
return group_id in self._data["super"]["white_group_list"]
|
||||
|
||||
def add_group_white_list(self, group_id: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
将群聊加入白名单
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
if group_id not in self._data["super"]["white_group_list"]:
|
||||
@@ -147,9 +147,9 @@ class GroupManager(StaticData):
|
||||
|
||||
def delete_group_white_list(self, group_id: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
将群聊从白名单中删除
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
if group_id in self._data["super"]["white_group_list"]:
|
||||
@@ -157,16 +157,16 @@ class GroupManager(StaticData):
|
||||
|
||||
def get_group_white_list(self) -> List[str]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取所有群白名单
|
||||
"""
|
||||
return self._data["super"]["white_group_list"]
|
||||
|
||||
def delete_group(self, group_id: int):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
删除群配置
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
if group_id in self._data["group_manager"]:
|
||||
@@ -177,9 +177,9 @@ class GroupManager(StaticData):
|
||||
|
||||
async def open_group_task(self, group_id: int, task: str):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
开启群被动技能
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
:param task: 被动技能名称
|
||||
"""
|
||||
@@ -187,9 +187,9 @@ class GroupManager(StaticData):
|
||||
|
||||
async def close_group_task(self, group_id: int, task: str):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
关闭群被动技能
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
:param task: 被动技能名称
|
||||
"""
|
||||
@@ -197,9 +197,9 @@ class GroupManager(StaticData):
|
||||
|
||||
async def check_group_task_status(self, group_id: int, task: str) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
查看群被动技能状态
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
:param task: 被动技能名称
|
||||
"""
|
||||
@@ -214,16 +214,16 @@ class GroupManager(StaticData):
|
||||
|
||||
def get_task_data(self) -> Dict[str, str]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取所有被动任务
|
||||
"""
|
||||
return self._task
|
||||
|
||||
async def group_task_status(self, group_id: int) -> str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
查看群被全部动技能状态
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
x = "[群被动技能]:\n"
|
||||
@@ -236,9 +236,9 @@ class GroupManager(StaticData):
|
||||
|
||||
async def _set_group_task_status(self, group_id: int, task: str, status: bool):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
管理群被动技能状态
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
:param task: 被动技能
|
||||
:param status: 状态
|
||||
@@ -257,7 +257,7 @@ class GroupManager(StaticData):
|
||||
|
||||
async def init_group_task(self, group_id: Optional[Union[int, str]] = None):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
初始化群聊 被动技能 状态
|
||||
"""
|
||||
if not self._task:
|
||||
@@ -313,9 +313,9 @@ class GroupManager(StaticData):
|
||||
group_id: int,
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
设置功能开关状态
|
||||
参数:
|
||||
参数:
|
||||
:param module: 功能模块名
|
||||
:param status: 功能状态
|
||||
:param group_id: 群组
|
||||
@@ -333,9 +333,9 @@ class GroupManager(StaticData):
|
||||
|
||||
def _init_group(self, group_id: str):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
初始化群数据
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
default_group_level = Config.get_config("group_manager", "DEFAULT_GROUP_LEVEL")
|
||||
@@ -354,9 +354,9 @@ class GroupManager(StaticData):
|
||||
|
||||
def _set_group_bot_status(self, group_id: Union[int, str], status: bool):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
设置群聊bot总开关
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
:param status: 开关状态
|
||||
"""
|
||||
@@ -368,7 +368,7 @@ class GroupManager(StaticData):
|
||||
|
||||
def get_super_old_data(self) -> Optional[dict]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取旧数据,平时使用请不要调用
|
||||
"""
|
||||
if self._data["super"].get("close_plugins"):
|
||||
|
||||
@@ -48,9 +48,9 @@ class PluginsManager(StaticData):
|
||||
self, module: str, group_id: Optional[int] = None, block_type: str = "all"
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
锁定插件
|
||||
参数:
|
||||
参数:
|
||||
:param module: 功能模块名
|
||||
:param group_id: 群组,None时为超级用户禁用
|
||||
:param block_type: 限制类型
|
||||
@@ -59,9 +59,9 @@ class PluginsManager(StaticData):
|
||||
|
||||
def unblock_plugin(self, module: str, group_id: Optional[int] = None):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
解锁插件
|
||||
参数:
|
||||
参数:
|
||||
:param module: 功能模块名
|
||||
:param group_id: 群组
|
||||
"""
|
||||
@@ -71,9 +71,9 @@ class PluginsManager(StaticData):
|
||||
self, module: str, block_type: str = "all"
|
||||
) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取插件状态
|
||||
参数:
|
||||
参数:
|
||||
:param module: 功能模块名
|
||||
:param block_type: 限制类型
|
||||
"""
|
||||
@@ -86,9 +86,9 @@ class PluginsManager(StaticData):
|
||||
|
||||
def get_plugin_block_type(self, module: str) -> str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取功能限制类型
|
||||
参数:
|
||||
参数:
|
||||
:param module: 模块名称
|
||||
"""
|
||||
if module in self._data.keys():
|
||||
@@ -112,9 +112,9 @@ class PluginsManager(StaticData):
|
||||
block_type: str = "all",
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
设置功能开关状态
|
||||
参数:
|
||||
参数:
|
||||
:param module: 功能模块名
|
||||
:param status: 功能状态
|
||||
:param group_id: 群组
|
||||
|
||||
@@ -8,9 +8,9 @@ class WithdrawMessageManager:
|
||||
|
||||
def append(self, message_data: Tuple[Union[int, Dict[str, int]], int]):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
添加一个撤回消息id和时间
|
||||
参数:
|
||||
参数:
|
||||
:param message_data: 撤回消息id和时间
|
||||
"""
|
||||
if isinstance(message_data[0], dict):
|
||||
@@ -19,9 +19,9 @@ class WithdrawMessageManager:
|
||||
|
||||
def remove(self, message_data: Tuple[int, int]):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
删除一个数据
|
||||
参数:
|
||||
参数:
|
||||
:param message_data: 消息id和时间
|
||||
"""
|
||||
self.data.remove(message_data)
|
||||
|
||||
+27
-25
@@ -13,10 +13,10 @@ def image(
|
||||
b64: str = None,
|
||||
) -> Union[MessageSegment, str]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.image 消息
|
||||
生成顺序:绝对路径(abspath) > base64(b64) > img_name
|
||||
参数:
|
||||
参数:
|
||||
:param file: 图片文件名称,默认在 resource/img 目录下
|
||||
:param path: 图片所在路径,默认在 resource/img 目录下
|
||||
:param b64: 图片base64
|
||||
@@ -42,11 +42,11 @@ def image(
|
||||
return ""
|
||||
|
||||
|
||||
def at(qq: int) -> MessageSegment:
|
||||
def at(qq: Union[int, str]) -> MessageSegment:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.at 消息
|
||||
参数:
|
||||
参数:
|
||||
:param qq: qq号
|
||||
"""
|
||||
return MessageSegment.at(qq)
|
||||
@@ -54,9 +54,9 @@ def at(qq: int) -> MessageSegment:
|
||||
|
||||
def record(voice_name: str, path: str = None) -> MessageSegment or str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.record 消息
|
||||
参数:
|
||||
参数:
|
||||
:param voice_name: 音频文件名称,默认在 resource/voice 目录下
|
||||
:param path: 音频文件路径,默认在 resource/voice 目录下
|
||||
"""
|
||||
@@ -79,9 +79,9 @@ def record(voice_name: str, path: str = None) -> MessageSegment or str:
|
||||
|
||||
def text(msg: str) -> MessageSegment:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.text 消息
|
||||
参数:
|
||||
参数:
|
||||
:param msg: 消息文本
|
||||
"""
|
||||
return MessageSegment.text(msg)
|
||||
@@ -89,9 +89,9 @@ def text(msg: str) -> MessageSegment:
|
||||
|
||||
def contact_user(qq: int) -> MessageSegment:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.contact_user 消息
|
||||
参数:
|
||||
参数:
|
||||
:param qq: qq号
|
||||
"""
|
||||
return MessageSegment.contact_user(qq)
|
||||
@@ -101,9 +101,9 @@ def share(
|
||||
url: str, title: str, content: str = None, image_url: str = None
|
||||
) -> MessageSegment:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.share 消息
|
||||
参数:
|
||||
参数:
|
||||
:param url: 自定义分享的链接
|
||||
:param title: 自定义分享的包体
|
||||
:param content: 自定义分享的内容
|
||||
@@ -114,9 +114,9 @@ def share(
|
||||
|
||||
def xml(data: str) -> MessageSegment:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.xml 消息
|
||||
参数:
|
||||
参数:
|
||||
:param data: 数据文本
|
||||
"""
|
||||
return MessageSegment.xml(data)
|
||||
@@ -124,9 +124,9 @@ def xml(data: str) -> MessageSegment:
|
||||
|
||||
def json(data: str) -> MessageSegment:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.json 消息
|
||||
参数:
|
||||
参数:
|
||||
:param data: 消息数据
|
||||
"""
|
||||
return MessageSegment.json(data)
|
||||
@@ -134,9 +134,9 @@ def json(data: str) -> MessageSegment:
|
||||
|
||||
def face(id_: int) -> MessageSegment:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.face 消息
|
||||
参数:
|
||||
参数:
|
||||
:param id_: 表情id
|
||||
"""
|
||||
return MessageSegment.face(id_)
|
||||
@@ -144,9 +144,9 @@ def face(id_: int) -> MessageSegment:
|
||||
|
||||
def poke(qq: int) -> MessageSegment:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
生成一个 MessageSegment.poke 消息
|
||||
参数:
|
||||
参数:
|
||||
:param qq: qq号
|
||||
"""
|
||||
return MessageSegment("poke", {"qq": qq})
|
||||
@@ -160,10 +160,12 @@ def custom_forward_msg(
|
||||
msg_list: List[Union[str, Message]], uin: Union[int, str], name: str = f"这里是{NICKNAME}"
|
||||
) -> List[dict]:
|
||||
"""
|
||||
生成自定义合并消息
|
||||
:param msg_list: 消息列表
|
||||
:param uin: 发送者 QQ
|
||||
:param name: 自定义名称
|
||||
说明:
|
||||
生成自定义合并消息
|
||||
参数:
|
||||
:param msg_list: 消息列表
|
||||
:param uin: 发送者 QQ
|
||||
:param name: 自定义名称
|
||||
"""
|
||||
uin = int(uin)
|
||||
mes_list = []
|
||||
|
||||
+29
-29
@@ -150,9 +150,9 @@ class DailyNumberLimiter:
|
||||
|
||||
def is_number(s: str) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
检测 s 是否为数字
|
||||
参数:
|
||||
参数:
|
||||
:param s: 文本
|
||||
"""
|
||||
try:
|
||||
@@ -172,7 +172,7 @@ def is_number(s: str) -> bool:
|
||||
|
||||
def get_bot() -> Optional[Bot]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取 bot 对象
|
||||
"""
|
||||
try:
|
||||
@@ -194,9 +194,9 @@ def get_matchers() -> List[Type[Matcher]]:
|
||||
|
||||
def get_message_at(data: Union[str, Message]) -> List[int]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取消息中所有的 at 对象的 qq
|
||||
参数:
|
||||
参数:
|
||||
:param data: event.json()
|
||||
"""
|
||||
qq_list = []
|
||||
@@ -214,9 +214,9 @@ def get_message_at(data: Union[str, Message]) -> List[int]:
|
||||
|
||||
def get_message_img(data: Union[str, Message]) -> List[str]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取消息中所有的 图片 的链接
|
||||
参数:
|
||||
参数:
|
||||
:param data: event.json()
|
||||
"""
|
||||
img_list = []
|
||||
@@ -233,9 +233,9 @@ def get_message_img(data: Union[str, Message]) -> List[str]:
|
||||
|
||||
def get_message_img_file(data: Union[str, Message]) -> List[str]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取消息中所有的 图片file
|
||||
参数:
|
||||
参数:
|
||||
:param data: event.json()
|
||||
"""
|
||||
file_list = []
|
||||
@@ -252,9 +252,9 @@ def get_message_img_file(data: Union[str, Message]) -> List[str]:
|
||||
|
||||
def get_message_text(data: Union[str, Message]) -> str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取消息中 纯文本 的信息
|
||||
参数:
|
||||
参数:
|
||||
:param data: event.json()
|
||||
"""
|
||||
result = ""
|
||||
@@ -267,14 +267,14 @@ def get_message_text(data: Union[str, Message]) -> str:
|
||||
else:
|
||||
for seg in data["text"]:
|
||||
result += seg.data["text"] + " "
|
||||
return result
|
||||
return result.strip()
|
||||
|
||||
|
||||
def get_message_record(data: Union[str, Message]) -> List[str]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取消息中所有 语音 的链接
|
||||
参数:
|
||||
参数:
|
||||
:param data: event.json()
|
||||
"""
|
||||
record_list = []
|
||||
@@ -291,9 +291,9 @@ def get_message_record(data: Union[str, Message]) -> List[str]:
|
||||
|
||||
def get_message_json(data: str) -> List[dict]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取消息中所有 json
|
||||
参数:
|
||||
参数:
|
||||
:param data: event.json()
|
||||
"""
|
||||
try:
|
||||
@@ -309,7 +309,7 @@ def get_message_json(data: str) -> List[dict]:
|
||||
|
||||
def get_local_proxy():
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
获取 config.py 中设置的代理
|
||||
"""
|
||||
return SYSTEM_PROXY if SYSTEM_PROXY else None
|
||||
@@ -317,9 +317,9 @@ def get_local_proxy():
|
||||
|
||||
def is_chinese(word: str) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
判断字符串是否为纯中文
|
||||
参数:
|
||||
参数:
|
||||
:param word: 文本
|
||||
"""
|
||||
for ch in word:
|
||||
@@ -330,9 +330,9 @@ def is_chinese(word: str) -> bool:
|
||||
|
||||
async def get_user_avatar(qq: int) -> Optional[bytes]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
快捷获取用户头像
|
||||
参数:
|
||||
参数:
|
||||
:param qq: qq号
|
||||
"""
|
||||
url = f"http://q1.qlogo.cn/g?b=qq&nk={qq}&s=160"
|
||||
@@ -347,9 +347,9 @@ async def get_user_avatar(qq: int) -> Optional[bytes]:
|
||||
|
||||
async def get_group_avatar(group_id: int) -> Optional[bytes]:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
快捷获取用群头像
|
||||
参数:
|
||||
参数:
|
||||
:param group_id: 群号
|
||||
"""
|
||||
url = f"http://p.qlogo.cn/gh/{group_id}/{group_id}/640/"
|
||||
@@ -364,9 +364,9 @@ async def get_group_avatar(group_id: int) -> Optional[bytes]:
|
||||
|
||||
def cn2py(word: str) -> str:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
将字符串转化为拼音
|
||||
参数:
|
||||
参数:
|
||||
:param word: 文本
|
||||
"""
|
||||
temp = ""
|
||||
@@ -379,9 +379,9 @@ def change_pixiv_image_links(
|
||||
url: str, size: Optional[str] = None, nginx_url: Optional[str] = None
|
||||
):
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
根据配置改变图片大小和反代链接
|
||||
参数:
|
||||
参数:
|
||||
:param url: 图片原图链接
|
||||
:param size: 模式
|
||||
:param nginx_url: 反代
|
||||
@@ -404,9 +404,9 @@ def change_pixiv_image_links(
|
||||
|
||||
def change_img_md5(path_file: Union[str, Path]) -> bool:
|
||||
"""
|
||||
说明:
|
||||
说明:
|
||||
改变图片MD5
|
||||
参数:
|
||||
参数:
|
||||
:param path_file: 图片路径
|
||||
"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user