Giter VIP home page Giter VIP logo

csbot's Introduction

csbot - an IRC bot

This is an IRC bot developed by members of HackSoc to provide various features in the #cs-york channel (and a few others) on Freenode.

Development

csbot is written for Python 3.6+ and based on the asyncio library which became part of the standard library in 3.4.

It's recommend to develop within a virtual environment. This should get you up and running [1]:

$ python3 -m venv venv3
$ source venv3/bin/activate
$ pip install -r requirements.txt
$ csbot --help

Look at csbot.deploy.cfg for an example of a bot configuration.

If you want to develop features for the bot, create a uniquely named plugin (see csbot/plugins/ for examples), try it out, preferably write some unit tests (see csbot/test/plugins/) and submit a pull request.

Deployment

Create csbot.cfg, and then use Docker Compose to build and launch the Docker containers (a MongoDB instance and the bot):

$ docker-compose up

This will use the published image. To build locally:

$ docker build -t alanbriolat/csbot:latest .

Environment variables to expose to the bot, e.g. for sensitive configuration values, should be defined in deploy.env. Environment variables used in docker-compose.yml should be defined in .env:

Variable Default Description
CSBOT_CONFIG_LOCAL ./csbot.cfg Path to config file in host filesystem to mount at /app/csbot.cfg
CSBOT_CONFIG csbot.cfg Path to config file in container, relative to /app
CSBOT_WATCHTOWER false Set to true to use Watchtower to auto-update when published container is updated

Backup MongoDB once services are running:

$ docker-compose exec -T mongodb mongodump --archive --gzip --quiet > foo.mongodump.gz

Restore MongoDB:

$ docker-compose exec -T mongodb mongorestore --archive --gzip --drop < foo.mongodump.gz

Documentation

The code is documented to varying degrees, and Sphinx-based documentation is automatically generated on Read the Docs: http://hacksoc-csbot.readthedocs.org. Of particular use is the "How to write plugins" section.

You can build the documentation yourself with:

$ pip install sphinx
$ cd docs/
$ make html

Testing

csbot has some unit tests. (It'd be nice to have more.) To run them:

$ pytest

We're also using Travis-CI for continuous integration and continuous deployment.

https://travis-ci.org/HackSoc/csbot.svg?branch=master https://coveralls.io/repos/HackSoc/csbot/badge.png
[1]csbot depends on lxml, which is a compiled extension module based on libxml2 and libxslt. Make sure you have the appropriate libraries and headers, e.g. python3-dev, libxml2-dev and libxslt1-dev on Ubuntu or Debian.

csbot's People

Contributors

alanbriolat avatar barrucadu avatar lordaro avatar haegin avatar bensimner avatar lexbailey avatar matzipan avatar helzibah avatar sourceless avatar fromankyra avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.