master #31
24
main.py
24
main.py
@ -305,9 +305,27 @@ class MyPlugin(Star):
|
||||
testNumber = testNumber + 1
|
||||
yield event.plain_result(f"累积结果: {testNumber}")
|
||||
|
||||
@filter.command("麦否?")
|
||||
async def QAQtest(self, event: AstrMessageEvent):
|
||||
yield event.plain_result("每日一麦")
|
||||
import astrbot.api.message_components as Comp
|
||||
import aiohttp # 需要异步HTTP客户端
|
||||
|
||||
@filter.command("Dora")
|
||||
async def Dora(self, event: AstrMessageEvent):
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get('https://www.doro.asia/api/random-sticker') as resp:
|
||||
if resp.status == 200:
|
||||
data = await resp.json()
|
||||
if data.get('success', False):
|
||||
image_url = data['sticker']['url']
|
||||
chain = [
|
||||
Comp.At(qq=event.get_sender_id()), # At 消息发送者
|
||||
Comp.Plain("Dora:"),
|
||||
Comp.Image.fromURL(image_url), # 使用API返回的图片URL
|
||||
]
|
||||
yield event.chain_result(chain)
|
||||
else:
|
||||
yield "获取表情包失败"
|
||||
else:
|
||||
yield "API请求失败"
|
||||
|
||||
@filter.command("部署")
|
||||
async def bushutest(self, event: AstrMessageEvent):
|
||||
|
Loading…
x
Reference in New Issue
Block a user