Go to file
Arthur Poulet 899598e186 Update Version 2015-05-08 23:21:00 +02:00
plugins Update README add example 2015-05-08 23:15:30 +02:00
.gitignore Add up to gitignore 2015-05-01 17:30:33 +02:00
Gemfile Add colorize to the gemfile 2015-05-06 23:57:20 +02:00
Gemfile.lock Add colorize to the gemfile 2015-05-06 23:57:20 +02:00
README.md Update README 2015-05-08 23:18:51 +02:00
arguments.rb Add +s to --channels option 2015-05-07 22:51:34 +02:00
botpop.rb Improvment / Plugins / All * 2015-05-08 23:07:06 +02:00
builtin.rb Rename action to builtin, fix searchable 2015-05-07 21:30:44 +02:00
contributors Add contributors 2015-05-07 23:20:25 +02:00
modules_config.yml add !paste 2015-05-07 23:02:35 +02:00
version Update Version 2015-05-08 23:21:00 +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 no garanties... 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

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|
      parent.on :message, /!whatkingofanimal.*/ do |m| BotpopPlugins::exec_whatkingofanimal m end
    end
    ...code...
  end
end

Add entry to the !help command

The official plugin Base provides the command !help.

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