Added the ability for the IRC bot to parse /me emotes from the IRC channel.

This commit is contained in:
Griatch 2013-01-30 15:14:30 +01:00
parent ebbc022fba
commit 41859d9e46

View file

@ -52,6 +52,7 @@ class IRC_Bot(irc.IRCClient):
msg_info(msg)
logger.log_infomsg(msg)
def privmsg(self, user, irc_channel, msg):
"Someone has written something in irc channel. Echo it to the evennia channel"
#find irc->evennia channel mappings
@ -69,6 +70,23 @@ class IRC_Bot(irc.IRCClient):
for conn in conns:
if conn.channel:
conn.to_channel(msg)
def action(self, user, irc_channel, msg):
"Someone has performed an action, e.g. using /me <pose>"
#find irc->evennia channel mappings
conns = ExternalChannelConnection.objects.filter(db_external_key=self.factory.key)
if not conns:
return
#format message:
user = user.split("!")[0]
if user:
user.strip()
else:
user = _("Unknown")
msg = "[%s] *%s@%s %s*" % (self.factory.evennia_channel, user, irc_channel, msg.strip())
#logger.log_infomsg("<IRC: " + msg)
for conn in conns:
if conn.channel:
conn.to_channel(msg)
def msg_irc(self, msg, senders=None):
"""