fix(chat): resolve copilot's review
This commit is contained in:
@@ -14,6 +14,7 @@ from app.auth import (
|
|||||||
store_token,
|
store_token,
|
||||||
)
|
)
|
||||||
from app.config import settings
|
from app.config import settings
|
||||||
|
from app.const import BANCHOBOT_ID
|
||||||
from app.database import DailyChallengeStats, OAuthClient, User
|
from app.database import DailyChallengeStats, OAuthClient, User
|
||||||
from app.database.statistics import UserStatistics
|
from app.database.statistics import UserStatistics
|
||||||
from app.dependencies import get_db
|
from app.dependencies import get_db
|
||||||
@@ -459,7 +460,7 @@ async def oauth_token(
|
|||||||
# 存储令牌
|
# 存储令牌
|
||||||
await store_token(
|
await store_token(
|
||||||
db,
|
db,
|
||||||
2,
|
BANCHOBOT_ID,
|
||||||
client_id,
|
client_id,
|
||||||
scopes,
|
scopes,
|
||||||
access_token,
|
access_token,
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ async def get_update(
|
|||||||
else None,
|
else None,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if "sliences" in includes:
|
if "silences" in includes:
|
||||||
if history_since:
|
if history_since:
|
||||||
silences = (
|
silences = (
|
||||||
await session.exec(
|
await session.exec(
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ from sqlmodel.ext.asyncio.session import AsyncSession
|
|||||||
|
|
||||||
async def create_banchobot():
|
async def create_banchobot():
|
||||||
async with AsyncSession(engine) as session:
|
async with AsyncSession(engine) as session:
|
||||||
is_exist = (await session.exec(select(exists()).where(User.id == 2))).first()
|
is_exist = (
|
||||||
|
await session.exec(select(exists()).where(User.id == BANCHOBOT_ID))
|
||||||
|
).first()
|
||||||
if not is_exist:
|
if not is_exist:
|
||||||
banchobot = User(
|
banchobot = User(
|
||||||
username="BanchoBot",
|
username="BanchoBot",
|
||||||
|
|||||||
Reference in New Issue
Block a user