Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade: 适配 Nonebot2 v2.0.0a16 #57

Merged
merged 103 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
e1b80fc
Upgrade: 优化复读插件执行逻辑
Ailitonia Aug 10, 2021
2db0d21
Breaking: NoneBot 2.0.0a14 适配
Ailitonia Aug 10, 2021
db14e72
Break: 项目结构调整
Ailitonia Aug 14, 2021
2c31024
Upgrade: 更新明日方舟卡池
Ailitonia Aug 14, 2021
3ca7004
Add: 消息解析模块
Ailitonia Aug 14, 2021
603e1f9
Change: 已移除的群管插件调整为独立的欢迎消息插件和邀请管理插件
Ailitonia Aug 14, 2021
e3dc89b
Upgrade: 部分插件说明更新
Ailitonia Aug 14, 2021
5e6fd38
Fix: 修复历史记录对不同事件类型属性的获取的问题
Ailitonia Aug 14, 2021
d1a5561
Add: 新增插件调用统计
Ailitonia Aug 14, 2021
1f8d71d
Upgrade: README.md (#48)
Ailitonia Aug 14, 2021
41c1d47
Merge pull request #50 from Ailitonia/dev-a15
Ailitonia Aug 14, 2021
4cf2507
Change: 调整部分插件优先级和插件名
Ailitonia Aug 14, 2021
2cc79e7
Change: 后台任务模块名
Ailitonia Aug 14, 2021
64b59dc
Add: 插件用量统计插件
Ailitonia Aug 14, 2021
af91347
Fix: pyplot RuntimeError caused by GUI needed
Ailitonia Aug 15, 2021
3c14c29
Fix: ProcessUtils 切片大小判断逻辑问题
Ailitonia Aug 15, 2021
d1056f8
Fix: Typo in PicEncoder
Ailitonia Aug 15, 2021
358a109
Upgrade: pixiv 作品搜索功能
Ailitonia Aug 15, 2021
551f659
Change: folder name (#51 git ignore folder name case in windows)
Ailitonia Aug 16, 2021
c896423
Fix: folder name (#51 git ignore folder name case in windows)
Ailitonia Aug 16, 2021
2a8ceaa
Upgrade: 优化历史记录字段长度问题
Ailitonia Aug 16, 2021
8eb53dc
Upgrade: 优化 pixiv 作品搜索
Ailitonia Aug 16, 2021
54d8f5f
Fix: Type of msg in History
Ailitonia Aug 16, 2021
5a913fd
Add: 一些奇怪的测试用例
Ailitonia Aug 16, 2021
8b05469
Change: 调整了审轴姬的输出
Ailitonia Aug 18, 2021
aa2e752
Fix: 修复赋值__plugin_name__与nb2自身处理冲突 (nonebot/nonebot2/issues/502)
Ailitonia Aug 18, 2021
ea2504f
Change: Edit args
Ailitonia Aug 24, 2021
30a1b63
Upgrade: 腾讯云模块添加文本纠错方法
Ailitonia Aug 24, 2021
c1836dc
Upgrade: 腾讯云插件添加闲聊功能
Ailitonia Aug 24, 2021
7e8a57a
Change: Edit args
Ailitonia Aug 25, 2021
3ce1fe3
Change: 调整公共资源文件位置
Ailitonia Aug 25, 2021
5b4bc8b
Upgrade: 明日方舟卡池
Ailitonia Aug 25, 2021
273212b
Upgrade: Pixiv插件搜索时合成并发送预览图
Ailitonia Aug 25, 2021
0930480
Fix typo
Ailitonia Aug 25, 2021
763f4b5
Change: 涩图插件搜索匹配方法
Ailitonia Aug 25, 2021
ba01b9d
Change: pixiv插件对用户输入的处理
Ailitonia Aug 26, 2021
a2b9544
Change: 调整统计插件使用权限
Ailitonia Aug 26, 2021
44ba46d
Upgrade: 数据库pixiv随机作品添加长宽比筛选
Ailitonia Aug 26, 2021
ac31da1
Upgrade: 移除dd老黄历功能,新增"帮我选"功能
Ailitonia Aug 26, 2021
675acd2
Upgrade: 全新卡片形式的签到
Ailitonia Aug 26, 2021
9979490
Merge pull request #52 from Ailitonia/master
Ailitonia Aug 26, 2021
fafb0f4
Upgrade: 签到插件新增等级条
Ailitonia Aug 27, 2021
c21009d
Merge branch 'dev' of https://github.com/Ailitonia/omega-miya into dev
Ailitonia Aug 27, 2021
ba89339
Fix: Typo
Ailitonia Aug 28, 2021
771755f
Fix: 计算模组处理括号前 a(x+y) 的简写形式的问题
Ailitonia Aug 28, 2021
35d4a3f
Upgrade: HttpFetcher添加默认headers
Ailitonia Aug 28, 2021
2ec67f0
Upgrade: 签到插件添加运势(一言)卡片
Ailitonia Aug 28, 2021
031b6f3
Change: 涩图插件匹配模式改为config配置
Ailitonia Aug 28, 2021
4abff25
Upgrade: 签到插件增加兑换机制 签到时将能量值兑换为好感度
Ailitonia Aug 28, 2021
2adfaeb
Upgrade: 优化签到插件和好感度对新入群不在用户表中的用户的处理
Ailitonia Aug 29, 2021
211ea6e
Fix: 签到后硬币显示错误的问题
Ailitonia Aug 29, 2021
b2a0032
Fix: 历史记录event中可能出现部分字段存在但为None的情况
Ailitonia Aug 29, 2021
c1f7bb3
Upgrade: 优化了rule对群组事件的判断
Ailitonia Aug 29, 2021
9abd9a1
Upgrade: 表情包插件新增模板 鲁迅说/鲁迅写
Ailitonia Aug 29, 2021
342c08e
Upgrade: 数据库User对象添加查询签到状态方法
Ailitonia Aug 29, 2021
3177e9b
Upgrade: 签到插件添加戳一戳签到
Ailitonia Aug 29, 2021
68e40e3
Upgrade: 统一重复签到后发送今日运势卡片
Ailitonia Aug 29, 2021
91d084d
Change: 签到插件文本调整
Ailitonia Aug 31, 2021
2c7ed85
Add: 塔罗牌插件资源
Ailitonia Aug 31, 2021
a2d1993
Add: 塔罗牌插件(基础架构)
Ailitonia Aug 31, 2021
33aba92
Change: 签到插件好感度数值调整
Ailitonia Sep 2, 2021
2c62048
Upgrade: 调整文本分割和文字转图片方法到TextUtils类
Ailitonia Sep 2, 2021
c64888d
Upgrade: 优化塔罗插件类 删除了一些花里胡哨的东西
Ailitonia Sep 2, 2021
5eae293
Remove: 从抽卡插件移除塔罗牌卡组
Ailitonia Sep 2, 2021
a348ac0
Upgrade: README.md
Ailitonia Sep 2, 2021
b37710e
Upgrade: 更新明日方舟卡池
Ailitonia Sep 2, 2021
d0fc841
Upgrade: 签到插件头图更新任务控制配置
Ailitonia Sep 3, 2021
86b0fb9
Add: 塔罗牌图片资源
Ailitonia Sep 3, 2021
9e4c0dc
Add: 塔罗插件相关卡牌数据
Ailitonia Sep 3, 2021
bbfd176
Upgrade: 签到插件设置签到头图缓存数量限制 更新时自动清理超出数量限制的图片缓存
Ailitonia Sep 4, 2021
56bfcad
Upgrade: 签到插件老黄历文本内容更新
Ailitonia Sep 4, 2021
ee4d76d
Upgrade: 签到插件老黄历文本内容更新
Ailitonia Sep 5, 2021
a4af994
Upgrade: 更新塔罗插件相关卡牌数据
Ailitonia Sep 5, 2021
e400a15
Change: Edited some args
Ailitonia Sep 8, 2021
28d7372
Upgrade: 依赖更新
Ailitonia Sep 8, 2021
993ce7c
Upgrade: 为签到插件正则匹配 matcher 添加开关配置(#53)
Ailitonia Sep 8, 2021
504d526
Fix: 重置随机种子以消除同模块下确定随机种子的影响
Ailitonia Sep 8, 2021
8194767
Fix: 正确地转义处理数据库密码中的特殊字符
Ailitonia Sep 11, 2021
0261ad9
Upgrade: 插件权限声明方法优化
Ailitonia Sep 11, 2021
ee2c4a7
Breaking: 冷却系统重构 (#49)
Ailitonia Sep 11, 2021
8a365f6
Add: 速率控制模块
Ailitonia Sep 11, 2021
9634bd4
Add: 插件管理基础模块, 添加数据库相关表
Ailitonia Sep 12, 2021
e598dea
Add: 插件管理器 (#49)
Ailitonia Sep 12, 2021
6063263
Merge pull request #54 from Ailitonia/dev_perm_coold
Ailitonia Sep 12, 2021
282e8fc
Upgrade: 对交互消息中的权限节点进行排序
Ailitonia Sep 12, 2021
c7ad358
Change: 自定义权限节点函数调整
Ailitonia Sep 12, 2021
31a5b9e
Change: 调整涩图插件图片加载
Ailitonia Sep 12, 2021
51a8aa5
Upgrade: 优化反闪照插件对图片消息段的处理 提高兼容性
Ailitonia Sep 12, 2021
5e0d53a
Change: 调整插件管理器 preprocessor 的处理流程
Ailitonia Sep 12, 2021
2c3d3b1
Add: pillow-text-anchors-reference
Ailitonia Sep 13, 2021
614066a
Upgrade: 优化表情包插件模板绘制逻辑 相关组件参数优化
Ailitonia Sep 13, 2021
9ebcdc3
Change: 调整了速率控制模块在事件中的处理逻辑, 避免同一事件引发多个 matcher 处理导致误判
Ailitonia Sep 15, 2021
8f86c45
Undo: 插件统计改错了, 改回来
Ailitonia Sep 15, 2021
db5f14e
Fix: B站动态解析某些不存在字段的问题
Ailitonia Sep 20, 2021
ec454bb
Upgrade: 明日方舟卡池
Ailitonia Sep 20, 2021
842a695
Upgrade: 优化自助撤回权限配置命令交互
Ailitonia Sep 25, 2021
7f9dac3
Add: 流控插件及相关事件处理模块 (preview) (#35)
Ailitonia Sep 25, 2021
d73540e
Change: 相似图片搜索命令添加cd
Ailitonia Oct 6, 2021
f285d7e
Breaking: 数据库订阅表 sub_id 字段改为 str 类型
Ailitonia Oct 6, 2021
a4793e9
Upgrade: 更新依赖, 适配 nonebot2 v2.0.0a16
Ailitonia Oct 6, 2021
8b6aab1
Upgrade: 优化用户速率控制模块
Ailitonia Oct 6, 2021
77f06ee
Upgrade: 管理插件新增退群命令 (#35)
Ailitonia Oct 6, 2021
7092936
Delete tarot_data.xlsx
Ailitonia Oct 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@
基于 [Nonebot2](https://github.com/nonebot/nonebot2) 的 qq 机器人

![GitHub](https://img.shields.io/github/license/Ailitonia/omega-miya)
![Python](https://img.shields.io/badge/Python-3.8+-blue)
![Python](https://img.shields.io/badge/Python-3.9+-blue)
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/Ailitonia/omega-miya?include_prereleases)
![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/Ailitonia/omega-miya)

</div>

## 当前适配nonebot2版本

[Nonebot2 Pre Release v2.0.0a13.post1](https://github.com/nonebot/nonebot2/releases/tag/v2.0.0a13.post1)
[Nonebot2 Pre Release v2.0.0a16](https://github.com/nonebot/nonebot2/releases/tag/v2.0.0a16)

## 功能 & 特点

- 基于异步 SQLAlchemy / MySQL 的数据存储
- 插件管理系统
- 权限控制及管理系统
- 针对不同群组可选启用通知权限、命令权限、权限等级控制
- 针对不同好友可选启用 Bot 功能
- 针对不同群组、好友独立配置插件权限节点
- 支持多协议端连接, 各协议端权限及订阅配置相互独立
- 命令冷却系统
- 速率控制系统
- HTTP 代理功能
- 自动处理加好友和被邀请进群
- 插件帮助功能 (支持群聊 / 私聊)
Expand All @@ -36,6 +38,7 @@
- 签到 (仅支持群聊)
- 求签 (仅支持群聊)
- 抽卡 (仅支持群聊)
- 塔罗牌 (仅支持群聊)
- 能不能好好说话 (lab.magiconch.com API) (支持群聊 / 私聊)
- Pixiv助手 (需要 HTTP 代理, 除非部署在外网) (需要 go-cqhttp v0.9.40 及以上版本) (仅支持群聊)
- Pixiv订阅 (需要 HTTP 代理, 除非部署在外网) (仅支持群聊)
Expand All @@ -59,7 +62,7 @@
## 关于图片数据

如果你不想自己收集图片数据, 可以将
[这个图片数据库](https://github.com/Ailitonia/omega-miya/raw/main/archive_data/db_pixiv.7z)
[这个图片数据库](https://github.com/Ailitonia/omega-miya/raw/master/archive_data/db_pixiv.7z)
导入, 基本都是按我自己口味收集的图片

Update 2021.8.10: 最新发布图片数据库共 9w7 条图片数据 (包含已失效或画师已删除作品)
Expand Down
8 changes: 7 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

# File path
bot_root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'omega_miya'))
bot_root_path = os.path.abspath(os.path.dirname(__file__))
bot_tmp_path = os.path.abspath(os.path.join(bot_root_path, 'tmp'))
if not os.path.exists(bot_tmp_path):
os.makedirs(bot_tmp_path)
Expand All @@ -20,6 +20,11 @@
if not os.path.exists(bot_log_path):
os.makedirs(bot_log_path)

# Static resources path
bot_resources_path = os.path.abspath(os.path.join(bot_root_path, 'omega_miya', 'resources'))
if not os.path.exists(bot_resources_path):
os.makedirs(bot_resources_path)

# Custom logger
log_info_name = f"{datetime.today().strftime('%Y%m%d-%H%M%S')}-INFO.log"
log_error_name = f"{datetime.today().strftime('%Y%m%d-%H%M%S')}-ERROR.log"
Expand All @@ -41,6 +46,7 @@
config = nonebot.get_driver().config
config.root_path_ = bot_root_path
config.tmp_path_ = bot_tmp_path
config.resources_path_ = bot_resources_path

# 注册 cqhttp adapter
driver = nonebot.get_driver()
Expand Down
Binary file added docs/img/pillow-text-anchors-reference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from .class_result import Result
from .model import (
DBUser, DBFriend, DBBot, DBBotGroup, DBGroup, DBSkill, DBSubscription, DBDynamic,
DBPixivUserArtwork, DBPixivillust, DBPixivision, DBEmail, DBEmailBox, DBHistory, DBAuth, DBCoolDownEvent, DBStatus)
DBPixivUserArtwork, DBPixivillust, DBPixivision, DBEmail, DBEmailBox, DBHistory,
DBAuth, DBCoolDownEvent, DBStatus, DBStatistic, DBPlugin)


__all__ = [
Expand All @@ -27,5 +28,7 @@
'DBAuth',
'DBCoolDownEvent',
'DBStatus',
'DBStatistic',
'DBPlugin',
'Result'
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import nonebot
from urllib.parse import quote
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.ext.asyncio import create_async_engine
from sqlalchemy.future import select
Expand All @@ -18,7 +19,7 @@
__DB_NAME = global_config.db_name

# 格式化数据库引擎链接
__DB_ENGINE = f'{__DATABASE}+{__DB_DRIVER}://{__DB_USER}:{__DB_PASSWORD}@{__DB_HOST}:{__DB_PORT}/{__DB_NAME}'
__DB_ENGINE = f'{__DATABASE}+{__DB_DRIVER}://{__DB_USER}:{quote(__DB_PASSWORD)}@{__DB_HOST}:{__DB_PORT}/{__DB_NAME}'


# 创建数据库连接
Expand All @@ -28,10 +29,10 @@
connect_args={"use_unicode": True, "charset": "utf8mb4"},
pool_recycle=3600, pool_pre_ping=True, echo=False
)
except Exception as exp:
except Exception as e:
import sys
nonebot.logger.opt(colors=True).critical(f'<r>创建数据库连接失败</r>, error: {repr(exp)}')
sys.exit('创建数据库连接失败')
nonebot.logger.opt(colors=True).critical(f'<r>创建数据库连接失败</r>, error: {repr(e)}')
sys.exit(f'创建数据库连接失败, {e}')


# 初始化化数据库
Expand All @@ -48,14 +49,14 @@ async def database_init():
# where synchronous IO calls will be transparently translated for
# await.
await conn.run_sync(Base.metadata.create_all)
nonebot.logger.opt(colors=True).info(f'<lg>数据库初始化已完成.</lg>')
except Exception as e:
nonebot.logger.opt(colors=True).success(f'<lg>数据库初始化已完成.</lg>')
except Exception as e_:
import sys
nonebot.logger.opt(colors=True).critical(f'<r>数据库初始化失败</r>, error: {repr(e)}')
sys.exit('数据库初始化失败')
nonebot.logger.opt(colors=True).critical(f'<r>数据库初始化失败</r>, error: {repr(e_)}')
sys.exit(f'数据库初始化失败, {e_}')


class NBdb(object):
class BaseDB(object):
def __init__(self):
# expire_on_commit=False will prevent attributes from being expired
# after commit.
Expand Down Expand Up @@ -90,7 +91,7 @@ async def list_col(self, col_name) -> Result.ListResult:
if not self.__table:
result = Result.ListResult(error=True, info='Table not exist', result=res)
else:
async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand All @@ -99,16 +100,16 @@ async def list_col(self, col_name) -> Result.ListResult:
for item in session_result.scalars().all():
res.append(item)
result = Result.ListResult(error=False, info='Success', result=res)
except Exception as e:
result = Result.ListResult(error=True, info=repr(e), result=res)
except Exception as e_:
result = Result.ListResult(error=True, info=repr(e_), result=res)
return result

async def list_col_with_condition(self, col_name, condition_col_name, condition) -> Result.ListResult:
res = []
if not self.__table:
result = Result.ListResult(error=True, info='Table not exist', result=res)
else:
async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand All @@ -118,11 +119,11 @@ async def list_col_with_condition(self, col_name, condition_col_name, condition)
for item in session_result.scalars().all():
res.append(item)
result = Result.ListResult(error=False, info='Success', result=res)
except Exception as e:
result = Result.ListResult(error=True, info=repr(e), result=res)
except Exception as e_:
result = Result.ListResult(error=True, info=repr(e_), result=res)
return result


__all__ = [
'NBdb'
'BaseDB'
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
from .pixiv_user_artwork import DBPixivUserArtwork
from .pixivillust import DBPixivillust
from .pixivision import DBPixivision
from .plugins import DBPlugin
from .skill import DBSkill
from .statistic import DBStatistic
from .status import DBStatus
from .subscription import DBSubscription
from .user import DBUser
from .status import DBStatus


__all__ = [
'DBAuth',
Expand All @@ -29,8 +32,10 @@
'DBPixivUserArtwork',
'DBPixivillust',
'DBPixivision',
'DBPlugin',
'DBSkill',
'DBStatistic',
'DBStatus',
'DBSubscription',
'DBUser',
'DBStatus'
'DBUser'
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from omega_miya.utils.Omega_Base.database import NBdb
from omega_miya.utils.Omega_Base.class_result import Result
from omega_miya.utils.Omega_Base.tables import AuthUser, AuthGroup, User, Friends, Group, BotGroup
from omega_miya.database.database import BaseDB
from omega_miya.database.class_result import Result
from omega_miya.database.tables import AuthUser, AuthGroup, User, Friends, Group, BotGroup
from .friend import DBFriend
from .bot_group import DBBotGroup
from .bot_self import DBBot
Expand Down Expand Up @@ -29,7 +29,7 @@ async def id(self) -> Result.IntResult:
if self_bot_id_result.error:
return Result.IntResult(error=True, info='Bot not exist', result=-1)

async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand Down Expand Up @@ -76,7 +76,7 @@ async def set(self, allow_tag: int, deny_tag: int, auth_info: str = None) -> Res
if self_bot_id_result.error:
return Result.IntResult(error=True, info='Bot not exist', result=-1)

async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
try:
async with session.begin():
Expand Down Expand Up @@ -154,7 +154,7 @@ async def allow_tag(self) -> Result.IntResult:
if self_bot_id_result.error:
return Result.IntResult(error=True, info='Bot not exist', result=-1)

async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand Down Expand Up @@ -197,7 +197,7 @@ async def deny_tag(self) -> Result.IntResult:
if self_bot_id_result.error:
return Result.IntResult(error=True, info='Bot not exist', result=-1)

async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand Down Expand Up @@ -240,7 +240,7 @@ async def tags_info(self) -> Result.IntTupleResult:
if self_bot_id_result.error:
return Result.IntTupleResult(error=True, info='Bot not exist', result=(-1, -1))

async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand Down Expand Up @@ -283,7 +283,7 @@ async def delete(self) -> Result.IntResult:
if self_bot_id_result.error:
return Result.IntResult(error=True, info='Bot not exist', result=-1)

async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
try:
async with session.begin():
Expand Down Expand Up @@ -333,7 +333,7 @@ async def list(cls, auth_type: str, auth_id: int, self_bot: DBBot) -> Result.Lis
if self_bot_id_result.error:
return Result.ListResult(error=True, info='Bot not exist', result=[])

async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from omega_miya.utils.Omega_Base.database import NBdb
from omega_miya.utils.Omega_Base.class_result import Result
from omega_miya.utils.Omega_Base.tables import Bilidynamic
from omega_miya.database.database import BaseDB
from omega_miya.database.class_result import Result
from omega_miya.database.tables import Bilidynamic
from datetime import datetime
from sqlalchemy.future import select
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
Expand All @@ -12,7 +12,7 @@ def __init__(self, uid: int, dynamic_id: int):
self.dynamic_id = dynamic_id

async def id(self) -> Result.IntResult:
async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand All @@ -36,7 +36,7 @@ async def exist(self) -> bool:
return result.success()

async def add(self, dynamic_type: int, content: str) -> Result.IntResult:
async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
try:
async with session.begin():
Expand Down Expand Up @@ -67,7 +67,7 @@ async def add(self, dynamic_type: int, content: str) -> Result.IntResult:

@classmethod
async def list_all_dynamic(cls) -> Result.IntListResult:
async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand All @@ -82,7 +82,7 @@ async def list_all_dynamic(cls) -> Result.IntListResult:

@classmethod
async def list_dynamic_by_uid(cls, uid: int) -> Result.IntListResult:
async_session = NBdb().get_async_session()
async_session = BaseDB().get_async_session()
async with async_session() as session:
async with session.begin():
try:
Expand Down
Loading