This commit is contained in:
SiHuan 2020-02-28 10:34:34 +08:00
parent 3445caae9b
commit 104041c061
2 changed files with 34 additions and 0 deletions

21
test.py Normal file
View file

@ -0,0 +1,21 @@
from worker import emmm
print("开始测试咯,在 '>' 后面输入n你的消息不用加 '/'")
inp = input('>')
while(inp):
parms = str.split(inp)
worker = parms[0]
try:
package = __import__(name='worker.'+ worker, fromlist=worker)
Ans_ = getattr(package,'Ans')
except:
Ans_ = emmm.Ans
try:
Ans = Ans_(parms,uid=0,gid=0,role='owner',raw_msg={'message':'/' + inp})
Message = Ans.GETMSG()
except Exception as e:
Message = ' Error:\n'+e
print(Message)
inp = input('>')

13
worker/echo.py Normal file
View file

@ -0,0 +1,13 @@
import random
from zzcore import StdAns
class Ans(StdAns):
def GETMSG(self):
r = random.randint(1,3)
if r == 1:
msg = self.raw_msg['message'][5:]
elif r == 2:
msg = "汝以为咱会复读的嘛!\n(╯' - ')╯︵ ┻━┻\n" + self.raw_msg['message'][5:]
elif r == 3:
msg = '咱才不做复读机。→_→'
return msg