def command_sqlconn(self, rest, nick, channel, user_host): if channel == "#cvn-staff" or (channel in self.oplist.keys() and (nick in self.oplist[channel] or nick in self.voicelist[channel])): try: self.sqldb = sqlclient(config.sqldbname, config.sqlpw, config.sqluser, config.sqlhost) return nick + ": Reconnected to MySQL server." except Exception, err: return "Error: " + str(err)
def signedOn(self): if twisted.version.major >= 12: self.heartbeatInterval = 30 self.msg("NickServ", "id " + config.password.partition(":")[2]) # .partition(":")[2] is the actual password of the bot, assuming you're using account:password format self.msg("NickServ", "ghost %s %s" % (config.nickname, config.password.partition(":")[2])) self.msg("NickServ", "release %s %s" % (config.nickname, config.password.partition(":")[2])) self.setNick(config.nickname) for channel in config.channels: self.join(channel) if config.useMySQL: self.sqldb = sqlclient(config.sqldbname, config.sqlpw, config.sqluser, config.sqlhost, port=config.sqlport) for channel in self.sqldb.fetch("SELECT ch_name FROM channels", multi=True): self.join(channel[0])