This commit is contained in:
SiHuan 2020-12-26 20:36:04 +08:00
parent 562c433235
commit 53f71d822a

View file

@ -1,6 +1,6 @@
from zzcore import StdAns from zzcore import StdAns
import feedparser, json import feedparser, json, time
allowCMD = ['sub','unsub','list','disable', 'enable'] allowCMD = ['sub','unsub','list','disable', 'enable']
@ -80,7 +80,7 @@ class Ans(StdAns):
elif cmd == 'enable': elif cmd == 'enable':
nowdata['status'] = True nowdata['status'] = True
self.DATASET({gid:json.dumps(nowdata)}) self.DATASET({gid:json.dumps(nowdata)})
self.sendmsg("订阅已启用,咱会每隔五分钟抓订阅,有新内容就会推送哦") self.sendmsg("订阅已启用,咱会每隔五分钟抓订阅,有新内容就会推送哦")
while(nowdata['status']): while(nowdata['status']):
nowdata = json.loads(self.DATAGET()[gid]) nowdata = json.loads(self.DATAGET()[gid])
for sub in nowdata['allSub'].values(): for sub in nowdata['allSub'].values():
@ -97,6 +97,7 @@ class Ans(StdAns):
self.push(sub['title'], newfeedtitle, newfeedlink) self.push(sub['title'], newfeedtitle, newfeedlink)
nowdata['allSub'][sub['url']]['lastUpdated'] = d.entries[0].published nowdata['allSub'][sub['url']]['lastUpdated'] = d.entries[0].published
self.DATASET({gid:json.dumps(nowdata)}) self.DATASET({gid:json.dumps(nowdata)})
time.sleep()
elif cmd == 'disable': elif cmd == 'disable':
nowdata['status'] = False nowdata['status'] = False