mc list up up up

This commit is contained in:
SiHuan 2020-02-27 22:35:24 +08:00
parent aa6117f5ba
commit d906ebacff

View file

@ -12,13 +12,13 @@ class Ans(StdAns):
if cmd == 'list': if cmd == 'list':
output = getoutput('spigot status') output = getoutput('spigot status')
p = re.compile(r'There are (.*?)[ of a max]', re.S) p = re.compile(r'There are (.*?)[ of a max]', re.S)
online = int(re.findall(p,a)[0]) online = int(re.findall(p,output)[0])
if online == 0: if online == 0:
msg = '咱看着没有人在线哎\n_(-ω-`_)⌒)_' msg = '咱看着没有人在线哎\n_(-ω-`_)⌒)_'
else: else:
msg = '' + str(online) + '个小伙伴在线!' msg = '' + str(online) + '个小伙伴在线!'
p = re.compile(r'online: (.*?)[\n>]', re.S) p = re.compile(r'online: (.*?)[\n>]', re.S)
players = re.findall(p,a)[0].split(', ') players = re.findall(p,output)[0].split(', ')
for player in players: for player in players:
msg = msg + '\n' + player msg = msg + '\n' + player
return msg return msg