refactor: 修改引入风格

This commit is contained in:
RockChinQ
2023-11-13 21:59:23 +08:00
parent e3b280758c
commit 665de5dc43
47 changed files with 324 additions and 364 deletions
+7 -6
View File
@@ -1,11 +1,12 @@
from ..aamgr import AbstractCommandNode, Context
import logging
from mirai import Image
import mirai
from .. import aamgr
import config
@AbstractCommandNode.register(
@aamgr.AbstractCommandNode.register(
parent=None,
name="draw",
description="使用DALL·E生成图片",
@@ -13,9 +14,9 @@ import config
aliases=[],
privilege=1
)
class DrawCommand(AbstractCommandNode):
class DrawCommand(aamgr.AbstractCommandNode):
@classmethod
def process(cls, ctx: Context) -> tuple[bool, list]:
def process(cls, ctx: aamgr.Context) -> tuple[bool, list]:
import pkg.openai.session
reply = []
@@ -28,7 +29,7 @@ class DrawCommand(AbstractCommandNode):
res = session.draw_image(" ".join(ctx.params))
logging.debug("draw_image result:{}".format(res))
reply = [Image(url=res['data'][0]['url'])]
reply = [mirai.Image(url=res['data'][0]['url'])]
if not (hasattr(config, 'include_image_description')
and not config.include_image_description):
reply.append(" ".join(ctx.params))
+4 -5
View File
@@ -1,10 +1,9 @@
from ..aamgr import AbstractCommandNode, Context
import logging
import json
from .. import aamgr
@AbstractCommandNode.register(
@aamgr.AbstractCommandNode.register(
parent=None,
name="func",
description="管理内容函数",
@@ -12,9 +11,9 @@ import json
aliases=[],
privilege=1
)
class FuncCommand(AbstractCommandNode):
class FuncCommand(aamgr.AbstractCommandNode):
@classmethod
def process(cls, ctx: Context) -> tuple[bool, list]:
def process(cls, ctx: aamgr.Context) -> tuple[bool, list]:
from pkg.plugin.models import host
reply = []