Code Monkey home page Code Monkey logo

node-ircbot's Introduction

NodeJS IRC bot with plugin support

How to get it

npm install ircbot

Or you can clone this repo.

How to use it

Check out example/bot.js for creating an instance of the bot.

Plugins

admin

This plugin provides an interface for dealing with the bot via irc. It provides the following commands: load, unload, prefix, permissions, summon, banish. Commands by default are prefixed with !, though this is something you can change.

load

If you wanted to run the dice plugin on #chan1 and #chan2, and not reply to PMs, do:

!load dice chan:#chan1,#chan2 !pm

If you wanted to have the admin plugin only work for user Joe, do:

!load admin nick:joe

If you wanted the dice plugin to only respond to PMs, do:

!load dice !chan

If you wanted to ban Joe and Schmoe from the dice plugin, do:

!load dice !nick:Joe,Schmoe

If you want to block all PMs and block Joe from using the dice plugin in a chan, do:

!load dice !nick:Joe !pm

If chan and !chan, or nick and !nick are found, the allow versions override the deny versions. If no allow/deny parameters are specified, it will respond to all channel messages and all PMs.

If you want to load a plugin with a different prefix, do:

!load dice cmdprefix:@

For the dice plugin only, commands that require a prefix will use @ instead of !.

Lastly, some plugins may allow you to pass in other options. You do this in the same format as specified above. For example:

!load dice cap:50

unload

This simply takes a single argument, the name of the plugin to unload:

!unload dice

prefix

Use this to change the prefix character to trigger commands that require it:

!prefix admin ;

Going forward, if you wanted to load a plugin:

;load dice

If dice had any prefixed commands, those would still default to ! unless specified.

permissions

This will chance the chan and nick based restrictions similar to load, only it won't reload the plugin, so any state you have will be maintained.

!permissions admin nick:joe

This will make the admin plugin only respond to someone named joe from now on. It removes all other permissions and replaces it with what you put here.

summon

This takes a list of channels you wish to have the bot join:

!summon #chan1 #chan2 #chan3

banish

This takes a list of channels you wish the bot to leave:

!banish #chan1 #chan2 #chan3

dice

This plugin provides a die roller, and also a limited calculator along with it. It will parse each line for dice expressions, evaluate them all, then return the results. By default it will have a cap of 100 dice.

For example:

Joe: I attack at [1d20+8] and deal [2d6+3] damage!
Bot: Joe: [1d20+8] => 13,8 => 21, [2d6+3] => 3,6,3 => 12

Some games need exploding dice, which is a feature that when the maximum value of the die is rolled you get to reroll it and total the results. The e and E operators will do this for you:

Joe: Come on luck roll! [2e6]
Bot: Joe: [2e6] => 5,6,3 => 14

The exploding rolls will always follow after the die that triggered it.

Option: cap

This sets the maximum number of dice tat will be rolled before taking into account exploding dice. The default is 100. With the default, [101d100] will cause an error to be displayed. Any chaining dice that has a result in over the cap will trigger the error, ie: [50d50d6] is rather likely to be well over the 100 cap. The option argument to pass in is in the form of cap:100, or:

!load dice cap:100

farkle

This plugin will allow one game of farkle per channel. When loaded, you should use the !pm option to block out PM use of this plugin (this is likely to be fixed in a future version).

use !help to learn more about this plugin.

sw

This is a Savage Worlds plugin that provides commands to help with that RPG system. It has the following commands: card, init, initshuffle, draw, shuffle.

card

This command will display a randomly selected card from a standard deck, including jokers. Cards are in the format of VS, where V is the value selected from A,2,3,4,5,6,7,8,9,T,J,Q,K,A and S is a suit from D,H,C,S (Diamonds, Hearts, Clubs, Spades). Jokers are special, in that the red and black ones are JR and JB respectively.

init

This will draw one card off of the shared initiative deck. When it runs out it will automatically shuffle.

initshuffle

This will force the shared initiative deck to shuffle.

draw

This command without any arguments will draw one card off of your personal deck, which is tied to your current nick. Optionally you may pass in a number of cards to be drawn. If the cards to be drawn are greater than the number of cards left, it will shuffle first, and then draw.

shuffle

This command will shuffle the personal deck that is tied to your current nick.

node-ircbot's People

Contributors

draggor avatar stigi avatar

Stargazers

翎栋 avatar jake avatar Mathieu M-Gosselin avatar Matt Varian avatar Charlike Mike Reagent avatar Maciek Baron avatar Tyler "-z-" Mulligan avatar  avatar Jonathan Larsen avatar  avatar Sin V. avatar Ryan Scheel avatar JT5D avatar Ben Sparks avatar Epoch Wolf avatar Shogo Iwano avatar Craig Cannon avatar Fae Hutter avatar node-migrator-bot avatar Christian Vaagland Tellnes avatar Jeremy Kahn avatar Eric Elliott avatar Mathew Peterson avatar  avatar Christopher McCulloh avatar Julian Bilcke avatar  avatar  avatar

Watchers

 avatar James Cloos avatar Brandon Anzaldi avatar sagax avatar Erick De Leon avatar

node-ircbot's Issues

Error when calling loadPlugin() with one arg

In the example bot.js you show loading a plugin with only one arg, e.g. b.loadPlugin('dice');.

However this will error on the line:
pl.cmdPrefix = options.cmdprefix && options.cmdprefix[0] ? options.cmdprefix[0] : '!';
with 'Cannot read property 'cmdprefix' of undefined'.
That line should probably read something like:
pl.cmdPrefix = options && options.cmdprefix && options.cmdprefix[0] ? options.cmdprefix[0] : '!';

In the mean time the work around is using b.loadPlugin('dice', {});.

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.