mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-12-16 13:40:53 +08:00
✨ 增加选择原神绑定二维码
发送形式配置项(图片|链接)
This commit is contained in:
parent
16174cc80c
commit
1afab8dcc0
@ -6,6 +6,7 @@ from pydantic import BaseModel, Field
|
|||||||
class ConfigModel(BaseModel):
|
class ConfigModel(BaseModel):
|
||||||
CookieWeb_enable: bool = Field(True, alias='启用CookieWeb')
|
CookieWeb_enable: bool = Field(True, alias='启用CookieWeb')
|
||||||
CookieWeb_url: str = Field('http://127.0.0.1:13579/LittlePaimon/cookie', alias='CookieWeb地址')
|
CookieWeb_url: str = Field('http://127.0.0.1:13579/LittlePaimon/cookie', alias='CookieWeb地址')
|
||||||
|
qrcode_bind_use_url: bool = Field(False, alias='绑定二维码以链接形式发送')
|
||||||
|
|
||||||
sim_gacha_cd_group: int = Field(30, alias='模拟抽卡群冷却')
|
sim_gacha_cd_group: int = Field(30, alias='模拟抽卡群冷却')
|
||||||
sim_gacha_cd_member: int = Field(60, alias='模拟抽卡群员冷却')
|
sim_gacha_cd_member: int = Field(60, alias='模拟抽卡群员冷却')
|
||||||
|
@ -130,7 +130,7 @@ async def _(event: MessageEvent): # sourcery skip: use-fstring-for-concatenatio
|
|||||||
running_login_data[str(event.user_id)] = login_data
|
running_login_data[str(event.user_id)] = login_data
|
||||||
img_b64 = generate_qrcode(login_data['url'])
|
img_b64 = generate_qrcode(login_data['url'])
|
||||||
running_login_data[str(event.user_id)]['img_b64'] = img_b64
|
running_login_data[str(event.user_id)]['img_b64'] = img_b64
|
||||||
img = f'二维码链接:{config.CookieWeb_url}/qrcode?user_id={event.user_id}' if config.CookieWeb_enable else MessageSegment.image(img_b64)
|
img = f'二维码链接:{config.CookieWeb_url}/qrcode?user_id={event.user_id}' if config.qrcode_bind_use_url else MessageSegment.image(img_b64)
|
||||||
msg_data = await qrcode_bind.send(
|
msg_data = await qrcode_bind.send(
|
||||||
img + f'\n请在3分钟内使用米游社扫码并确认进行绑定。\n注意:1.扫码即代表你同意将Cookie信息授权给{NICKNAME}\n2.扫码时会提示登录原神,实际不会把你顶掉原神\n3.其他人请不要乱扫,否则会将你的账号绑到TA身上!',
|
img + f'\n请在3分钟内使用米游社扫码并确认进行绑定。\n注意:1.扫码即代表你同意将Cookie信息授权给{NICKNAME}\n2.扫码时会提示登录原神,实际不会把你顶掉原神\n3.其他人请不要乱扫,否则会将你的账号绑到TA身上!',
|
||||||
at_sender=True)
|
at_sender=True)
|
||||||
@ -203,6 +203,8 @@ app: FastAPI = get_app()
|
|||||||
|
|
||||||
@app.get('/LittlePaimon/cookie/qrcode')
|
@app.get('/LittlePaimon/cookie/qrcode')
|
||||||
async def qrcode_img_url(user_id: str):
|
async def qrcode_img_url(user_id: str):
|
||||||
|
if not config.qrcode_bind_use_url:
|
||||||
|
return {'status': 'error', 'msg': '请在QQ内查看二维码'}
|
||||||
if user_id not in running_login_data:
|
if user_id not in running_login_data:
|
||||||
return {'status': 'error', 'msg': '二维码不存在'}
|
return {'status': 'error', 'msg': '二维码不存在'}
|
||||||
img_base64 = running_login_data[user_id]['img_b64'].lstrip('base64://')
|
img_base64 = running_login_data[user_id]['img_b64'].lstrip('base64://')
|
||||||
|
@ -285,6 +285,14 @@ other_form = Form(
|
|||||||
onText='所有人',
|
onText='所有人',
|
||||||
offText='仅超级用户'
|
offText='仅超级用户'
|
||||||
),
|
),
|
||||||
|
Switch(
|
||||||
|
label='原神绑定二维码发送形式',
|
||||||
|
name='绑定二维码以链接形式发送',
|
||||||
|
value='${绑定二维码以链接形式发送}',
|
||||||
|
labelRemark=Remark(shape='circle', content='选择原神绑定二维码的发送形式(直接图片发送或者链接形式发送)'),
|
||||||
|
onText='链接',
|
||||||
|
offText='图片'
|
||||||
|
),
|
||||||
InputNumber(
|
InputNumber(
|
||||||
label='原神猜语音时间',
|
label='原神猜语音时间',
|
||||||
name='原神猜语音时间',
|
name='原神猜语音时间',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user