Go to file
Arthur Poulet f9bd99f9bd improve logger to handle concurrential access to logger file 2015-08-09 00:50:46 +02:00
plugins improve logger to handle concurrential access to logger file 2015-08-09 00:50:46 +02:00
test add architecture tests 2015-07-13 20:40:10 +02:00
.codeclimate.yml Add .codeclimate 2015-05-09 14:45:22 +02:00
.gitignore update gitignore, rename plugin epitech 2015-08-07 18:36:11 +02:00
Gemfile Fix / Plugin / Proxy 2015-05-09 17:06:09 +02:00
Gemfile.lock update Gemfile.lock 2015-08-01 01:36:11 +02:00
README.md update README.md 2015-08-03 21:42:25 +02:00
Rakefile add test binding.pry and rakefile for test 2015-07-13 20:31:22 +02:00
arguments.rb Add +s to --channels option 2015-05-07 22:51:34 +02:00
botpop.rb add global to avoid verbosity on load 2015-07-13 20:35:52 +02:00
botpop_plugin_inclusion.rb fix plugin inclusion 2015-08-07 17:20:51 +02:00
builtin.rb Improve builtins (set it out of the plugins list) 2015-07-10 18:25:39 +02:00
contributors Add contributors 2015-05-07 23:20:25 +02:00
modules_config.yml add plugin logger 2015-08-07 18:37:23 +02:00
version update version 2015-07-27 23:34:40 +02:00

README.md

botpop

Code Climate

Usage

Ruby 2 or greater is required. To be compatible with Ruby 1.9, you can try :

sed 's/prepend/include/g' -i botpop.rb

but i did never try... You better update ruby ! ;)

bundle install

to install the gems.

Arguments

By default, only the first occurence of the argument will be used, unless specified.

  • --channels, -c OPTION : list of channels (default equilibre)
  • --ip, -s OPTION : server ip (default to freenode)
  • --port, -p OPTION : port (default 7000 or 6667 if no ssl)
  • --no-ssl : disable ssl (enabled by default)
  • --nick, -n OPTION : change the nickname
  • --user, -u OPTION : change the username
  • --config OPTION : change the plugin configuration file (default to modules_config.yml)
  • --plugin-directory OPTION : change the directory where the plugins are installed (default plugins/)
  • --plugin-disable OPTION : disable a plugin (can be specified many times)
  • --debug, -d OPTION : enable the debug mod. It et a global $debug_OPTION to true. (can be specified many times)

Debugging easier

You can specify the --debug OPT option at program start. It will define as many $debug_OPT globals to enable debug on the plugins.

As example:

  # If debug enabled for this options and error occured
if $debug_plugin and variable == :failed
  binding.pry # user hand here
  # Obsiously, it is usefull to trylock a mutex before because the bot use
  # Threads and can call many times this binding.pry
end

Plugins

Some official plugins are developped. You can propose your own creation by pull request, or add snippets link to the wiki.

List

  • Base : this is a basic plugin, providing version, code, help, and troll
  • Network : an usefull plugin with commands ping, ping ip, ping http, traceroute, dos attack and poke
  • Searchable : a little plugin providing irc research with engines like google, wikipedia, ruby-doc, etc...
  • Coupon : the original aim of the bot. It get coupons for the challenge pathwar
  • Intranet : an useless plugin to check the intranet of epitech
  • Proxy : an audacious plugin to create user access to a local proxy

Create your own

You can easy create your own plugins.

The bot is based on Cinch framework. You should take the time to read the documentation before developping anything.

Example of new plugin

A full example of plugin code is provided in the commented file : Example of Fury Plugin

First, put your ruby code file in plugins/, and put your code in the scope :

module BotpopPlugins
  module MyFuryPlugin
    def self.exec_whatkingofanimal m
      m.reply "Die you son of a" + ["lion", "pig", "red panda"].shuffle.first + " !!"
    end
    ...code...
  end
end

Matching messages

To create a matching to respond to a message, you have to specifie in your plugin :

module BotpopPlugins
  module MyFuryPlugin
    MATCH = lambda do |parent, plugin|
      parent.on :message, /!whatkingofanimal.*/ do |m| plugin.exec_whatkingofanimal m end
    end
    ...code...
  end
end

Add entry to the !help command

The official plugin Base provides the command !help and !help plugin.

It list the avaliable commands of the plugins. You can add your help to your plugin by providing a HELP constant. The strings should be as short as possible. You should write it like the following:

module BotpopPlugins
  module MyFuryPlugin
    HELP = ["!whatkingofanimal", "!animallist", "!checkanimal [type]"]
    ...code...
  end
end

Enable and disable plugin

You can enable or disable plugin by using the constant ENABLED. It should be linked with the Botpop::CONFIG. The constant must be defined by the developper of the plugin. For example, you can implement it like :

module BotpopPlugins
  module MyFuryPlugin
    CONFIG = Botpop::CONFIG['myfurry'] || raise(MissingConfigurationZone, 'myfurry')
    ENABLED = CONFIG['enable'].nil? ? true : CONFIG['enable']
  end
end

Then, a simple line in the modules_configuration.yml file should be enough.