Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ jobs:

- name: Run Ruff Lint
uses: chartboost/ruff-action@v1
with:
version: "0.16.2"
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ ignore = [
"PLC0415", # 你别管我为什么不在顶层 import
"PLC0105", # 我们已经用 R 表示协变,Q 表示逆变了
"PLR0913", # 参数就那么多的,你用 builder 什么的不是更逆天?
"PLR0917", # Preserve positional arguments in the existing public API.
"SIM108", # 迫真 simplicy
"RUF001", # String contains ambiguous `,` (FULLWIDTH COMMA). Did you mean `,` (COMMA)?
"RUF002", # Docstring contains ambiguous `,` (FULLWIDTH COMMA). Did you mean `,` (COMMA)?
Expand Down
6 changes: 3 additions & 3 deletions src/nonebot_plugin_alconna/builtins/plugins/with/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
import datetime
import datetime as dt
import json

from arclet.alconna import namespace
Expand Down Expand Up @@ -55,7 +55,7 @@ async def unset(target: MsgTarget):
await with_.finish("取消设置成功")

@with_.handle()
async def _(name: Match[str], target: MsgTarget, time: Match[datetime.datetime]):
async def _(name: Match[str], target: MsgTarget, time: Match[dt.datetime]):
key = json.dumps(target.dump(only_scope=True), ensure_ascii=False)
if not name.available:
if key not in data:
Expand All @@ -66,7 +66,7 @@ async def _(name: Match[str], target: MsgTarget, time: Match[datetime.datetime])
data[key] = name.result
if time.available:
asyncio.get_running_loop().call_later(
abs((time.result - datetime.datetime.now()).total_seconds()), remove, key # noqa: DTZ005
abs((time.result - dt.datetime.now()).total_seconds()), remove, key # noqa: DTZ005
)

await with_.finish("设置前缀成功")
Expand Down
6 changes: 3 additions & 3 deletions src/nonebot_plugin_alconna/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,8 +954,8 @@ def ensure_context(self, bot: Bot, event: Event):

def on_alconna(
command: Alconna | str,
rule: None | Rule | T_RuleChecker = None,
after_rule: None | Rule | T_RuleChecker = None,
rule: Rule | T_RuleChecker | None = None,
after_rule: Rule | T_RuleChecker | None = None,
skip_for_unmatch: bool = True,
auto_send_output: bool | None = None,
aliases: set[str] | tuple[str, ...] | None = None,
Expand All @@ -966,7 +966,7 @@ def on_alconna(
use_cmd_start: bool | None = None,
use_cmd_sep: bool | None = None,
response_self: bool | None = None,
permission: None | Permission | T_PermissionChecker = None,
permission: Permission | T_PermissionChecker | None = None,
*,
handlers: list[T_Handler | Dependent] | None = None,
temp: bool = False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,14 @@ async def reaction(self, emoji: Emoji, mid: Any, bot: Bot, context: Target | Eve
code=emoji.id,
is_add=not delete,
)
elif app_name == "NapCat.Onebot":
elif app_name in ("NapCat.Onebot", "SnowLuma"):
if app_name == "SnowLuma":
# SnowLuma implements the NapCat reaction API for group messages only.
if isinstance(context, Target):
if context.private or context.channel:
return
elif getattr(context, "group_id", None) is None:
return
await bot.call_api(
"set_msg_emoji_like",
message_id=int(message_id),
Expand Down
2 changes: 1 addition & 1 deletion src/nonebot_plugin_alconna/uniseg/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MessageBuilder(Generic[TS], metaclass=ABCMeta):
@abstractmethod
def get_adapter(cls) -> SupportAdapter: ...

def wildcard_build(self, seg: TS) -> Segment | None | list[Segment]:
def wildcard_build(self, seg: TS) -> Segment | list[Segment] | None:
return None

def __init__(self):
Expand Down
Loading