示例#1
0
文件: hubbub.py 项目: buzzworkers/tl
 def stop(self, botname, type, name, channel):
     """ stop watching a feed. """
     item = self.byname(name)
     if not item: return False
     try:
         logging.warn("trying to remove %s from %s feed list" % (name, channel))
         chan = ChannelBase(channel, botname)
         chan.data.feeds.remove(name)
         chan.save()
     except ValueError:
         logging.warn("can't remove %s from %s feed list" % (name, channel))
     try:
         item.data.watchchannels.remove([botname, type, channel])
         item.save()
         logging.debug("stopped %s feed in %s channel" % (name, channel))
     except ValueError: return False
     return True
示例#2
0
文件: bot.py 项目: buzzworkers/tl
 def join(self, channel, password=None):
     """ join a channel .. use optional password. """
     chan = ChannelBase(channel, self.cfg.name)
     if password:
         chan.data.key = password.strip()
         chan.save()
     result = Irc.join(self, channel, chan.data.key)
     if result != 1:
         return result
     got = False
     if not chan.data.cc:
         chan.data.cc = self.cfg.defaultcc or '!;'
         got = True
     if not chan.data.perms:
         chan.data.perms = []
         got = True
     if not chan.data.mode:
         chan.data.mode = ""
         got = True
     if got:
         chan.save()
     self.getchannelmode(channel)
     return 1