XZZ/test.py

37 lines
885 B
Python
Raw Permalink Normal View History

2020-02-28 10:34:34 +08:00
from worker import emmm
2020-03-02 14:17:30 +08:00
debug = True
2020-02-28 22:58:14 +08:00
2021-01-27 11:33:32 +08:00
2020-02-28 22:58:14 +08:00
def de(e):
if debug:
print('DEBUG '+str(e))
2020-02-28 10:34:34 +08:00
2021-01-27 11:33:32 +08:00
2020-02-28 10:34:34 +08:00
print("开始测试咯,在 '>' 后面输入n你的消息不用加 '/'")
inp = input('>')
while(inp):
parms = str.split(inp)
worker = parms[0]
try:
2021-01-27 11:33:32 +08:00
package = __import__(name='worker.' + worker, fromlist=worker)
Ans_ = getattr(package, 'Ans')
2020-02-28 22:58:14 +08:00
except Exception as e:
2020-03-01 20:37:28 +08:00
de(e)
2020-02-28 10:34:34 +08:00
Ans_ = emmm.Ans
2020-03-01 20:37:28 +08:00
de(Ans_)
2020-02-28 10:34:34 +08:00
try:
2021-01-27 11:33:32 +08:00
Ans = Ans_(parms, uid=0, gid=0, role='owner', mid=1001, raw_msg={'message': [
{
"data": {
"text": f"/{inp}"
},
"type": "text"
}
], 'message_id': '1001', 'raw_message': f"/{inp}"})
2020-02-28 10:34:34 +08:00
Message = Ans.GETMSG()
except Exception as e:
2020-02-28 15:42:37 +08:00
Message = ' Error:\n'+str(e)
2020-02-28 10:34:34 +08:00
print(Message)
inp = input('>')