Giter VIP home page Giter VIP logo

depressionbot's Introduction

Depressionbot IRC Bot

Introduction

Depressionbot is an IRC bot which aims to be the fanciest IRC bot around - On the general standard of software fanciness, dbot is rated as being '75% the same as bathing in fine, fine grape juice.'

Please note that this documentation is not complete and is a work in progress, given I started it rather a long time after I began development of the project. Please don't judge me too harshly for this as I am, in fact, mildly allergic to writing documentation.

Requirements:

  • Node JS
  • JSBot, the Javascript library I wrote to handle the IRC protocol and event listeners etc.
  • Various modules have their own requirements also.

Modules:

Command

This handles the command execution logic for DBot.

  1. Does the input match a command key in dbot.commands ?
  2. Is there a quote category which matches the first part of the input (~category)?
  3. Is there a command name similar to to the first part of the input (~name) in dbot.commands?

This is the only module which is force loaded, even if it's not in the configuration.

Quotes

This is the original reason that DBot was created, stores and displays quotes.

Commands:

  • ~q category - Display a random quote from a given category.
  • ~qadd category=newquote - Add a new quote to the database.
  • ~qstats - Show a list of the biggest quote categories.
  • ~qsearch category needle - Search for a quote in a given category.
  • ~rmlast [category] - Remove the last quote added to a given category, or the last quote added.
  • ~rm category quote - Remove a given quote from the given category.
  • ~qcount category - Show the number of quotes stored in the given category.
  • ~rq - Show a random quote from a random category.
  • ~d - Show a quote from the category which matches the bot's name.
  • ~link category - Create a link to the page on the web interface which displays the given category's quotes.
  • ~qprune - Delete empty quote categories.

Unfortunately, this module is fairly highly coupled with certain other areas of the program. I am working on this, but note, for example, that one can still access quotes with the ~category syntax even if the quotes module isn't loaded.

Admin

Various administration functionality such as banning users, hot-reloading the code and ordering him to talk. Note that commands added here are handled with their own listener, rather than being part of the command logic which is handled by the Command module. Functionality in this module can be slightly unsafe as not much error checking on the input is performed.

TODO: Add summaries for each command in this module.

Spelling

Will attempt to correct a users' spelling by using the levenshtein distance algorithm. One corrects the spelling of their previous message by simply posting a message with their correction and an asterisk:

> user: I am a tutrle.
> user: *turtle
user meant: I am a turtle.

The regular expression for this module also accepts two asterisks at the beginning of the correction, or at the end; it also accepts several words as the correction and deals with these fairly intelligently. Users may also attempt to correct another users like so:

> userone: I am a tutrle.
> usertwo: userone: *turtle
> usertwo thinks userone meant: I am a turtle.

JS

This module provides two commands which allow the execution of Javascript code. For regular users, there is the ~js command, which is completely sandboxed, but can still be used for calculation and the like.

> ~js Array(16).join('wat'-1) + " Batman!";
'NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!'

This feature is fairly safe as the user doesn't have access to anything dangerous, and is safe from infinite loops or locking DBot up because the code which is run is killed if it does not finish within a short amount of time.

For administrators, the incredibly useful ~ajs command is also available. The input for this command is simply 'eval'-ed and therefore has full access to DBot's memory. Of course, this is incredibly unsafe, but I find it rather fun; remember to only give extremely trusted friends administrator access to DBot, as there's nothing to stop them wiping the database or something similar - if you're worried about that kind of thing, do not load this module.

However, it's useful for many things, such as administrative activity for which there isn't a command in the admin module. For example, you could hot-add a new administrator like this:

> ~ajs dbot.admin.push('batman');
2

You can also use this for debugging, or even adding new commands while DBot is running.

depressionbot's People

Contributors

reality avatar psquid avatar alexanderpbrown avatar dafrancis avatar danhedron avatar n3hima-mothball avatar

Stargazers

 avatar

Watchers

 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.