Fix account.msg, which didn't properly handle tuple input
This commit is contained in:
parent
0aa38eddab
commit
c5ff2de0bd
2 changed files with 12 additions and 3 deletions
|
|
@ -828,7 +828,10 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase):
|
||||||
server.
|
server.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text (str, optional): text data to send
|
text (str or tuple, optional): The message to send. This
|
||||||
|
is treated internally like any send-command, so its
|
||||||
|
value can be a tuple if sending multiple arguments to
|
||||||
|
the `text` oob command.
|
||||||
from_obj (Object or Account or list, optional): Object sending. If given, its
|
from_obj (Object or Account or list, optional): Object sending. If given, its
|
||||||
at_msg_send() hook will be called. If iterable, call on all entities.
|
at_msg_send() hook will be called. If iterable, call on all entities.
|
||||||
session (Session or list, optional): Session object or a list of
|
session (Session or list, optional): Session object or a list of
|
||||||
|
|
@ -859,7 +862,13 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase):
|
||||||
kwargs["options"] = options
|
kwargs["options"] = options
|
||||||
|
|
||||||
if text is not None:
|
if text is not None:
|
||||||
kwargs["text"] = to_str(text)
|
if not (isinstance(text, str) or isinstance(text, tuple)):
|
||||||
|
# sanitize text before sending across the wire
|
||||||
|
try:
|
||||||
|
text = to_str(text)
|
||||||
|
except Exception:
|
||||||
|
text = repr(text)
|
||||||
|
kwargs["text"] = text
|
||||||
|
|
||||||
# session relay
|
# session relay
|
||||||
sessions = make_iter(session) if session else self.sessions.all()
|
sessions = make_iter(session) if session else self.sessions.all()
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class CmdHelp(Command):
|
||||||
evmore.msg(self.caller, text, session=self.session)
|
evmore.msg(self.caller, text, session=self.session)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.msg((text, {"type": "help"}))
|
self.msg(text=(text, {"type": "help"}))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def format_help_entry(title, help_text, aliases=None, suggested=None):
|
def format_help_entry(title, help_text, aliases=None, suggested=None):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue