mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-08 13:20:01 +08:00
refactor code
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
from nonebot import on_command
|
||||
from services.log import logger
|
||||
from nonebot.adapters.cqhttp import Bot, MessageEvent
|
||||
from nonebot.adapters.cqhttp import Bot, MessageEvent, GroupMessageEvent
|
||||
from nonebot.typing import T_State
|
||||
import aiohttp
|
||||
from utils.utils import get_local_proxy
|
||||
|
||||
|
||||
__plugin_name__ = '语录'
|
||||
__plugin_usage__ = '用法: 二次元语录给你力量'
|
||||
__plugin_name__ = "语录"
|
||||
__plugin_usage__ = "用法: 二次元语录给你力量"
|
||||
|
||||
|
||||
quotations = on_command("语录", aliases={'二次元', '二次元语录'}, priority=5, block=True)
|
||||
quotations = on_command("语录", aliases={"二次元", "二次元语录"}, priority=5, block=True)
|
||||
|
||||
url = 'https://international.v1.hitokoto.cn/?c=a'
|
||||
url = "https://international.v1.hitokoto.cn/?c=a"
|
||||
|
||||
|
||||
@quotations.handle()
|
||||
@@ -23,6 +23,6 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
result = f'{data["hitokoto"]}\t——{data["from"]}'
|
||||
await quotations.send(result)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, GROUP {event.group_id if event.message_type != 'private' else 'private'}) 发送语录:"
|
||||
+ result)
|
||||
|
||||
f"(USER {event.user_id}, GROUP {event.group_id if isinstance(event, GroupMessageEvent) else 'private'}) 发送语录:"
|
||||
+ result
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user