mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 01:15:34 +00:00
vip 修复 redis 连接不上时的报错
This commit is contained in:
parent
74d38a0ee1
commit
67ac0fe0f0
@ -342,7 +342,7 @@
|
||||
},
|
||||
{
|
||||
"name": "vip",
|
||||
"version": "0.50",
|
||||
"version": "0.51",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "4.0 kb",
|
||||
|
14
vip.py
14
vip.py
@ -1,5 +1,5 @@
|
||||
import io
|
||||
|
||||
from redis.exceptions import ConnectionError
|
||||
from requests import get
|
||||
from os import remove
|
||||
from telethon.tl.types import MessageMediaPhoto
|
||||
@ -93,7 +93,11 @@ async def pixiv(context):
|
||||
await context.edit('镜像源序号错误。')
|
||||
return
|
||||
if 0 < num < 4:
|
||||
redis.set("pixiv_num", num)
|
||||
try:
|
||||
redis.set("pixiv_num", num)
|
||||
except ConnectionError:
|
||||
await context.edit('redis 数据库离线 无法更改镜像源。')
|
||||
return
|
||||
await context.edit('镜像源已更改。')
|
||||
return
|
||||
else:
|
||||
@ -102,12 +106,14 @@ async def pixiv(context):
|
||||
else:
|
||||
pass
|
||||
if not redis_status:
|
||||
num = 1
|
||||
num = 3
|
||||
else:
|
||||
try:
|
||||
num = int(redis.get("pixiv_num").decode())
|
||||
except AttributeError:
|
||||
num = 1
|
||||
num = 3
|
||||
except ConnectionError:
|
||||
num = 3
|
||||
try:
|
||||
message = await obtain_message(context)
|
||||
except ValueError:
|
||||
|
Loading…
Reference in New Issue
Block a user