Compare commits

...

2 Commits

Author SHA1 Message Date
QAQ
c4fb786d5a Merge pull request 'Dora表情包' (#23) from QAQ into master
Reviewed-on: #23
2025-05-22 17:44:21 +08:00
“QAQ”
263c2476fc Dora表情包 2025-05-22 17:41:15 +08:00

24
main.py
View File

@ -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):