🐛 sticker Not completely fix decode error
🐛 sticker 不完全修复极端条件下的贴纸名生成错误
This commit is contained in:
parent
dffa87dee1
commit
17bf5b2d90
@ -105,8 +105,15 @@ async def sticker(context):
|
|||||||
pack_title += " (animated)"
|
pack_title += " (animated)"
|
||||||
command = '/newanimated'
|
command = '/newanimated'
|
||||||
|
|
||||||
response = request.urlopen(
|
try:
|
||||||
request.Request(f'http://t.me/addstickers/{pack_name}'), context=ssl.create_default_context(cafile=certifi.where()))
|
response = request.urlopen(
|
||||||
|
request.Request(f'http://t.me/addstickers/{pack_name}'), context=ssl.create_default_context(cafile=certifi.where()))
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
pack_name = 's' + hex(context.sender.id)[2:]
|
||||||
|
if animated:
|
||||||
|
pack_name = 's' + hex(context.sender.id)[2:] + '_animated'
|
||||||
|
response = request.urlopen(
|
||||||
|
request.Request(f'http://t.me/addstickers/{pack_name}'), context=ssl.create_default_context(cafile=certifi.where()))
|
||||||
if not response.status == 200:
|
if not response.status == 200:
|
||||||
try:
|
try:
|
||||||
await context.edit(lang('sticker_telegram_server_error'))
|
await context.edit(lang('sticker_telegram_server_error'))
|
||||||
|
Loading…
Reference in New Issue
Block a user