def __init__(self, bot, options): BasePlugin.__init__(self, bot, options) self.users = {} self.conf = ConfigObj("users.ini") try: if options["authtype"] == "nickserv": self.authtype = "nickserv" else: self.authtype = "pygbot" except: self.authtype = "pygbot"
def __init__(self, channel, filename): self.channel = channel self.filename = filename conf = ConfigObj('pyGBot.ini') try: print "Opening log file..." log.addScreenHandler(log.logger, log.formatter) log.addLogFileHandler(log.logger, conf['IRC']['logfile'], log.formatter) except IOError, msg: print "Unable to open log file: ", msg print "Defaulting to local." log.addLogFileHandler(log.logger, 'pyGBot.log', log.formatter)
def run(): try: conf = ConfigObj('pyGBot.ini') except IOError, msg: print "Can't open config file: ", msg sys.exit(1)
def __init__(self): try: conf = ConfigObj('pyGBot.ini') except IOError, msg: print "Cant open config file: ", msg sys.exit(1)
def __init__(self, bot, options): BasePlugin.__init__(self, bot, options) self.users = {} self.conf = ConfigObj("users.ini")
## pyGBot. ## Copyright (C) 2008 Morgan Lokhorst-Blight ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program. If not, see <http://www.gnu.org/licenses/>. ## import os import sys import hashlib from contrib.configobj import ConfigObj, ConfigObjError if __name__ == "__main__": uname = raw_input("Enter username: "******"Enter pw: ") + 'pygb0t').hexdigest() ulevel = raw_input("Enter userlevel (User, Mod or Admin): ") conf = ConfigObj('users.ini') conf[uname] = {'passhash': pwhash, 'userlevel': ulevel} conf.write()