Move mentionable to room

This commit is contained in:
Joscha 2016-05-23 17:53:24 +02:00
parent 4d59e67291
commit b9a723f701
3 changed files with 7 additions and 21 deletions

View file

@ -71,15 +71,6 @@ class Message():
else:
return time.strftime("%H:%M:%S", time.gmtime(self.time))
def mentionable(self):
"""
mentionable() -> str
Converts the name to a mentionable format.
"""
return self.sender.mentionable()
def is_edited(self):
"""
is_edited() -> bool

View file

@ -257,14 +257,18 @@ class Room():
self._con.add_next_callback(self._handle_nick_reply)
self._con.send_packet("nick", name=nick)
def mentionable(self):
def mentionable(self, name=None):
"""
mentionable()
A mentionable version of the current nick.
A mentionable version of the name.
The name defaults to the bot's name.
"""
return "".join(c for c in self.nick if not c in ",.!?;&<'\"" and not c.isspace()).lower()
if name is None:
name = self.nick
return "".join(c for c in name if not c in ".!?;&<'\"" and not c.isspace())
def send_message(self, content, parent=None):
"""

View file

@ -52,15 +52,6 @@ class Session():
return self.id.split(":")[0]
def mentionable(self):
"""
mentionable() -> str
Converts the name to a mentionable format.
"""
return "".join(c for c in self.name if not c in ",.!?;&<'\"" and not c.isspace()).lower()
def is_staff(self):
"""
is_staff() -> bool