add getgroups and broadcast

This commit is contained in:
SiHuan 2020-08-02 16:42:41 +08:00
parent 0076a34dff
commit 930f285bc3
2 changed files with 21 additions and 0 deletions

13
worker/broadcast.py Normal file
View file

@ -0,0 +1,13 @@
from zzcore import StdAns
class Ans(StdAns):
AllowUser = [1318000868]
def GETMSG(self):
groups = self.getgroups()
msg = ""
for g in groups:
msg += g["groupname"]
retuen msg

View file

@ -63,6 +63,14 @@ class StdAns():
} }
requests.post(url = url, data = json.dumps(data),headers = Headers) requests.post(url = url, data = json.dumps(data),headers = Headers)
def getgroups(self):
url = APIURL + "get_group_list"
Headers = {
'content-type': 'application/json',
'Authorization':'Bearer ' + AUTHORIZATION
}
return requests.get(url = url,headers = Headers).json()['data']
def mysakuya(self, words): def mysakuya(self, words):
if self.uid == 1318000868: if self.uid == 1318000868: