示例#1
0
class SecondLife(BotPlugin):
    """Integrating your Second Life into Err"""
    min_err_version = '1.6.0' # Optional, but recommended
    max_err_version = '1.7.1' # Optional, but recommended

    def activate(self):
        if not self.config or not set(self.config).issuperset(set(("USERNAME", "PASSWORD"))):
            logging.info("SecondLife plugin not configured, aborting activation")
        else:
            self.mysl = MySecondLife(self.config['USERNAME'], self.config['PASSWORD'])
            super(SecondLife, self).activate()

    def get_configuration_template(self):
        return {'USERNAME': "******", 'PASSWORD': "******"}

    @botcmd(split_args_with=None)
    def secondlife_friends(self, mess, args):
        """Tells you which of your friends are currently online"""
        friends = self.mysl.friends_online()
        return u"You currently have {} friends online:\n{}".format(len(friends), u"\n".join(friends))
示例#2
0
 def activate(self):
     if not self.config or not set(self.config).issuperset(set(("USERNAME", "PASSWORD"))):
         logging.info("SecondLife plugin not configured, aborting activation")
     else:
         self.mysl = MySecondLife(self.config['USERNAME'], self.config['PASSWORD'])
         super(SecondLife, self).activate()