How to tell admins (or others?) when connected

82 Views Asked by At

I'm using errbot running in a docker container, and would like it to announce when a new version has been deployed. One of my plugins implements some custom commands for health checks, so I implemented a callback_connected method in that plugin and called warn_admins from there:

def _say_version(self):
    version = self.bot_config.BOTLL_VERSION_STRING
    revision=None
    with open(os.path.join(self.bot_config.BOT_DATA_DIR, "revision"), "r") as buildfile:
        revision=buildfile.readline()
    if revision:
        version += "." + revision
    return "%s version %s" % (self.bot_config.BOT_IDENTITY['username'], version) 

def callback_connected():
    self.warn_admins("Connected " + self._say_version())

I know that other admin warnings work (because when I mess something up I get messages about it), I know that my _say_version method works because it is used in some other responders in the plugin.

I also tried using send from the same method:

def callback_connected():
    for admin in self.bot_config.BOT_ADMINS:
        self.send(self.build_identifier(admin), "Connected " + self._say_version())

... but neither produced any message for me. I'm using the Slack backend, in case that matters.

Is there some other place I should put this?

0

There are 0 best solutions below