🐛 修复BUG (#505)

This commit is contained in:
Wuyi无疑 2023-04-18 00:05:22 +08:00
parent 1dae726f28
commit 0ece1974ea
4 changed files with 29 additions and 16 deletions

View File

@ -66,8 +66,8 @@ async def send_link_uid_msg(bot: Bot, ev: Event):
sqla = get_sqla(ev.bot_id)
uid = ev.text.strip()
if not uid.isdigit():
return '你输入了错误的格式!'
if uid and not uid.isdigit():
return await bot.send('你输入了错误的格式!')
if ev.command.startswith('绑定'):
data = await sqla.insert_bind_data(qid, uid=uid)

View File

@ -184,7 +184,11 @@ class SQLA:
return True
async def insert_user_data(
self, user_id: str, uid: str, cookie: str, stoken: Optional[str] = None
self,
user_id: str,
uid: str,
cookie: str,
stoken: Optional[str] = None,
) -> bool:
async with self.async_session() as session:
async with session.begin():
@ -192,7 +196,12 @@ class SQLA:
sql = (
update(GsUser)
.where(GsUser.uid == uid)
.values(cookie=cookie, status=None, stoken=stoken)
.values(
cookie=cookie,
status=None,
stoken=stoken,
bot_id=self.bot_id,
)
)
await session.execute(sql)
else:

22
poetry.lock generated
View File

@ -138,16 +138,20 @@ frozenlist = ">=1.1.0"
[[package]]
name = "aiosqlite"
version = "0.18.0"
version = "0.19.0"
description = "asyncio bridge to the standard sqlite3 module"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "aiosqlite-0.18.0-py3-none-any.whl", hash = "sha256:c3511b841e3a2c5614900ba1d179f366826857586f78abd75e7cbeb88e75a557"},
{file = "aiosqlite-0.18.0.tar.gz", hash = "sha256:faa843ef5fb08bafe9a9b3859012d3d9d6f77ce3637899de20606b7fc39aa213"},
{file = "aiosqlite-0.19.0-py3-none-any.whl", hash = "sha256:edba222e03453e094a3ce605db1b970c4b3376264e56f32e2a4959f948d66a96"},
{file = "aiosqlite-0.19.0.tar.gz", hash = "sha256:95ee77b91c8d2808bd08a59fbebf66270e9090c3d92ffbf260dc0db0b979577d"},
]
[package.extras]
dev = ["aiounittest (==1.4.1)", "attribution (==1.6.2)", "black (==23.3.0)", "coverage[toml] (==7.2.3)", "flake8 (==5.0.4)", "flake8-bugbear (==23.3.12)", "flit (==3.7.1)", "mypy (==1.2.0)", "ufmt (==2.1.0)", "usort (==1.0.6)"]
docs = ["sphinx (==6.1.3)", "sphinx-mdinclude (==0.5.3)"]
[[package]]
name = "anyio"
version = "3.6.2"
@ -550,14 +554,14 @@ wmi = ["wmi (>=1.5.1,<2.0.0)"]
[[package]]
name = "email-validator"
version = "2.0.0"
version = "2.0.0.post1"
description = "A robust email address syntax and deliverability validation library."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "email_validator-2.0.0-py3-none-any.whl", hash = "sha256:07c61b62ee446e39274b18204afa8e422baf64570776045272b04d10c02f64f6"},
{file = "email_validator-2.0.0.tar.gz", hash = "sha256:f4904f4145c11f8de5897afbb8d7db4b465c57f13db1c8c106c16d02bceebd9a"},
{file = "email_validator-2.0.0.post1-py3-none-any.whl", hash = "sha256:26efa040ae50e65cc130667080fa0f372f0ac3d852923a76166a54cf6a0ee780"},
{file = "email_validator-2.0.0.post1.tar.gz", hash = "sha256:314114acd9421728ae6f74d0c0a5d6ec547d44ef4f20425af4093828af2266f3"},
]
[package.dependencies]
@ -1955,14 +1959,14 @@ files = [
[[package]]
name = "soupsieve"
version = "2.4"
version = "2.4.1"
description = "A modern CSS selector implementation for Beautiful Soup."
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "soupsieve-2.4-py3-none-any.whl", hash = "sha256:49e5368c2cda80ee7e84da9dbe3e110b70a4575f196efb74e51b94549d921955"},
{file = "soupsieve-2.4.tar.gz", hash = "sha256:e28dba9ca6c7c00173e34e4ba57448f0688bb681b7c5e8bf4971daafc093d69a"},
{file = "soupsieve-2.4.1-py3-none-any.whl", hash = "sha256:1c1bfee6819544a3447586c889157365a27e10d88cde3ad3da0cf0ddf646feb8"},
{file = "soupsieve-2.4.1.tar.gz", hash = "sha256:89d12b2d5dfcd2c9e8c22326da9d9aa9cb3dfab0a83a024f05704076ee8d35ea"},
]
[[package]]

View File

@ -1,7 +1,7 @@
aiofiles==23.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiohttp==3.8.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
aiosignal==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
aiosqlite==0.18.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
aiosqlite==0.19.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
anyio==3.6.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
apscheduler==3.10.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
async-timeout==4.0.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
@ -13,7 +13,7 @@ certifi==2022.12.7 ; python_full_version >= "3.8.1" and python_full_version < "4
charset-normalizer==3.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
colorama==0.4.6 ; python_full_version >= "3.8.1" and python_version < "4.0" and platform_system == "Windows" or python_full_version >= "3.8.1" and python_version < "4.0" and sys_platform == "win32"
dnspython==2.3.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
email-validator==2.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
email-validator==2.0.0.post1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
et-xmlfile==1.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
fastapi-amis-admin==0.5.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
@ -48,7 +48,7 @@ setuptools==67.6.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
six==1.16.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
smmap==5.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sniffio==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
soupsieve==2.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
soupsieve==2.4.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy-database==0.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy2-stubs==0.0.2a33 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy==1.4.41 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"