mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-06-23 22:16:53 +08:00
auto fix by pre-commit hooks
This commit is contained in:
committed by
felinae98
parent
ebcf1cc300
commit
1543ba21d2
@@ -7,10 +7,10 @@ from ..config import (
|
||||
NoSuchUserException,
|
||||
config,
|
||||
)
|
||||
from ..config.db_config import SubscribeDupException
|
||||
from ..platform import check_sub_target, platform_manager
|
||||
from ..types import Target as T_Target
|
||||
from ..types import WeightConfig
|
||||
from ..config.db_config import SubscribeDupException
|
||||
from .jwt import pack_jwt
|
||||
from .token_manager import token_manager
|
||||
|
||||
|
||||
@@ -23,9 +23,11 @@ def _get_time():
|
||||
cur_time = time(hour=dt.hour, minute=dt.minute, second=dt.second)
|
||||
return cur_time
|
||||
|
||||
|
||||
class SubscribeDupException(Exception):
|
||||
...
|
||||
|
||||
|
||||
class DBConfig:
|
||||
def __init__(self):
|
||||
self.add_target_hook: Optional[Callable[[str, T_Target], Awaitable]] = None
|
||||
@@ -79,7 +81,7 @@ class DBConfig:
|
||||
try:
|
||||
await session.commit()
|
||||
except IntegrityError as e:
|
||||
if len(e.args) > 0 and 'UNIQUE constraint failed' in e.args[0]:
|
||||
if len(e.args) > 0 and "UNIQUE constraint failed" in e.args[0]:
|
||||
raise SubscribeDupException()
|
||||
raise e
|
||||
|
||||
|
||||
Reference in New Issue
Block a user