node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org ยป

mrnodebot

Mr. NodeBot

An IronY / FSociety Production

Dependencies devDependencies Status

Special Considerations

The bot currently depends on NickServ services supporting the ACC command for certain command authentication types. Networks confirmed to work include

  • freenode
  • DALnet

Dependencies

  • A Database engine, either MySql, MariaDB, Postgres, Sqlite3
  • libicu (character encoding detection) More Instructions
    • Debian (Ubuntu) apt-get install libicu-dev
    • Gentoo emerge icu
    • Fedora/CentOS yum install libicu-devel
    • macOS
      • Homebrew brew install icu4c; brew link icu4c --force
      • MacPorts port install icu +devel

Install Steps

  • Install Node Modules npm install
  • Create a configuration file from a template cp config.js.sample config.js
  • Edit the configuration file
  • Configure a database
    • By default, the bot will use SQLite 3, npm install sqlite3
    • If using MySQL, npm install mysql
      • Create a Schema and be sure to give it a utf8mb4_unicode_ci character set (CREATE DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci)
      • Modify the config.js accordingly
      • Once properly configured and run for the first time, the Bot will provision the database schema using migrations
  • Start the bot node index.js [--config config.js-path] or npm start

Keep the Bot Running

Included in the root directory is a sample systemd script (mrnodebot.service), you can do it this way or use forever or any other node task runner. If you want to be able to use commands like update, restart, and halt while having the Bot come back it is important you take this into consideration.

Features

  • Logging / Analytics
  • SED Corrections
  • URL Announce
  • Popularity (upvote/downvote) system
  • Mention system
  • A Seen/Last-seen command to track usage
  • API Endpoints connected to Analytics
  • Express/Pug Web Front end

Unit Testing

Unit testing is being introduced and has a long way to go to catch up. To run available tests npm test

Documentation

I am currently in the processes of providing jsdoc style docblocks for documentation generation. You can generate the documentation by running npm run generate-docs

Technologies

API Keys

  • Google API Key - For most features a Google API key with Shortener service, SafeSearch service, and YouTube search service enabled is required, however, if one is not provided, the bot will try to gracefully fall back onto is.gd
  • Imgur API Key - A Imgur API key is required to extract meta data on Imgur links in the URL announcer
  • Twitter API Key A Twitter API key is required to be able to send tweets, subscribe to tweets, or have a tweet sent out during the announce process

Command Access Levels

  • owner - The Command can only be run by the bot owner (hard coded username/host combo in config.js)
  • admin - The Command can be run by the owner or anyone in the admin list
  • identified - The Command can be run by anyone using a nick identified with services
  • guest - The Command can be run by anyone
  • channelOp - The Command can be run by the owner, or anyone with ops in the channel it is being originated from
  • channelOpIdentified - the Command can be run by the owner, the admins, or anyone with ops in the channel who are also identified
  • channelVoice - the Command can be run by the owner, the the ops, and the voices in the channel it is originated from
  • channelVoiceIdentified - the Command can be run by identified voices, ops in the channel originated from, or owner and admins

Knex Migrations

This project is powered by knexjs and takes advantage of its migration system. In order to use migrations npm install -g knex and use the knex command, e.g. knex migrate:make add_users_table. More instructions can be found here. The bot will check for and install new migrations on startup.

Have questions? Looking to chat? Join us on #fsociety on irc.freenode.net

Pull Requests Welcome