Skip to content
This repository has been archived by the owner on Jun 2, 2021. It is now read-only.

nairobilug/nairobi-bot

Repository files navigation

Nairobilug IRC bot

Nairobilug IRC bot in haskell taking advantage of discrete events (some will call it FRP) in haskell.

Build Status Hackage

Usage

  • seen @seen <nick>
  • reputation
    • Check reputation @rep <nick>
    • Add reputation +1 <nick>
    • Subtract reputation -1 <nick>
  • last fm Setting a new username for your nick replaces the older one.
    • @np set <username> to associate a last.fm username with your nick.
    • @np <last.fm username> If you don't want to set your last fm username.
    • @np If your IRC nick is your last.fm username or if you have set your last.fm username.
  • factoid @factoid <name> <message>
  • define @define <word/phrase>
  • echo @echo <sentence you want to echo>
  • ping @ping
  • gif @gif <search term>
  • wolfram alpha @wa <search query>
  • URLs Automatically fetches page titles from URLs.
  • Help @help — there are too many commands to paste the help in a channel so we give the user a URL to the wiki: https://github.com/nairobilug/nairobi-bot/wiki#usage
Maybe later if need be
  • google/duckduckgo @search <search query>
  • wikipedia @wiki <search query>

Reasons

  • Main reason is because I can ;D.
  • I want to play with the auto library and discrete events in haskell.
  • I want to write a bot without going through a bot building framework.
  • Much thanks to Justin Lee for creating the auto library.

Tests

I haven't yet written tests for it but they are coming.

Main deps

Deploying

Build and run the nairobi-bot executable like any other binary. Preferably using stack:

  • stack build to compile but not add it to path
  • stack install to add nairbibot-exe to path
  • ./.stack-work/install/x86_64-linux/lts-3.15/7.10.2/bin/nairobi-bot-exe

In production use the following answer from stackoverflow to run your executable.

  • nohup .stack-work/install/x86_64-linux/lts-3.15/7.10.2/bin/nairobi-bot-exe > /dev/null 2>&1 &
  1. nohup means: Do not terminate this process even when the stty is cut off.
  2. /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output).

  3. 2>&1 means: stderr also goes to the stdout (which is already redirected to /dev/null). You may replace &1 with a file path to keep a log of errors, e.g.: 2>/tmp/myLog
  4. & at the end means: run this command as a background task.

License

GPL-3.0 See LICENSE file for complete license.

Other/RTFM

See the Wiki