Automatically trim msgId on message_played condition
This commit is contained in:
parent
efd5298e45
commit
06f1e92fcd
1 changed files with 5 additions and 4 deletions
|
@ -464,9 +464,10 @@ class Condition(object):
|
|||
if not story.lastMsgFinishTime:
|
||||
return False
|
||||
|
||||
msg = story.get(self.vars['msgId'])
|
||||
msgId = self.vars['msgId'].strip()
|
||||
msg = story.get(msgId)
|
||||
if not msg:
|
||||
story.logger.critical(f"Condition on non-existing message: {self.vars['msgId']}")
|
||||
story.logger.critical(f"Condition on non-existing message: {msgId}")
|
||||
# assigning false to r, keeps 'inverseMatch' working, even when msgId is wrong
|
||||
r = False
|
||||
else:
|
||||
|
@ -474,7 +475,7 @@ class Condition(object):
|
|||
r = msg.isFinished()
|
||||
|
||||
if r:
|
||||
story.logger.debug(f"Msg {self.vars['msgId']} has been played.")
|
||||
story.logger.debug(f"Msg {msgId} has been played.")
|
||||
|
||||
if 'inverseMatch' in self.vars and self.vars['inverseMatch']:
|
||||
# inverse:
|
||||
|
@ -482,7 +483,7 @@ class Condition(object):
|
|||
|
||||
self.logInfo = "Has {} played msg {}".format(
|
||||
'not' if 'inverseMatch' in self.vars and self.vars['inverseMatch'] else '',
|
||||
self.vars['msgId']
|
||||
msgId
|
||||
)
|
||||
|
||||
return r
|
||||
|
|
Loading…
Reference in a new issue