XZZ/route.py

23 lines
580 B
Python
Raw Normal View History

2020-02-27 21:47:36 +08:00
from worker import emmm
def ZZRouter(data):
uid = data['user_id']
gid = data['group_id']
role = data['sender']['role']
parms = str.split(data['message'][1:])
2020-03-16 17:18:32 +08:00
print(uid,gid,role,parms)
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:
package = __import__(name='worker.'+ worker, fromlist=worker)
Ans_ = getattr(package,'Ans')
except:
Ans_ = emmm.Ans
Ans = Ans_(parms,uid,gid,role,data)
Message = Ans.CheckPermission()
if Message == 0:
Message = Ans.GETMSG()
Ans.sendmsg(Message)