2020-02-27 21:47:36 +08:00
|
|
|
from worker import emmm
|
2020-08-03 22:10:17 +08:00
|
|
|
from zzcore import DM
|
2020-02-27 21:47:36 +08:00
|
|
|
|
2020-06-18 19:25:32 +08:00
|
|
|
|
2020-02-27 21:47:36 +08:00
|
|
|
def ZZRouter(data):
|
2020-08-03 22:10:17 +08:00
|
|
|
|
2020-08-03 22:20:12 +08:00
|
|
|
if ('[CQ:image,file=a854b2390d427b02fc26cae49d508a75.image]' in data['raw_message'] or '[CQ:image,file=6a507d12d1542cbed37af4776a1cd066.image]' in data['raw_message']) and data['user_id'] != 1318000868:
|
2020-08-03 22:10:17 +08:00
|
|
|
DM(data['message_id'])
|
|
|
|
|
|
|
|
|
2020-08-03 12:04:06 +08:00
|
|
|
if data['post_type'] != 'message' or data['message_type'] != 'group' or data['message'][0] != '/':
|
2020-08-02 23:13:31 +08:00
|
|
|
return
|
2020-08-03 12:04:06 +08:00
|
|
|
|
2020-02-27 21:47:36 +08:00
|
|
|
uid = data['user_id']
|
|
|
|
gid = data['group_id']
|
|
|
|
role = data['sender']['role']
|
|
|
|
parms = str.split(data['message'][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-06-18 19:25:32 +08:00
|
|
|
Ans = Ans_(parms, uid, gid, role, 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)
|