Coder Social home page Coder Social logo

heufneutje / pyheufybot Goto Github PK

View Code? Open in Web Editor NEW
2.0 5.0 5.0 545 KB

A modular IRC bot written in Python, using Twisted. Abandoned, most popular modules have been ported to https://github.com/DesertBot/DesertBot

License: MIT License

Python 96.20% PHP 2.91% CSS 0.89%
irc-bot python twisted irc

pyheufybot's Introduction

Updates

A rewrite of my Java IRC bot RE_HeufyBot in Python, using Twisted for its connection management.

If you would like to play around with it, do the following:

  1. Clone the repository.
  2. Create and activate a virtualenv. You will have to download virtualenv for Python 2 if you do not already have it. You could also just install the requirements on your machine itself, but a virtualenv is easier to work with.
  3. Once the virtualenv is activated, run pip install -r requirements.txt.
  4. Create a config file (or copy the example one) and run python app.py.

RE_HeufyBot's flaws

RE_HeufyBot was an interesting project for me since I didn't use any IRC libraries and had to figure out everything in the core myself. Mainly because it was my first stab at writing things like this, or writing an IRC bot from scratch in general, the project had some fundamental design flaws. The biggest flaws were the broken config files, sockets breaking when trying to reconnect after losing connection, the lack of a message class and the late implementation of multiserver. This last one I regret the most. I should have designed it to be mutliserver in the first place, rather than hacking it into a core based on single connections later. Not having a message class was also quite annoying, as it meant bot instances, server instances and the like were passed around to modules and the code became a mess. Lastly I regret not thinking about how I wanted to do the module API before creating it. In the end I changed it a lot and even after all the changes its possibilties were very limited. This meant channel logging was done in the core, which kinda defeats the purpose of modularity.

Design goals for PyHeufyBot

  • Multiserver. Make the bot connect to multiple servers from the start and build the core to handle these mutliple connections.
  • A well defined module API. I would like the module API to do what RE_HeufyBot's API should have done in the first place; allowing for events to be caught and have the bot execute certain features based on those through its modules.
  • An action system. This will be the way the core and the modules can communicate with each other and also how modules can interact with other modules. This is based on the action system used in txircd and ElementalAlchemist deserves credit for it.
  • Better control over connections. With RE_HeufyBot it was impossible to start any new connections after the config files had been loaded. Reconnecting was impossible as stated before. By making use of a Twisted factory, this should go a lot smoother.

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.