# from venv import logger
#
# from nonebot import on_command
# from nonebot.adapters.onebot.v11 import MessageEvent, Bot, MessageSegment
# from nonebot.plugin import PluginMetadata
# from nonebot.plugin.on import on_message
# from nonebot.rule import to_me
# import io
# import base64
# from .chat import *
#
# __plugin_meta__ = PluginMetadata(
#     name="AI",
#     description="AI?",
#     usage="",
#     type="application",
# )
#
# at_me = on_command("", rule=to_me())
#
#
# # at时忽略上下文
# @at_me.handle()
# async def do_job(bot: Bot, ev: MessageEvent):
#     # gid = ev.group_id
#     # print(gid)
#     # if gid in [872490448, 487723385]:
#     #     logger.info("白名单群， 执行AI回答操作")
#     #     text = ev.message
#     #     message = text.extract_plain_text()
#     #     print(type(text))
#     #     print(text)
#     #     think, answer = await chat(message)
#     #     await at_me.finish(answer)
#     # else:
#     #     logger.info("非白名单群，不执行AI回答操作")
#
# #
# # @query.handle()
# # async def query_job(bot: Bot, ev: MessageEvent):
# #     # 获取当前日期的年份和月份
# #     now = datetime.now()
# #     year = now.year
# #     month = now.month
# #     # 获取发信人信息
# #     uid = str(ev.user_id)
# #     message_id = ev.message_id
# #     # 获取记录
# #     img_file = await draw_calendar_grid_image(uid, year, month)
# #     text_msg = MessageSegment.text("这是您的记鹿：\n")
# #     image_msg = MessageSegment.image(pic2b64(img_file))
# #     mix_msg = (text_msg,)
# #     mix_msg += image_msg
# #     reply_msg = (MessageSegment.reply(message_id),)
# #     reply_msg += mix_msg
# #     await record.finish(reply_msg)
