Skip to content

Commit

Permalink
🎨 format
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Nov 9, 2024
1 parent 82430b7 commit 79b12f2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,10 @@ class RaianConfig(BaseConfig):
@property
def plugin_data_dir(self) -> Path:
return Path.cwd() / self.data_dir / self.plugin.root

@property
def plugin_data_relative(self) -> Path:
return Path(".") / self.data_dir / self.plugin.root
return Path(".") / self.data_dir / self.plugin.root


def load_config(root_dir: Union[str, Path] = "config") -> RaianConfig:
Expand Down
2 changes: 1 addition & 1 deletion app/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def deserialize_message(content: list[dict], image_path: Path):
if elem["type"] == "Text":
res.append(Text(elem["text"]))
elif elem["type"] == "Image":
res.append(Picture(LocalFileResource(image_path /elem["path"])))
res.append(Picture(LocalFileResource(image_path / elem["path"])))
elif elem["type"] == "Face":
res.append(Face(elem["id"], elem["name"]))
return MessageChain(res)
5 changes: 5 additions & 0 deletions app/shortcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,23 @@ def wrapper(func: T_Callable) -> T_Callable:

return wrapper


@overload
def accessable() -> Callable[[T_Callable], T_Callable]: ...


@overload
def accessable(path: str) -> Callable[[T_Callable], T_Callable]: ...


@overload
def accessable(path: None) -> Callable[[T_Callable], T_Callable]: ...


@overload
def accessable(path: T_Callable) -> T_Callable: ...


def accessable(path: str | T_Callable | None = None) -> T_Callable | Callable[..., T_Callable]:
def wrapper(func: T_Callable) -> T_Callable:
nonlocal path
Expand Down
3 changes: 1 addition & 2 deletions plugins/admin/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
from graia.saya import Saya
from sqlalchemy import select

from app.core import BotServiceCtx
from app.config import BotConfig, extract_plugin_config
from app.core import RaianBotService
from app.core import BotServiceCtx, RaianBotService
from app.database import DatabaseService, Group
from app.image import md2img
from app.shortcut import exclusive, permission, picture
Expand Down
2 changes: 1 addition & 1 deletion plugins/nudge/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def rua(
aio: AiohttpClientService,
):
target = arp.query[Union[Notice, int]]("target", 0)
target_id = target if isinstance(target, int) else int(target.target.pattern["member"])
target_id = target if isinstance(target, int) else int(target.target.pattern["member"])
async with aio.session.get(f"https://q1.qlogo.cn/g?b=qq&nk={target_id}&s=640") as resp:
data = await resp.read()
img = generate(data).getvalue()
Expand Down

0 comments on commit 79b12f2

Please sign in to comment.