Crontab implementation for Errbot
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
errcron
samples
tests
.codeclimate.yml
.editorconfig
.gitignore
.travis.yml
CHANGES.rst
Dockerfile
LICENSE
MANIFEST.in
README.rst
docker-compose.yml
requirements.txt
setup.cfg
setup.py
tox.ini

README.rst

Crontab implementation for Errbot

It is extention for plugin of Errbot to implement poller llike crontab.

Version in PyPI python versions License Requirements Status

Requirements

Installation

$ pip install errcron
or
$ pip install git+https://github.com/attakei/errcron.git

Usage

Example

from errcron import CrontabMixin


class ClockTimer(CrontabMixin, BotPlugin):
    CRONTAB = [
        '@hourly .post_hourly',
        '0 8 * * * .post_morning_call @attakei'
    ]

    def activate(self):
        super().activate()
        # some expression

    def post_hourly(self, polled_time):
        user =  self.build_identifier('#general')
        return self.send(user, 'Just {} o-clock!!'.format(polled_time.strftime('%H')))

    def post_morning_call(self, polled_time, identity):
        user =  self.build_identifier(identity)
        return self.send(user, 'Good morning!')
  1. Extend your plugin by CrontabMixin
  2. Define crontab
  3. In activate, activate crontab too
  4. Run

Latest changes

version 0.4.4

  • Fix for latest crontab-parser
  • Fix test targets in Travis-CI

version 0.4.3

  • Add python 3.6 for test target (compatible)
  • Can import as from errcron import CrontabMixin

License

Errbot is available as open source software and released under the GPL v3 license.

See full license file.