Configuration

Ryan Hitchman edited this page Apr 1, 2015 · 4 revisions

Configuration

Skybot uses a JSON configuration file to hold settings: /config

On first run this file is created with default settings:

{
  "connections":
  {
    "local irc":
    {
      "server": "localhost",
      "nick": "skybot",
      "channels": ["#test"]
    }
  }
}

Options

Connections is an associative array of connection_name : connection_settings key/value pairs.

connection_settings:

Required:

  • nick: the name of the bot.
  • server: the hostname of the irc server.
  • channels: channels to join. A list of strings. Can be []

Optional:

  • port: defaults to 6667. The port to connect to.
  • user: defaults to "skybot". (user@netmask)
  • realname: defaults to "Python bot - http://github.com/rmmh/skybot" (Shown in whois)
  • server_password: the server password. Omit if not needed.
  • nickserv_password: defaults to "" (no login is performed)
  • nickserv_name: defaults to "nickserv" (standard on most networks)
  • nickserv_command: defaults to "IDENTIFY %s" (interpolated with password)
  • ssl: defaults to false. Set to true to connect to the server using SSL
  • ignore_cert: defaults to true. Set to false to validate the certificate that the remote host uses for the SSL connection.

Examples

A single skybot instance can have multiple connections and multiple channels:

{
  "connections":
  {
    "public bot":
    {
      "server": "irc.example.org",
      "nick": "publicbot",
      "channels": ["#main"]
    },
    "private bot":
    {
      "server": "irc.example.org",
      "nick": "privatebot",
      "channels": ["#secret", "#admin"]
    }
  }
}

The user and realname can be set.

{
  "connections":
  {
    "poker irc":
    {
      "server": "irc.poker.example.com",
      "nick": "pokerbot",
      "channels": ["#poker"],
      "user": "pokerbot",
      "realname": "Pokerbot - a fork of Skybot",
    }
  }
}

Automatic identification is possible.

  • nickserv_password: defaults to "" (no login is performed)
  • nickserv_name: defaults to "nickserv" (standard on most networks)
  • nickserv_command: defaults to "IDENTIFY %s" (interpolated with password)
{
  "connections":
  {
    "poker irc":
    {
      "server": "irc.poker.example.com",
      "nick": "pokerbot",
      "nickserv_password": "aceofspades",
      "channels": ["#poker"]
    }
  }
}

Joining password-protected channels is possible.

  • "#channel password" for each password protected channel.
{
  "connections":
  {
    "poker irc":
    {
      "server": "irc.poker.example.com",
      "nick": "pokerbot",
      "channels": ["#poker", "#highstakespoker royalflush"]
    }
  }
}

API Keys

Some plugins require registration of API keys. These are placed in the top level key "api_keys":

{
  "connections": { ... },
  "api_keys": {
    "google": "XXXXXX",
    "wolframalpha": "XXXXXX",
    "lastfm": "XXXXXX",
    "wunderground": "XXXXXX",
    "rottentomatoes": "XXXXXX",
    "yahoo": "XXXXXX",
    "somethingawful": {"user": "XXXXXX", "password": "XXXXXX" },
    "twitter":
    {"consumer": "XXXXXX", 
     "consumer_secret": "XXXXXX",
     "access": "XXXXXX", 
     "access_secret": "XXXXXX"},
    "giphy": "XXXXXX"
  },
}

ACLs

Access control lists can block plugins from firing under certain circumstances. A top-level configuration key "acl" can restrict usage for different scopes-- either by plugin name ("python"), channel name ("#cobol") or network name ("irc.synirc.net"). Channels can opt in or out using allow-except/deny-except, functions can be restricted with whitelist/blacklist, and users can be blocked with blocklist-nicks. See plugins/sieve.py for the implementation.

"acls": {
  "urban": {"allow-except": ["##hatesfun"]}, 
  "urlinput": {"deny-except": ["#cobol"]},
  "irc.officialpythonbusinessonly.org": {"whitelist": ["python"]},
  "google": {"deny-except": ["#cobol"]},
  "python": {"blacklist-nicks": ["abuser"]},
  "#cobol": {"blacklist-nicks": ["botname1", "botname2"]}
}