Giter Club home page Giter Club logo

irc-cah's Introduction

#Cards Against Humanity IRC bot

IRC bot that let's you play Cards Against Humanity in IRC. The game is running in IRCnet on #cah, but you can just as easily run your own instance on your own channel for more private games.

##Commands

  • !start # - Start a new game. Optional parameter can by used to set a point limit for the game (e.g. !start 10 to play until one player has 10 points.)
  • !stop - Stop the currently running game.
  • !pause - Pause the currently running game.
  • !resume - Resume a paused game.
  • !join - Join to the currently running game.
  • !quit - Quit from the game.
  • !cards - Show the cards you have in your hand.
  • !play # (#) - Play a card from your hand, # being the number of the card in the list. Play as many numbers separated by spaces as the current card required.
  • !winner # - Pick a winner of the round, # being the number of the entry in the list. Only for the current card czar.
  • !points - Show players' awesome points in the current game.
  • !list - List players in the current game.
  • !status - Show current status of the game. Output depends on the state of the game (e.g. when waiting for players to play, you can check who hasn't played yet)
  • !pick - Alias for !play and !winner commands.

Some of these commands reply as notice. If you use Irssi, you can use active_notice.pl to get notices on the active window instead of status window.

##Install

  1. Clone the repository.
  2. Edit configuration files with your channel & server settings.
  3. Install dependencies using npm install.

###Requirements

  • Node.js 0.10.*

##Run Run the bot by running node app.js, or if you want to run it with production settings instead of development, run NODE_ENV=production node app.js.

##Configuration Main configuration files are located in config/env. There are two files by default for two different environments, development and production (e.g. if you want to test the bot on a separate channel). For the clientOptions directive, refer to the Node-IRC documentation.

It is possible to configure the bot to send a message to a user or channel after connecting to server or joining a specific channel using connectCommands and joinCommands. This can be used, for example, to identify with NickServ on networks that require it. See examples below.

###Cards Card configuration is located in config/cards directory. Some files are included by default, that contain the default cards of the game plus some extra cards from BoardGameGeek. You can add your custom cards to Custom_a.json (for answers) and Custom_q.json (for questions), using the same format as the default card files. Any card you add to these files will also be automatically loaded to the game during start up..

###Notify Users Users currently in the channel with the bot can be notified when a game begins by setting the notifyUsers directive to true. Users with ~ and & modes are not notified.

###Set Topic The bot can be configured to set the channel topic indicating whether a game is running or not by setting the setTopic directive to true. The topicBase directive will be appended to the end of the status information. The bot must have permission in the channel for this to work.

###Point Limit You can set a default point limit in the configuration file by settings the pointLimit to any positive number. The game stops when a player reaches this point limit. 0 or a negative number means no point limit and games are played until !stop command is entered.

Additionally point limit can be set on a per game basis as a parameter for the !start command (see Commands).

###Connect and join command examples

####NickServer To identify with NickServ after connecting, you can use the following ´connectCommands´:

"connectCommands": [
    {
        "target": "nickserv",
        "message": "identify <password>"
    }
]

####Notify after connecting and joining #awesomechannel

This example will send you a private message when the bot has connected to server and another private message when it has joined #awesomechannel. The bot will also send a message to #awesomechannel saying that it's back and ready to play.

"connectCommands": [
    {
        "target": "yournick",
        "message": "Connected to server."
    }
],
"joinCommands": {
	"#awesomechannel": [
		{
			"target": "#awesomechannel",
			"message" "I'm back, let's play!"
		},
		{
			"target": "yournick",
			"message": "I just joined #awesomechannel."
		}
	]
}

##TODO

  • Save game & player data to MongoDB for all time top scores & other statistics.
  • Config options for rule variations, such as voting the best instead of card czar choosing the winner.
  • The haiku round.
  • Allow players to change one card per round (make it an option in config?)

##Contribute All contributions are welcome in any form, be it pull requests for new features and bug fixes or issue reports or anything else.

It is recommended to use the develop branch as a starting point for new features.

##Thanks Special thanks to everyone on the super awesome secret IRC channel that have helped me test this and given feedback during development.

##License Cards Against Humanity IRC bot and its source code is licensed under a Creative Commons BY-NC-SA 2.0 license.

irc-cah's People

Contributors

brycesteinhoff avatar jensrax avatar teeli 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

irc-cah's Issues

Command to view black cards

Due to the nature of the bot, the IRC server can see it as spam and kick it off. You CAN fix this by throttling, but in the short run of things, another command to view the black cards in play would be nice in event that the bot gets kicked off before it can say the black cards.

A bug in the mainframe

CARD: A bug in the mainframe (please file a bug report, if you actually get this card)
!play 0
StormFrog: You must pick 0 different cards.

Possibly unrelated, but after using !stop, someone used !play and this happened in console.

Round elapsed: 120000 1389513763560 1389513643560

/botpath/app/controllers/game.js:592
self.client.say(self.channel, string);
^
TypeError: Cannot call method 'say' of undefined
at Game.self.say (/botpath/app/controllers/game.js:592:21)
at Game.self.turnTimerCheck (/botpath/app/controllers/game.js:278:18)
at wrapper as _onTimeout
at Timer.listOnTimeout as ontimeout

Nickserv identify

Is there a way to identify the bot to Nickserv to allow certain bot flags to be assigned to it, reducing the need for flood protection? clientOptions has a 'password' field but that's for server auth, not ident

Thanks

Game starting with 3 players but not accepting more

Hey,
When starting a game with 4 players, the last !join command is ignored and the bot just starts the game. The 4th player can't join at all.

I'll try to see if I can debug this when getting home, but if you have any idea, I'll appreciate it!

Players who leave in-game without !quit

Is there any way to 'kick' an idle or a player who didn't properly !quit out of the game, or plans to have some way to control the players so that the game doesn't slow down because someone got booted or left?

Thanks

Points per game Limit (possible feature request)

It would be great to be able to specify max points per game in the config file. So that once a player reaches N points they win the game ends and a new game can be started.

Setting the value to 0 would mean no max points and games would last until they are stopped.

Configuration needs refactoring

Configuration is a bit of a mess right now and could use some refactoring. Environment based configuration is totally unnecessary. Configuration loader and validator should be moved to app.

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.