mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 00:35:36 +00:00
silly_girl 避免请求频繁,提高稳定性 (#17)
Co-authored-by: omg-xtao <100690902+omg-xtao@users.noreply.github.com>
This commit is contained in:
parent
ceb184bddc
commit
4e5c3d0bd1
@ -852,7 +852,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "silly_girl",
|
"name": "silly_girl",
|
||||||
"version": "1.04",
|
"version": "1.041",
|
||||||
"section": "chat",
|
"section": "chat",
|
||||||
"maintainer": "cdle",
|
"maintainer": "cdle",
|
||||||
"size": "3 kb",
|
"size": "3 kb",
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from asyncio import sleep
|
||||||
from pagermaid.listener import listener
|
from pagermaid.listener import listener
|
||||||
from pagermaid import persistent_vars, bot
|
from pagermaid import persistent_vars, bot
|
||||||
from pagermaid.utils import client, alias_command
|
from pagermaid.utils import client, alias_command
|
||||||
@ -88,8 +89,10 @@ async def poll(data):
|
|||||||
init = "&init=true"
|
init = "&init=true"
|
||||||
req_data = await client.post(persistent_vars["sillyGirl"]['url']+"/pgm?token="+persistent_vars["sillyGirl"]['token']+init, json=data)
|
req_data = await client.post(persistent_vars["sillyGirl"]['url']+"/pgm?token="+persistent_vars["sillyGirl"]['token']+init, json=data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
await sleep(1)
|
||||||
return
|
return
|
||||||
if not req_data.status_code == 200:
|
if not req_data.status_code == 200:
|
||||||
|
await sleep(1)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
replies = json.loads(req_data.text)
|
replies = json.loads(req_data.text)
|
||||||
@ -137,5 +140,5 @@ async def poll(data):
|
|||||||
await persistent_vars["sillyGirl"]['context'].edit("傻妞连接成功,愉快玩耍吧。")
|
await persistent_vars["sillyGirl"]['context'].edit("傻妞连接成功,愉快玩耍吧。")
|
||||||
await persistent_vars["sillyGirl"]['context'].delete()
|
await persistent_vars["sillyGirl"]['context'].delete()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
await sleep(1)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user