コード例 #1
0
ファイル: cortex.py プロジェクト: johnmarc/MongoBot
    def __init__(self, master, electroshock=False):

        print '* Initializing'
        self.master = master
        self.settings = master.settings
        self.secrets = master.secrets
        self.channels = self.secrets.channels
        self.context = self.secrets.primary_channel
        self.personality = self.settings.bot

        self.enabled = self.settings.plugins.values().pop(0)

        metacortex.botnick = self.personality.nick

        print '* Exciting neurons'
        Neurons.cortex = self

        print '* Connecting to datastore'
        connectdb()

        print '* Fondly remembering daddy'
        admin = Id(self.secrets.owner)
        if not admin.password:
            print '*' * 40
            print 'Hey %s! You haven\'t set a password yet! As my daddy you really need a password.' % self.secrets.owner
            tmp_pass = getpass(
                'Before I can continue, please enter a password: '******'See? Was that so hard?'
            admin.setpassword(tmp_pass, True)
            tmp_pass = None

        print '* Loading brainmeats'
        self.loadbrains(electroshock)
コード例 #2
0
ファイル: cortex.py プロジェクト: elliottcarlson/MongoBot
    def __init__(self, master, electroshock=False):

        print '* Initializing'
        self.master = master
        self.settings = master.settings
        self.secrets = master.secrets
        self.channels = self.secrets.channels
        self.context = self.secrets.primary_channel
        self.personality = self.settings.bot

        self.enabled = self.settings.plugins.values().pop(0)

        metacortex.botnick = self.personality.nick

        print '* Exciting neurons'
        Neurons.cortex = self

        print '* Connecting to datastore'
        connectdb()

        print '* Fondly remembering daddy'
        admin = Id(self.secrets.owner)
        if not admin.password:
            print '*' * 40
            print 'Hey %s! You haven\'t set a password yet! As my daddy you really need a password.' % self.secrets.owner
            tmp_pass = getpass('Before I can continue, please enter a password: '******'See? Was that so hard?'
            admin.setpassword(tmp_pass, True)
            tmp_pass = None

        print '* Loading brainmeats'
        self.loadbrains(electroshock)
コード例 #3
0
ファイル: peeps.py プロジェクト: johnmarc/MongoBot
    def passwd(self):
        whom = Id(self.lastid)

        if not whom.is_authenticated:
            self.chat('STRANGER DANGER!')
            return

        if not self.values:
            self.chat('Enter a password.')
            return

        if self.context_is_channel:
            self.chat('Not in the channel, you twit.')
            return

        whom.setpassword(' '.join(self.values))
        self.chat('All clear.')
コード例 #4
0
ファイル: peeps.py プロジェクト: johnmarc/MongoBot
    def adduser(self):
        if not self.values:
            self.chat("Who are you trying to add?")
            return

        whom = Id(self.lastid)

        if not whom.is_authenticated:
            self.chat("I'm sorry, Dave, I'm afraid I can't do that")
            return

        new_user = Id(self.values[0])
        tmp_pass = str(totp.now())
        new_user.setpassword(tmp_pass, True)

        self.chat('Hi %s, your temporary password is %s. Please set up your user '
        'by identifying yourself to me via private message (.identify %s) and '
        'then changing your password (.passwd <newpass>).' % (new_user.nick,
        tmp_pass, tmp_pass), target=new_user.nick)