prepend_padding
)
+ def is_admin(self):
+ """Boolean check whether an actor is controlled by an admin owner."""
+ return(self.owner and self.owner.is_admin())
+
def can_run(self, command):
"""Check if the user can run this command object."""
return(False)
# avatars of administrators can run any command
- if self.owner and self.owner.account.get("administrator"):
+ if self.is_admin():
return(True)
# everyone can run non-administrative commands
avatar, 6)
return avatars
+ def is_admin(self):
+ """Boolean check whether user's account is an admin."""
+ return(self.account.get("administrator", False))
+
def broadcast(message, add_prompt=True):
"""Send a message to all connected users."""
# display to connected administrators
for user in universe.userlist:
- if user.state == "active" and user.account.get(
- "administrator"
- ) and user.account.get("loglevel", 0) <= level:
+ if (
+ user.state == "active"
+ and user.is_admin()
+ and user.account.get("loglevel", 0) <= level):
# iterate over every line in the message
full_message = ""
for line in lines: