From 7a357717edd7a9a5d1fcc7d0bd665ca84ecb54e0 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Sun, 2 Aug 2020 16:42:41 +0800 Subject: [PATCH] add getgroups and broadcast --- worker/broadcast.py | 13 +++++++++++++ zzcore.py | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 worker/broadcast.py diff --git a/worker/broadcast.py b/worker/broadcast.py new file mode 100644 index 0000000..6da5b7e --- /dev/null +++ b/worker/broadcast.py @@ -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 diff --git a/zzcore.py b/zzcore.py index c70562b..ae49acc 100644 --- a/zzcore.py +++ b/zzcore.py @@ -63,6 +63,14 @@ class StdAns(): } 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): if self.uid == 1318000868: