Move mentionable to room
This commit is contained in:
parent
4d59e67291
commit
b9a723f701
3 changed files with 7 additions and 21 deletions
|
|
@ -71,15 +71,6 @@ class Message():
|
||||||
else:
|
else:
|
||||||
return time.strftime("%H:%M:%S", time.gmtime(self.time))
|
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):
|
def is_edited(self):
|
||||||
"""
|
"""
|
||||||
is_edited() -> bool
|
is_edited() -> bool
|
||||||
|
|
|
||||||
|
|
@ -257,14 +257,18 @@ class Room():
|
||||||
self._con.add_next_callback(self._handle_nick_reply)
|
self._con.add_next_callback(self._handle_nick_reply)
|
||||||
self._con.send_packet("nick", name=nick)
|
self._con.send_packet("nick", name=nick)
|
||||||
|
|
||||||
def mentionable(self):
|
def mentionable(self, name=None):
|
||||||
"""
|
"""
|
||||||
mentionable()
|
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):
|
def send_message(self, content, parent=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -52,15 +52,6 @@ class Session():
|
||||||
|
|
||||||
return self.id.split(":")[0]
|
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):
|
def is_staff(self):
|
||||||
"""
|
"""
|
||||||
is_staff() -> bool
|
is_staff() -> bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue