Giter Site home page Giter Site logo

anarchist's Introduction

anarchist

anarchist is a chat-bot written for the lemon chicken sandwich, quite possibly the greatest group chat which ever existed.

the anarchist source code can be roughly categorized as two types of modules:

  • endpoints: parse commands and replies
  • module servers: plugins that power the brain

At the moment there are two endpoints:

  • The Slack RTM endpoint
  • The Telegram HTTP (polling) endpoint

As well as a number of modules:

  • DB Backup Scheduler
  • CatFacts (TM)
  • Dice Roller
  • Poll Server
  • Shout Server
  • Trivia Server

CatFacts

This module collects information from a number of high-quality sources to provide users with hours of entertainment.

Supported commands include:

  • !catfact :: accept no substitutes
  • !cave :: cave johnson quotes (requires flat-file DB)
  • !chuck :: chuck norris quotes
  • !ron :: ron swanson quotes
  • !trump :: trump's babbling
  • !weather :: what is this "outside" you speak of?

Democracy Engine

Authorized users can start a poll w/ the command:

!poll  <question>
!polla <option>
!polla <option>
!polla <option>

!pollr :: run the poll (print how to vote)
!polle :: stop the poll (print summary of votes)

!vote <option> :: logs this user's vote for this option

@anarchist also knows a few silly commands such as: !soup, !help, etc.

Dice Roller

Users can submit a dice spec such as: !roll NdF

The bot will take N samples of uniform randomness ranging from 1 to F and return the result to the user.

For e.g:

!roll 6d8 You rolled: [4, 7, 2, 1, 6, 3]; sum = 23

Shout Server

There is a shared "shout db" which looks for users shouting in the chatroom. The shout is submitted for considreation to THE GREAT RECORD and anarchist then replays a random shout from the record for lulz and posterity.

The shout server can be persisted & populated from a JSON file containing an array of strings. Duplicates will be ignored as this array is deserialized into a hash-set.

There is an occasional watchdog that persists the database to the path db/shouts.txt automatically. The backup daemon reloads this file on system startup unless configured to do otherwise.

Trivia Server

UNDER DEVELOPMENT

This consists of two pieces: the trivia registry, and any number of trivia room instances.

The lobby is responsible for loading quiz DBs (in the MoxQuiz format) as well as mapping bot endpoints to trivia rooms.

An endpoint can request a new lobby from the registry (or retrieve the PID of an already running trivia room.)

The endpoint can submit reponses to the trivia registry, which will be disapatched to the appropriate trivia room for consideration.

Lastly an endpoint can stop a running lobby by asking the registry nicely.

Database Format

At the moment we load databases in the MoxQuiz format.

  • Lines starting with "#" are ignored.
  • Lines starting with "Question:" start a new record
  • "Category:" marks the category
  • "Answer:" marks the answer
  • TODO: support RegExp field for less restrictive answers

anarchist's People

Contributors

drbawb avatar

Watchers

 avatar  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.