Skip to content

Commit

Permalink
🎨 format
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Aug 25, 2023
1 parent 8291959 commit 91a21ed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/adapters/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@

from nonebot_plugin_alconna.uniseg import At
from nonebot_plugin_alconna.argv import MessageArgv
from nonebot_plugin_alconna.uniseg import Image as UniImg
from nonebot_plugin_alconna.typings import SegmentPattern
from nonebot_plugin_alconna.uniseg import Image as UniImg


class DiscordMessageArgv(MessageArgv):
Expand Down
21 changes: 4 additions & 17 deletions src/nonebot_plugin_alconna/params.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import inspect
from typing_extensions import Annotated, TypeAlias
from typing import (
Any,
Dict,
Type,
Tuple,
Union,
TypeVar,
Callable,
Optional,
overload,
)
from typing import Any, Dict, Type, Tuple, Union, TypeVar, Callable, Optional, overload

from nonebot.typing import T_State
from tarina.generic import get_origin
Expand All @@ -21,13 +11,9 @@
from tarina import run_always_await, generic_issubclass
from arclet.alconna import Empty, Alconna, Arparma, Duplication

from .model import T, Match, Query, CommandResult
from .consts import (
ALCONNA_RESULT,
ALCONNA_ARG_KEY,
ALCONNA_EXEC_RESULT,
)
from .uniseg import UniMessage
from .model import T, Match, Query, CommandResult
from .consts import ALCONNA_RESULT, ALCONNA_ARG_KEY, ALCONNA_EXEC_RESULT

T_Duplication = TypeVar("T_Duplication", bound=Duplication)
MIDDLEWARE: TypeAlias = Callable[[Bot, T_State, Any], Any]
Expand Down Expand Up @@ -118,6 +104,7 @@ def _alconna_arg(state: T_State) -> Any:
async def _uni_msg(bot: Bot, event: Event) -> UniMessage:
return await UniMessage.generate(event, bot)


def UniversalMessage() -> UniMessage:
return Depends(_uni_msg, use_cache=True)

Expand Down
8 changes: 4 additions & 4 deletions src/nonebot_plugin_alconna/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AlconnaRule:
"output_converter",
"comp_config",
"use_origin",
"use_cmd_start"
"use_cmd_start",
)

def __init__(
Expand All @@ -71,9 +71,9 @@ def __init__(
config = Config.parse_obj(global_config)
self.auto_send = auto_send_output or config.alconna_auto_send_output
if (
not command.prefixes and
(use_cmd_start or config.alconna_use_command_start) and
global_config.command_start
not command.prefixes
and (use_cmd_start or config.alconna_use_command_start)
and global_config.command_start
):
command_manager.delete(command)
command.prefixes = list(global_config.command_start)
Expand Down
1 change: 1 addition & 0 deletions src/nonebot_plugin_alconna/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from .uniseg import Image


async def image_fetch(bot: Bot, state: T_State, img: Image):
if img.url: # mirai2, qqguild, kook, villa, feishu, minecraft, ding
req = Request("GET", img.url)
Expand Down

0 comments on commit 91a21ed

Please sign in to comment.