mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 09:46:32 +01:00
Make Session.execute_cmd consistent with Account/Object by accepting the session keyword
This commit is contained in:
parent
8f3a159993
commit
1aa447564e
1 changed files with 5 additions and 2 deletions
|
|
@ -407,7 +407,7 @@ class ServerSession(Session):
|
|||
else:
|
||||
self.data_out(**kwargs)
|
||||
|
||||
def execute_cmd(self, raw_string, **kwargs):
|
||||
def execute_cmd(self, raw_string, session=None, **kwargs):
|
||||
"""
|
||||
Do something as this object. This method is normally never
|
||||
called directly, instead incoming command instructions are
|
||||
|
|
@ -417,6 +417,9 @@ class ServerSession(Session):
|
|||
|
||||
Args:
|
||||
raw_string (string): Raw command input
|
||||
session (Session): This is here to make API consistent with
|
||||
Account/Object.execute_cmd. If given, data is passed to
|
||||
that Session, otherwise use self.
|
||||
Kwargs:
|
||||
Other keyword arguments will be added to the found command
|
||||
object instace as variables before it executes. This is
|
||||
|
|
@ -426,7 +429,7 @@ class ServerSession(Session):
|
|||
"""
|
||||
# inject instruction into input stream
|
||||
kwargs["text"] = ((raw_string,), {})
|
||||
self.sessionhandler.data_in(self, **kwargs)
|
||||
self.sessionhandler.data_in(session or self, **kwargs)
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Handle session comparisons"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue