This commit is contained in:
SiHuan 2020-03-20 22:51:35 +08:00
parent bc26c1257b
commit e1b9999c0d
2 changed files with 15 additions and 2 deletions

View file

@ -15,11 +15,12 @@ class Ans(StdAns):
if cmd == 'start': if cmd == 'start':
self.DATASET({'status':'1'}) self.DATASET({'status':'1'})
self.sendmsg('inx 启动!') self.sendmsg('inx 启动!')
while(self.DATAGET()['status'] == 1): while(self.DATAGET()['status'] == '1'):
req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx") req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx")
num = req.text[28:].split(",")[1] num = req.text[28:].split(",")[1]
self.sendmsg('标普500现在情况: ' + num) msgid = self.sendmsg('标普500现在情况: ' + num)
time.sleep(10) time.sleep(10)
self.delmsg(msgid)
return "现在 inx 真的停了!" return "现在 inx 真的停了!"

View file

@ -50,3 +50,15 @@ class StdAns():
'message': msg 'message': msg
} }
return requests.post(url = url, data = json.dumps(data),headers = Headers).json()['data']['message_id'] return requests.post(url = url, data = json.dumps(data),headers = Headers).json()['data']['message_id']
def delmsg(self,msgid):
url = APIURL + "delete_msg"
Headers = {
'content-type': 'application/json',
'Authorization':'Bearer ' + AUTHORIZATION
}
data = {
'message_id' : msgid,
}
requests.post(url = url, data = json.dumps(data),headers = Headers)