Add options to display reply messages (ie send to websocket)

This commit is contained in:
Derek 2021-12-19 00:12:03 -07:00
parent 300789ecda
commit eb622e20a4

View file

@ -6,8 +6,10 @@ class ReplyPlugin(PluginBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def run(self, text, target=None, _ctx=None, **kwargs):
msg = SysMessage(self._name, text.format(event=_ctx))
def run(self, text, target=None, display=False, _ctx=None, **kwargs):
if isinstance(text, str):
text = text.format(event=_ctx)
msg = SysMessage(self._name, text)
if target == 'all':
self.broadcast(msg)
@ -17,3 +19,6 @@ class ReplyPlugin(PluginBase):
self.call_chat(target, msg)
else:
logger.error('Calling plugin did not provide required context and no explicit target set')
if display:
self.send_to_bus(msg)