2020-02-27 21:47:36 +08:00
|
|
|
from worker import emmm
|
2020-08-03 23:20:13 +08:00
|
|
|
|
2020-06-18 19:25:32 +08:00
|
|
|
|
2020-02-27 21:47:36 +08:00
|
|
|
def ZZRouter(data):
|
|
|
|
uid = data['user_id']
|
|
|
|
gid = data['group_id']
|
|
|
|
role = data['sender']['role']
|
2020-08-17 10:40:46 +08:00
|
|
|
mid = data['message_id']
|
2021-01-26 23:58:00 +08:00
|
|
|
parms = str.split(data['message'][0]['data']['text'][1:])
|
2020-06-18 19:25:32 +08:00
|
|
|
print(uid, gid, role, parms)
|
2020-03-16 17:18:32 +08:00
|
|
|
if parms == []:
|
2020-03-02 14:17:30 +08:00
|
|
|
parms[0] = 'help'
|
2020-02-27 21:47:36 +08:00
|
|
|
worker = parms[0]
|
|
|
|
|
|
|
|
try:
|
2020-06-18 19:25:32 +08:00
|
|
|
package = __import__(name='worker.' + worker, fromlist=worker)
|
|
|
|
Ans_ = getattr(package, 'Ans')
|
2020-02-27 21:47:36 +08:00
|
|
|
except:
|
|
|
|
Ans_ = emmm.Ans
|
|
|
|
|
2020-08-17 10:40:46 +08:00
|
|
|
Ans = Ans_(parms, uid, gid, role, mid, data)
|
2020-02-27 21:47:36 +08:00
|
|
|
Message = Ans.CheckPermission()
|
|
|
|
if Message == 0:
|
|
|
|
Message = Ans.GETMSG()
|
2020-06-18 19:25:32 +08:00
|
|
|
elif Message == -1:
|
2020-06-18 19:35:09 +08:00
|
|
|
return
|
|
|
|
Ans.sendmsg(Message)
|