Add options to display reply messages (ie send to websocket)
This commit is contained in:
parent
300789ecda
commit
eb622e20a4
1 changed files with 7 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue