예제 #1
0
    def check(self, source, nickname):
        if not nickname in self.config:
            self.client.reply(source, 'I have never seen %s' % nickname)

        if isinstance(self.config[nickname], dict):
            self.client.reply(
                source, '%s was last seen %s in %s' %
                (nickname,
                 timesince(
                     datetime.datetime.utcfromtimestamp(
                         self.config[nickname]['time'])),
                 self.config[nickname]['channel']))
        else:
            self.client.reply(
                source, '%s was last seen %s' %
                (nickname,
                 timesince(
                     datetime.datetime.utcfromtimestamp(
                         self.config[nickname]))))
예제 #2
0
파일: seen.py 프로젝트: akrabat/DASBiT
    def check(self, source, nickname):
        if not nickname in self.config:
            self.client.reply(source, "I have never seen %s" % nickname)

        if isinstance(self.config[nickname], dict):
            self.client.reply(
                source,
                "%s was last seen %s in %s"
                % (
                    nickname,
                    timesince(datetime.datetime.utcfromtimestamp(self.config[nickname]["time"])),
                    self.config[nickname]["channel"],
                ),
            )
        else:
            self.client.reply(
                source,
                "%s was last seen %s"
                % (nickname, timesince(datetime.datetime.utcfromtimestamp(self.config[nickname]))),
            )
예제 #3
0
    def checkReminder(self, message):
        if not message.prefix['nickname'] in self.config:
            return

        nickname = message.prefix['nickname']

        for reminder in self.config[nickname]:
            # Fallback for old reminders
            if not 'time' in reminder:
                date = datetime.datetime.utcnow()
            else:
                date = datetime.datetime.utcfromtimestamp(reminder['time'])

            self.client.reply(
                message, '%s, %s wants me to remind you %s (written %s)' %
                (nickname, reminder['from'], reminder['message'],
                 timesince(date)))

        del self.config[nickname]
        self.config.save()
예제 #4
0
파일: remind.py 프로젝트: Bittarman/DASBiT
    def checkReminder(self, message):
        if not message.prefix['nickname'] in self.config:
            return

        nickname = message.prefix['nickname']

        for reminder in self.config[nickname]:
            # Fallback for old reminders
            if not 'time' in reminder:
                date = datetime.datetime.utcnow()
            else:
                date = datetime.datetime.utcfromtimestamp(reminder['time'])

            self.client.reply(
                message,
                '%s, %s wants me to remind you %s (written %s)' % (
                    nickname, reminder['from'], reminder['message'], timesince(date)
                )
            )

        del self.config[nickname]
        self.config.save()
예제 #5
0
파일: remind.py 프로젝트: DASPRiD/DASBiT
    def checkReminder(self, message):
        if not message.prefix['nickname'] in self.config:
            return

        nickname = message.prefix['nickname']
        unsent   = []

        for reminder in self.config[nickname]:
            # Fallbacks for old reminders
            if not 'channel' in reminder:
                channel = None
            else:
                channel = reminder['channel']

            if not 'time' in reminder:
                date = datetime.datetime.utcnow()
            else:
                date = datetime.datetime.utcfromtimestamp(reminder['time'])

            if channel != None and channel != message.target.lower():
                unsent.append(reminder)
                continue

            self.client.reply(
                message,
                '%s, %s wants me to remind you %s (written %s)' % (
                    nickname, reminder['from'], reminder['message'], timesince(date)
                )
            )

        if len(unsent) > 0:
            self.config[nickname] = unsent
        else:
            del self.config[nickname]

        self.config.save()
예제 #6
0
파일: uptime.py 프로젝트: DASPRiD/DASBiT
    def getUptime(self, source):
        process = psutil.Process(os.getpid())

        self.client.reply(source, 'Uptime: %s' % timesince(datetime.datetime.utcfromtimestamp(process.create_time()), ''))