refactor code

This commit is contained in:
hibiki
2021-07-30 21:21:51 +08:00
parent 2ad891aa1e
commit cc24822dca
165 changed files with 7815 additions and 8174 deletions
+8 -8
View File
@@ -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
)