mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-11 15:00:00 +08:00
update code
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import aiohttp
|
||||
from utils.user_agent import get_user_agent
|
||||
from io import BytesIO
|
||||
from random import choice
|
||||
from nonebot import on_regex
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters.cqhttp import Bot, GroupMessageEvent
|
||||
from utils.utils import get_message_text, get_local_proxy, get_message_at
|
||||
from utils.utils import get_message_text, get_message_at
|
||||
from utils.message_builder import image
|
||||
import re
|
||||
from utils.image_utils import CreateImg
|
||||
@@ -16,15 +15,15 @@ __plugin_usage__ = "用法:我有一个朋友说/问 [消息] [at](不艾特
|
||||
|
||||
one_friend = on_regex(
|
||||
"^我.*?朋友.*?(想问问|说|让我问问|想问|让我问|想知道|让我帮他问问|让我帮他问|让我帮忙问|让我帮忙问问|问).*",
|
||||
priority=5,
|
||||
priority=4,
|
||||
block=True,
|
||||
)
|
||||
|
||||
|
||||
async def get_pic(qq):
|
||||
url = f"http://q1.qlogo.cn/g?b=qq&nk={qq}&s=100"
|
||||
async with aiohttp.ClientSession(headers=get_user_agent()) as session:
|
||||
async with session.get(url, proxy=get_local_proxy(), timeout=5) as response:
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url, timeout=5) as response:
|
||||
return await response.read()
|
||||
|
||||
|
||||
@@ -59,7 +58,7 @@ async def _(bot: Bot, event: GroupMessageEvent, state: T_State):
|
||||
text.text((0, 0), user_name)
|
||||
A = CreateImg(700, 150, font_size=25, color="white")
|
||||
A.paste(ava, (30, 25), True)
|
||||
A.paste(text, (150, 40))
|
||||
A.paste(text, (150, 38))
|
||||
A.text((150, 85), msg, (125, 125, 125))
|
||||
|
||||
await one_friend.send(image(b64=A.pic2bs4()))
|
||||
|
||||
Reference in New Issue
Block a user