-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,020 additions
and
773 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "nonebot-plugin-pixivbot" | ||
version = "2.0.5" | ||
version = "2.1.0" | ||
description = "Nonebot Plugin PixivBot" | ||
authors = ["ssttkkl <[email protected]>"] | ||
readme = "README.md" | ||
|
@@ -14,8 +14,10 @@ packages = [ | |
python = "^3.9" | ||
nonebot2 = "^2.0.0" | ||
nonebot_plugin_apscheduler = ">=0.3.0" | ||
nonebot-plugin-access-control = ">=0.5.5" | ||
nonebot-plugin-session = ">=0.1.0, <0.3.0" | ||
nonebot-plugin-access-control = "^1.0.0" | ||
nonebot-plugin-session = "^0.2.0" | ||
nonebot-plugin-session-orm = "^0.1.1" | ||
nonebot-plugin-session-saa = "^0.1.0" | ||
nonebot-plugin-send-anything-anywhere = ">=0.3.0" | ||
nonebot-plugin-localstore = "^0.5.1" | ||
PixivPy-Async = "^1.2.14" | ||
|
@@ -29,6 +31,8 @@ asyncache = ">=0.3.1" | |
shortuuid = ">=1.0.9" | ||
ssttkkl-nonebot-utils = ">=0.1.14" | ||
aiofiles = ">=23.2.1" | ||
SQLAlchemy = { version = "^2.0.0", extras = ["asyncio"] } | ||
aiosqlite = ">=0.18.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
nb-cli = "^1.0.5" | ||
|
@@ -41,6 +45,10 @@ nonebot-adapter-kaiheila = "^0.2.0" | |
nonebot-adapter-qqguild = "^0.2.2" | ||
autopep8 = "^2.0.4" | ||
|
||
[tool.nonebot] | ||
plugins = ["nonebot_plugin_pixivbot"] | ||
plugin_dirs = [] | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
from typing import Optional | ||
|
||
from nonebot_plugin_datastore.db import get_engine | ||
from nonebot_plugin_session import Session | ||
from nonebot_plugin_session.model import get_or_add_session_model, SessionModel | ||
from sqlalchemy.ext.asyncio import AsyncSession | ||
from nonebot_plugin_session_orm import get_session_persist_id, get_session_by_persist_id | ||
from sqlalchemy.exc import NoResultFound | ||
|
||
from ..global_context import context | ||
|
||
|
||
@context.register_singleton() | ||
class NbSessionRepo: | ||
async def get_id(self, session: Session) -> int: | ||
async with AsyncSession(get_engine()) as db_sess: | ||
model = await get_or_add_session_model(session, db_sess) | ||
return model.id | ||
return await get_session_persist_id(session) | ||
|
||
async def get_session(self, session_id: int) -> Optional[Session]: | ||
async with AsyncSession(get_engine()) as db_sess: | ||
model = await db_sess.get(SessionModel, session_id) | ||
if model is None: | ||
return None | ||
return model.session | ||
try: | ||
return await get_session_by_persist_id(session_id) | ||
except NoResultFound: | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters