zhenxun_bot/plugins/coser/__init__.py
2021-06-15 10:57:08 +08:00

40 lines
762 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from nonebot import on_command
from util.utils import get_message_text
from nonebot.typing import T_State
from nonebot.adapters import Bot, Event
from services.log import logger
from util.init_result import image
import requests
__plugin_name__ = 'coser'
__plugin_usage__ = '用法发送coser'
coser = on_command('cos', aliases={'coser', '括丝'}, priority=5, block=True)
url_2 = 'http://api.rosysun.cn/cos'
@coser.handle()
async def _(bot: Bot, event: Event, state: T_State):
img_url = requests.get(url_2).text
await coser.send(image(img_url))
logger.info(
f"(USER {event.user_id}, GROUP {event.group_id if event.message_type != 'private' else 'private'}) 发送COSER")