Made ircbot work correctly with latest code, lead to a fixing of a bug in script creation.

This commit is contained in:
Griatch 2015-03-07 13:22:11 +01:00
parent f901da0474
commit fc56b12f52
4 changed files with 11 additions and 6 deletions

View file

@ -120,13 +120,13 @@ class Bot(DefaultPlayer):
""" """
Evennia -> outgoing protocol Evennia -> outgoing protocol
""" """
pass super(Bot, self).msg(text=text, from_obj=from_obj, sessid=sessid, **kwargs)
def execute_cmd(self, raw_string, sessid=None): def execute_cmd(self, raw_string, sessid=None):
""" """
Incoming protocol -> Evennia Incoming protocol -> Evennia
""" """
pass super(Bot, self).msg(raw_string, sessid=sessid)
def at_server_shutdown(self): def at_server_shutdown(self):
"We need to handle this case manually since the shutdown may be a reset" "We need to handle this case manually since the shutdown may be a reset"
@ -198,7 +198,7 @@ class IRCBot(Bot):
if "from_channel" in kwargs and text and self.ndb.ev_channel.dbid == kwargs["from_channel"]: if "from_channel" in kwargs and text and self.ndb.ev_channel.dbid == kwargs["from_channel"]:
if "from_obj" not in kwargs or kwargs["from_obj"] != [self.id]: if "from_obj" not in kwargs or kwargs["from_obj"] != [self.id]:
text = "bot_data_out %s" % text text = "bot_data_out %s" % text
self.msg(text=text) super(IRCBot, self).msg(text=text)
def execute_cmd(self, text=None, sessid=None): def execute_cmd(self, text=None, sessid=None):
""" """
@ -211,7 +211,6 @@ class IRCBot(Bot):
if self.ndb.ev_channel: if self.ndb.ev_channel:
self.ndb.ev_channel.msg(text, senders=self.id) self.ndb.ev_channel.msg(text, senders=self.id)
# RSS # RSS
class RSSBot(Bot): class RSSBot(Bot):
@ -260,6 +259,8 @@ class RSSBot(Bot):
if self.ndb.ev_channel: if self.ndb.ev_channel:
self.ndb.ev_channel.msg(text, senders=self.id) self.ndb.ev_channel.msg(text, senders=self.id)
# IMC2
class IMC2Bot(Bot): class IMC2Bot(Bot):
""" """
IMC2 Bot IMC2 Bot

View file

@ -350,7 +350,6 @@ class DefaultPlayer(PlayerDB):
pass pass
# session relay # session relay
if sessid: if sessid:
# this could still be an iterable if sessid is an iterable # this could still be an iterable if sessid is an iterable
sessions = self.get_session(sessid) sessions = self.get_session(sessid)

View file

@ -58,7 +58,7 @@ class ScriptHandler(object):
definition) definition)
autostart - start the script upon adding it autostart - start the script upon adding it
""" """
if self.obj.__class__.__name__ == "PlayerDB": if self.obj.__dbclass__.__name__ == "PlayerDB":
# we add to a Player, not an Object # we add to a Player, not an Object
script = create.create_script(scriptclass, key=key, player=self.obj, script = create.create_script(scriptclass, key=key, player=self.obj,
autostart=autostart) autostart=autostart)

View file

@ -10,6 +10,11 @@ from twisted.internet import protocol
from evennia.server.session import Session from evennia.server.session import Session
from evennia.utils import logger from evennia.utils import logger
# IRC colors
# IRC bot # IRC bot