兼容 go-cqhttp

This commit is contained in:
SiHuan 2020-08-02 21:54:55 +08:00
parent 2f98c680e1
commit a19ceb5ce2

View file

@ -39,29 +39,24 @@ class StdAns():
def sendmsg(self,msg): def sendmsg(self,msg):
url = APIURL + "send_msg" url = APIURL + "send_msg"
Headers = {
'content-type': 'application/json',
'Authorization':'Bearer ' + AUTHORIZATION
}
data = { data = {
'access_token' : AUTHORIZATION,
'message_type' : 'group', 'message_type' : 'group',
'group_id' : self.gid, 'group_id' : self.gid,
'message': msg 'message': msg
} }
return requests.post(url = url, data = json.dumps(data),headers = Headers).json()['data']['message_id'] return requests.get(url = url, params=data).json()['data']['message_id']
def delmsg(self,msgid): def delmsg(self,msgid):
url = APIURL + "delete_msg" url = APIURL + "delete_msg"
Headers = {
'content-type': 'application/json',
'Authorization':'Bearer ' + AUTHORIZATION
}
data = { data = {
'access_token' : AUTHORIZATION,
'message_id' : msgid, 'message_id' : msgid,
} }
requests.post(url = url, data = json.dumps(data),headers = Headers) requests.get(url = url, params=data)
def getgroups(self): def getgroups(self):
url = APIURL + "get_group_list" url = APIURL + "get_group_list"