️ Cache specific sticker set

️ 缓存指定的 sticker set
This commit is contained in:
xtaodada 2021-08-24 22:10:45 +08:00
parent 765bab397a
commit 459ec408f5
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736

View File

@ -120,7 +120,16 @@ async def sticker(context):
# 是否添加到指定贴纸包
if context.parameter[0] == "to":
if len(context.parameter) == 2:
to_sticker_set = True
to_sticker_set = context.parameter[1]
if redis_status():
redis.set("sticker.to", to_sticker_set)
else:
if redis_status():
if redis.get("sticker.to"):
to_sticker_set = redis.get("sticker.to").decode()
else:
await context.edit(lang("sticker_to_no"))
return
else:
await context.edit(lang("sticker_to_no"))
return
@ -274,7 +283,7 @@ async def single_sticker(animated, context, custom_emoji, emoji, message, pic_ro
pack_name = f"{user.username}_{package_name}_{pack}"
pack_title = f"@{user.username} {lang('sticker_pack_title')} ({package_name}) ({pack})"
elif to_sticker_set:
pack_name = context.parameter[1]
pack_name = to_sticker_set
pack_title = f"@{user.username} {lang('sticker_pack_title')} ({package_name}) ({pack})"
else:
pack_name = f"{user.username}_{pack}"