Giter Site home page Giter Site logo

irc2phpbb's Introduction

Marvin, an IRC bot

The python script, irc2phpbb.py, is a implementation of an irc bot. The bot can answer simple questions and some more advanced features such as presenting the weather by scraping an external website and keeping track of forum posts and posting new posts to the channel. The bot is reading incoming entries from a directory and external scripts may put information there that should be displayed in the irc-channel.

The PHP-script aggregate.php is used to log in to the forum to get credentials to view the latest posts through rss. A SQLite database is used to keep track on which posts have been displayed in the irc-channel.

The basic code is from: http://osix.net/modules/article/?id=780 and http://oreilly.com/pub/h/1968. From there its further developed and customised to fit the target forum and target irc-channel.

The rfc for the irc protocol is quite helpful: http://www.irchelp.org/irchelp/rfc/

/Mikael Roos ([email protected])

Customised for dbwebb.se

The bot is created for use in irc://irc.bsnet.se/#db-o-webb which is an irc channel for teaching & learning HTML, CSS, JavaScript, PHP, SQL and Unix. The forum is http://dbwebb.se/forum.

This means that the code contains some settings to work in that environment and can therefore not just be cloned and installed. Modifications are needen. The script may anyhow be useful as a studyobject for those in need of simulare functionality.

Using feedparser to get RSS-feeds

The bot uses the feedparser python lib to parse RSS feeds, for example when getting the latest post to the forum. You'll have to download and install the lib yourself.

Using BeautifulSoup to scrap web-pages

The bot uses the python lib BeautifulSoup to scrap information from webpages. Just to show it off how its done but it can of course be made into some useful stuff. You'll have to download and install the lib yourself.

Using PHP to keep track on recent posts

The file aggregate.php uses magpierss (http://magpierss.sourceforge.net/) to aggregate feeds from several places and while discovering new entries it stores messages in the directory incoming where Marvin (the bot) is looking, when finding a file its content will be posted to the irc-channel by the bot. You'll have to download and install the lib yourself.

Run aggregate.php from crontab with regular intervalls, for example each 5 minute.

*/5 * * * * /usr/local/bin/php /home/mos/git/irc2phpbb/aggregate.php

The id of the feed items are stored in a SQLite database to avoid duplicates being posted.

History

Todo.

  • Cache responses from smhi & sunrise services
  • Add logfile entry containing current online users in the irc-channel

v0.2.x (latest)

  • Fixed loggin of ACTION.
  • Logging as utf-8 to logfile in json format.
  • Managing all strings as unicode internally.
  • Improved encoding of incoming messages though decode_irc.
  • Issues with irclog, utf8 and json encoding to file. debugging.

v0.2.1 (2012-05-14)

  • Corrected. Failed to decode utf-8 to json.

v0.2.0 (2012-05-13)

  • log all traffic in irc-channel to irclog.txt as json-encoded format.
  • aggregate.php, remove duplicate post in same thread. Only show one.
  • created functions sendMsg and sendPrivMsg to gather all output, reduce codelines and centralise logging
  • corrected that occasionally only sent one entry from the incoming directory thought it was more to send.
  • Make \r\n in central sendMsg() for each request

v0.1.0 (2012-02-14)

  • First tag after some live testing for a couple of months. Must start somewhere.

.
..: Copyright 2011 by Mikael Roos ([email protected])

irc2phpbb's People

Contributors

mosbth avatar

Watchers

James Cloos avatar Oskar Nellfors 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.