Giter Site home page Giter Site logo

pyaib's Introduction

Python Async IrcBot framework (pyaib)

pyaib is an easy to use framework for writing irc bots. pyaib uses gevent for its Asynchronous bits.

Features

  • SSL/IPv6
  • YAML config
  • plugin system
  • simple nickserv auth
  • simple abstract database system

Setup

pip install pyaib

or

python setup.py build
python setup.py install

Example

Take a look at the example directory for an example bot called 'botbot'

Run:

python example/botbot.py

Try adding your own plugins in example/plugins.

Take a look at the wiki for information about plugin writing and using the db component.

See the CONTRIBUTING file for how to help out.

License

pyaib is Apache licensed, as found in the LICENSE file.

pyaib's People

Contributors

babar avatar boogles avatar filippog avatar fried avatar highb avatar jamesgpearce avatar jfhbrook avatar jstraw avatar psykzz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyaib's Issues

Proposing a PR to fix a few small typos

Issue Type

[x] Bug (Typo)

Steps to Replicate and Expected Behaviour

  • Examine pyaib/linesocket.py, pyaib/util/decorator.py and observe proccess, however expect to see process.
  • Examine pyaib/triggers.py and observe responces, however expect to see responses.
  • Examine pyaib/util/decorator.py and observe recusive, however expect to see recursive.
  • Examine pyaib/linesocket.py and observe excaption, however expect to see exception.

Notes

Semi-automated issue generated by
https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

To avoid wasting CI processing resources a branch with the fix has been
prepared but a pull request has not yet been created. A pull request fixing
the issue can be prepared from the link below, feel free to create it or
request @timgates42 create the PR. Alternatively if the fix is undesired please
close the issue with a small comment about the reasoning.

https://github.com/timgates42/pyaib/pull/new/bugfix_typos

Thanks.

When Ping timeout the bot does not try to reconnect

When PING timeout after being disconnected bot dies is that normal behavior or should it tries to reconnect :

...
[16:35:39] u'PING :kornbluth.freenode.net'
[16:35:39] u'PONG :kornbluth.freenode.net'
[16:59:32] u'PING :kornbluth.freenode.net'
[16:59:32] u':ircname!~ircbot@hostname QUIT :Ping timeout: 252 seconds'
[16:59:32] u'ERROR :Closing Link: hostname (Ping timeout: 252 seconds)'
Killing read and write loops

subprocess blocking causes pyaib to timeout

if i use
from subprocess import call
the call command execute a ncftpget and download a file and take a lot of time to execute...

so the greenlet thread get stuck and not answer the ping from irc server ...

Error binding parameter 1 - probably unsupported type.

I'm using this project for a community bot and just started upgrading to v2. This is in part because it looks like my bot doesn't create a sqlite db with v1 (maybe that functionality was shimmed back then?). While I didn't have my bot creating a sqlite db before, now I get this crazy error:

$ python ./moodybot.py
Config Module Loaded.
Loaded Config from moodybot.conf.
Loading Component triggers...
Triggers Loaded
Loading Component channels...
Channel Management Loaded
Loading Component plugins...
Loading Component db...
Sqlite DB Driver Loaded!
Loading Plugin ddg...
/Users/josh/dev/jfhbrook/moodybot/env/lib/python2.7/site-packages/grequests.py:21: RuntimeWarning: Patching more than once will result in the union of all True parameters being patched
  curious_george.patch_all(thread=False, select=False)
Loading Plugin eliza...
Loading Plugin jokes...
Loading Plugin pug...
Loading Plugin reddit...
Loading Plugin source...
Loading Plugin karma...
Trying Connect(('54.174.129.87', 6667))
Connection Open.
Starting Read/Write Loops
Starting Timers Loop
Loading Channels from DB
Traceback (most recent call last):
  File "/Users/josh/dev/jfhbrook/moodybot/env/lib/python2.7/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/Users/josh/dev/jfhbrook/moodybot/env/lib/python2.7/site-packages/pyaib/channels.py", line 55, in _autojoin
    self.db.commit()
  File "/Users/josh/dev/jfhbrook/moodybot/env/lib/python2.7/site-packages/pyaib/db.py", line 154, in commit
    self._meta['bucket'])
  File "/Users/josh/dev/jfhbrook/moodybot/env/lib/python2.7/site-packages/pyaib/dbd/sqlite.py", line 100, in updateObject
    self.setObject(obj, key, bucket)
  File "/Users/josh/dev/jfhbrook/moodybot/env/lib/python2.7/site-packages/pyaib/dbd/sqlite.py", line 96, in setObject
    (key, memoryview(compress(jsonify(obj)))))
InterfaceError: Error binding parameter 1 - probably unsupported type.
<Greenlet at 0x106b96050: <bound method Channels._autojoin of <pyaib.channels.Channels object at 0x106867110>>({u'reddit': <plugins.reddit.RedditTailer object at)> failed with InterfaceError

I've gotten about as far as noting that the tables are initialized to use blob types, and that rows are being saved with a string and a memoryview. Perhaps we need to typecast to a buffer on save ?

Make it clearer how to create a new db_driver

https://github.com/facebook/pyaib/wiki/db

Just decorate your db driver class, and implement all the methods mentioned in the doc at the top of pyaib.db from pyaib.db import db_driver

It's not quite as easy as that.

  1. The location of the new db_driver must be specified in the config file under db.backend.

  2. The location of the file must contain a ., otherwise pyaib will search its internal dbd directory (which only contains one potential database driver anyway). This also restricts the possible locations of the file - it can't be in the top-level directory, for example.

  3. The location of the database file itself must be specified for each new db_driver, and this is especially confusing without carefully tracking the odd decisions in db.py - it must be specified as "db.driver.{}", where {} is the last part of the value of db.backend - for example, if db.backend is plugins.database_manager, then the location of the database file must be stored in db.driver.database_manager. What if the user picks the name "sqlite" as their filename - why destroy the name data and introduce ambiguity?

I'd like to request that the documentation for this be cleaned up, so that others don't have to track through the source code to make pyaib recognise their own database driver.

Not able to modify config

I'm looking to bind the nickserv password to a command line argument so I can upload the config to a public github without fear of my bot's IRC registration being stolen.

In bot.py (as per the example setup) I've used the argparse module to take a password argument. I've also removed the nickserv component in bot.conf and added a nickserv plugin, which is just a duplicate of the nickserv component except it runs a print after sending the IDENTIFY to nickserv just to confirm that it got the password right.

In bot.conf, I set the default password in password in plugin.nickserv to "hunter2".

In bot.py, before I do bot.run(), I do bot.config.plugin.nickserv.password = args.password. I print bot.config before and after this change to confirm that it has, in fact, changed. It has.

However, when I reach the print statement at the end of nickserv.py, the message that was sent was "IDENTIFY hunter2". The config was not changed.

Is there a way to modify the config on the fly?

If it's of any help, I've got a gist with bot.conf, bot.py, plugins/nickserv.py and my console output here: https://gist.github.com/rossjrw/75b3ecc55d4ee7d0a70b2f8e4bb879ba

Many thanks.

segmentation fault on a raspberrypi

On a raspberrypi with raspbian (up-to-date) and latest gevent-1.0 / greenlet-0.4.2 from pip :

$ python ircbot.py
Config Module Loaded.
Loaded Config from ircbot.conf.
Loading Component triggers...
Triggers Loaded
Loading Component channels...
Channel Management Loaded
Loading Component plugins...
[1]    6861 segmentation fault  python ircbot.py

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.