Giter Club home page Giter Club logo

dywypi's Introduction

dywypi

dywypi is an IRC bot you can extend with plugins.

It also contains a simple IRC protocol implementation for asyncio, which can be used independently of the bot.

Setup

dywypi requires at least Python 3.3 โ€” it's based on the asyncio library, which uses the yield from syntax.

dywypi has not yet had a stable release, so you must install it from git. (You may wish to do this from a virtualenv.)

pip install [--user] 'git+https://github.com/eevee/dywypi.git#egg=dywypi'

Starting the bot

To start the bot run python -m dywypi ircs://<nick>:<password>@<host>/<channel>, for example: python -m dywypi ircs://atlas:[email protected]/example.

Note that depending on your system, your Python 3 binary may be called python3.

By default, the bot doesn't load any plugins. Pass one or more -p <name> to load plugins by name, or use -p ALL to load all detected plugins.

Creating a plugin

You do not need to edit dywypi's codebase to create new plugins. Instead, put your plugin modules in a dywypi_plugins directory. Any module in the dywypi_plugins. namespace will be automatically discovered and scanned. (Of course, you must still load your plugin with -p <name> or -p ALL.)

Don't create a dywypi_plugins/__init__.py. dywypi_plugins is a namespace package (see PEP 420) and should never contain an __init__.py.

Example Plugin: Reverse

from dywypi.plugin import Plugin

plugin = Plugin('reverse')

@plugin.command('reverse')
def reverse(event):
    yield from event.reply(event.message[::-1])

A conversation with a bot running the reverse plugin would look something like this:

<campaul> atlas: reverse foobar
<atlas> campaul: raboof

Development

You can install in "editable" mode by passing -e to pip install.

The (currently rather small) test suite uses pytest. Run it with py.test dywypi. Tox is also supported; you should be able to run tox to run the test suite with coverage support and also do a flake8 pass.

Tickets and pull requests are welcome!

dywypi's People

Contributors

eevee avatar campaul 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.