mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-05-06 03:23:43 -05:00
TextAdventures: try/except message handling
This commit is contained in:
parent
665ba1497f
commit
e2c8e89440
@ -86,7 +86,7 @@ class TextAdventures(callbacks.Plugin):
|
|||||||
response = []
|
response = []
|
||||||
prompts = ["\n> >", "\n>", "\n\)", pexpect.TIMEOUT]
|
prompts = ["\n> >", "\n>", "\n\)", pexpect.TIMEOUT]
|
||||||
output.expect(prompts, timeout=1)
|
output.expect(prompts, timeout=1)
|
||||||
response = output.before
|
response = output.before
|
||||||
response = response.decode().splitlines()
|
response = response.decode().splitlines()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@ -99,12 +99,17 @@ class TextAdventures(callbacks.Plugin):
|
|||||||
if not self.registryValue('requireCommand') or not irc.isChannel(msg.args[0]):
|
if not self.registryValue('requireCommand') or not irc.isChannel(msg.args[0]):
|
||||||
self.game.setdefault(channel, None)
|
self.game.setdefault(channel, None)
|
||||||
if self.game[channel]:
|
if self.game[channel]:
|
||||||
command = msg.args[1]
|
try:
|
||||||
self.game[channel].sendline(r'{}'.format(command))
|
command = msg.args[1]
|
||||||
response = self.output(self.game[channel])
|
self.game[channel].sendline(r'{}'.format(command))
|
||||||
for line in response[1:]:
|
response = self.output(self.game[channel])
|
||||||
if line.strip() and line.strip() != ".":
|
for line in response[1:]:
|
||||||
irc.reply(line, prefixNick=False)
|
if line.strip() and line.strip() != ".":
|
||||||
|
irc.reply(line, prefixNick=False)
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user