New plugin.header file provided, to be used as model for the header of new plugins. Many existing plugins have been adjusted to provide the same info the same way. I might have misplaced some information, so please let me know if this is the case.
Also augmented a couple of copyright notices to include the 'rbot development team' alongside Tom Gilbert.
o Tom Gilbert (giblet) <tom@linuxbrit.co.uk>
Bugbear (heavy-duty framework reworker and backwards-compatibility-breaker)
-o Giuseppe Bilotta (tango_) <giuseppe.bilotta@gmail.com>
+o Giuseppe "Oblomov" Bilotta (tango_) <giuseppe.bilotta@gmail.com>
Patch contributors
o Peter Suschlik (pesu) <peter@zilium.de>
+2007-02-18 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+
+ * Plugin: Provide a plugin.header file with boilerplate plugin
+ title/author/copyright/license information. Authors of new plugins are
+ encouraged to use it. Many existing plugins have been changed to
+ follow the same spec.
+
2007-02-15 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
* Plugin: new unreplied() method to handle PRIVMSGs which have not
-# vim: set et sw=2:\r
-# A-Z Game: guess the word by reducing the interval of allowed ones\r
+#-- vim:sw=2:et\r
+#++\r
+#\r
+# :title: A-Z Game Plugin for rbot\r
+#\r
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>\r
+# Author:: Yaohan Chen <yaohan.chen@gmail.com>: Japanese support\r
#\r
-# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>\r
-# Author: Yaohan Chen <yaohan.chen@gmail.com>: Japanese support\r
+# Copyright:: (C) 2006 Giuseppe Bilotta\r
+# Copyright:: (C) 2007 GIuseppe Bilotta, Yaohan Chen\r
#\r
-# (C) 2006 Giuseppe Bilotta\r
-# (C) 2007 Yaohan Chen\r
+# License:: GPL v2\r
+#\r
+# A-Z Game: guess the word by reducing the interval of allowed ones\r
#\r
# TODO allow manual addition of words\r
\r
-# BansPlugin v3 for 0.9.11\r
+#-- vim:sw=2:et\r
+#++\r
#\r
-# Managing kick and bans, automatically removing bans after timeouts, quiet bans, and kickban/quietban based on regexp\r
+# :title: Bans Plugin v3 for rbot 0.9.11 and later\r
#\r
-# (c) 2006 Marco Gulino <marco@kmobiletools.org>\r
-# (c) 2007 kamu <mr.kamu@gmail.com>\r
-# (c) 2007 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\r
+# Author:: Marco Gulino <marco@kmobiletools.org>\r
+# Author:: kamu <mr.kamu@gmail.com>\r
+# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\r
+#\r
+# Copyright:: (C) 2006 Marco Gulino\r
+# Copyright:: (C) 2007 kamu, Giuseppe Bilotta\r
+#\r
+# License:: GPL V2.\r
+#\r
+# Managing kick and bans, automatically removing bans after timeouts, quiet\r
+# bans, and kickban/quietban based on regexp\r
#\r
# v1 -> v2 (kamu's version, never released)\r
# * reworked\r
#\r
# v2 -> v3 (GB)\r
# * remove the 'bans' prefix from most of the commands\r
-# * (un)quiet has been renamed to (un)silence because 'quiet' was used to tell the bot to keep quiet\r
+# * (un)quiet has been renamed to (un)silence because 'quiet' was used to\r
+# tell the bot to keep quiet\r
# * both (un)quiet and (un)silence are accepted as actions\r
# * use the more descriptive 'onjoin' term for autoactions\r
-# * convert v1's (0.9.10) :bans and :bansmasks to BadWordActions and WhitelistEntries\r
+# * convert v1's (0.9.10) :bans and :bansmasks to BadWordActions and\r
+# WhitelistEntries\r
# * enhanced list manipulation facilities\r
# * fixed regexp usage in requirements for plugin map\r
# * add proper auth management\r
-#\r
-# Licensed under GPL V2.\r
\r
OnJoinAction = Struct.new("OnJoinAction", :host, :action, :channel, :reason)\r
BadWordAction = Struct.new("BadWordAction", :regexp, :action, :channel, :timer, :reason)\r
-# Debugging/profiling for rbot
+#-- vim:sw=2:et
+#++
#
-# (c) 2006 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
-# Licensed under GPL V2.
+# :title: Debugging/profiling for rbot
+#
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta
+# License:: GPL v2
class DebugPlugin < Plugin
BotConfig.register BotConfigIntegerValue.new('debug.interval',
-# vim: set sw=2 et:\r
+#-- vim:sw=2:et\r
+#++\r
#\r
-# dict plugin: provides a link to the definition of a word in one of the supported\r
+# :title: Dictionary lookup plugin for rbot\r
+#\r
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>\r
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta\r
+# License:: GPL v2\r
+#\r
+# Provides a link to the definition of a word in one of the supported\r
# dictionaries. Currently available are\r
# * the Oxford dictionary for (British) English\r
# * the De Mauro/Paravia dictionary for Italian\r
# * the Chambers dictionary for English (accepts both US and UK)\r
#\r
-# other plugins can use this one to check if a given word is valid in italian\r
+# Other plugins can use this one to check if a given word is valid in italian\r
# or english by using the is_italian?/is_british?/is_english? methods\r
#\r
-# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>\r
-#\r
# TODO: cache results and reuse them if get_cached returns a cache copy\r
\r
require 'uri'\r
-# Hacked up slashdot headlines plugin...
+# Hacked up digg headlines plugin...
require 'time'
require 'rexml/document'
+#-- vim:sw=2:et
+#++
#
-# Forecast plugin for rbot
-# by MrChucho (mrchucho@mrchucho.net)
-# Copyright (C) 2006 Ralph M. Churchill
+# :title: Forecast plugin for rbot
#
+# Author:: MrChucho (mrchucho@mrchucho.net)
+# Copyright:: (C) 2006 Ralph M. Churchill
+
require 'soap/wsdlDriver'
require 'open-uri'
require 'rexml/document'
-# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/)
-# (c) 2005 Mark Kretschmann <markey@web.de>
-# Licensed under GPL V2.
-
-require "net/http"
-
+#-- vim:sw=2:et
+#++
+#
+# :title: Grouphug Plugin for rbot
+#
+# Author:: Mark Kretschmann <markey@web.de>
+# Copyright:: (C) 2005 Mark Kretschmann
+# License:: GPL v2
class GrouphugPlugin < Plugin
def help( plugin, topic="" )
path = "random"
path = "confessions/#{params[:num]}" if params[:num]
begin
- data = bot.httputil.get_cached(URI.parse("http://grouphug.us/#{path}"))
+ data = @bot.httputil.get_cached(URI.parse("http://grouphug.us/#{path}"))
reg = Regexp.new( '(<td class="conf-text")(.*?)(<p>)(.*?)(</p>)', Regexp::MULTILINE )
confession = reg.match( data )[4].ircify_html
-# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/)\r
+#-- vim:sw=2:et\r
+#++\r
+#\r
+# :title: Half-Life 2 plugin for rbot\r
+#\r
+# Author:: Ole Christian Rynning <oc@rynning.no>\r
+# Copyright:: (C) 2006 Ole Christian Rynning\r
+# License:: GPL v2\r
#\r
# Simple Half-Life 2 (Source Engine) plugin to query online\r
# servers to see if its online and kicking and how many users.\r
#\r
# Added 2 seconds timeout to the response. And sockets are now\r
# closing properly.\r
-#\r
-# (c) 2006 Ole Christian Rynning <oc@rynning.no>\r
-# Licensed under GPL V2.\r
\r
require 'socket'\r
require 'timeout'\r
+\r
class HL2Plugin < Plugin\r
\r
A2S_INFO = "\xFF\xFF\xFF\xFF\x54\x53\x6F\x75\x72\x63\x65\x20\x45\x6E\x67\x69\x6E\x65\x20\x51\x75\x65\x72\x79\x00"\r
end\r
\r
end\r
+\r
plugin = HL2Plugin.new\r
plugin.map 'hl2 :conn_str'\r
\r
-# IMDB plugin for RubyBot
-# (c) 2005 Arnaud Cornet <arnaud.cornet@gmail.com>
-# Licensed under MIT License.
+#-- vim:sw=2:et
+#++
+#
+# :title: IMDB plugin for rbot
+#
+# Author:: Arnaud Cornet <arnaud.cornet@gmail.com>
+# Copyright:: (C) 2005 Arnaud Cornet
+# License:: MIT license
require 'net/http'
require 'cgi'
-#################################################################\r
-# IP Lookup Plugin\r
-# ----------------------------\r
-# by Chris Gahan (chris@ill-logic.com)\r
-#\r
-# Purpose:\r
-# ------------------\r
-# Lets you lookup the owner and their address for any IP address\r
-# or IRC user.\r
-#\r
-#################################################################\r
-\r
-require 'socket'\r
-require 'resolv'\r
-\r
-#################################################################\r
-## ARIN Whois module...\r
-##\r
-\r
-module ArinWhois\r
-\r
- class Chunk < Hash\r
- def customer?\r
- keys.grep(/^(City|Address|StateProv|(Org|Cust)Name)$/).any?\r
- end\r
- \r
- def network?\r
- keys.grep(/^(CIDR|NetHandle|Parent)$/).any?\r
- end\r
-\r
- def contact?\r
- keys.grep(/^(R|Org)(Tech|Abuse)(Handle|Name|Phone|Email)$/).any?\r
- end\r
- \r
- def valid?\r
- customer? or network? or contact?\r
- end\r
- \r
- def owner\r
- self[keys.grep(/^(Org|Cust)Name$/).first]\r
- end\r
- \r
- def location\r
- [ self['City'], self['StateProv'], self['Country'] ].compact.join(', ')\r
- end\r
- \r
- def address\r
- [ self['Address'], location, self['PostalCode'] ].compact.join(', ')\r
- end\r
- \r
- end\r
-\r
- class ArinWhoisParser\r
- \r
- def initialize(data)\r
- @data = data\r
- end\r
- \r
- def split_array_at(a, &block)\r
- return a unless a.any?\r
- a = a.to_a\r
- \r
- results = []\r
- last_cutpoint = 0\r
- \r
- a.each_with_index do |el,i|\r
- if block.call(el)\r
- unless i == 0\r
- results << a[last_cutpoint...i]\r
- last_cutpoint = i\r
- end\r
- end\r
- end\r
- \r
- if last_cutpoint < a.size or last_cutpoint == 0\r
- results << a[last_cutpoint..-1]\r
- end\r
- \r
- results\r
- end\r
- \r
- # Whois output format\r
- # ------------------------\r
- # Owner info block:\r
- # {Org,Cust}Name\r
- # Address\r
- # City\r
- # StateProv\r
- # PostalCode\r
- # Country (2-digit)\r
- #\r
- # Network Information:\r
- # CIDR (69.195.25.0/25)\r
- # NetHandle (NET-72-14-192-0-1)\r
- # Parent (NET-72-0-0-0-0)\r
- #\r
- # Contacts:\r
- # ({R,Org}{Tech,Abuse}{Handle,Name,Phone,Email})*\r
- \r
- def parse_chunks\r
- return if @data =~ /^No match found /\r
- chunks = @data.gsub(/^# ARIN WHOIS database, last updated.+/m, '').scan(/(([^\n]+\n)+\n)/m)\r
- chunks.map do |chunk|\r
- result = Chunk.new\r
- \r
- chunk[0].scan(/([A-Za-z]+?):(.*)/).each do |tuple|\r
- tuple[1].strip!\r
- result[tuple[0]] = tuple[1].empty? ? nil : tuple[1]\r
- end\r
- \r
- result\r
- end\r
- end\r
- \r
- \r
- def get_parsed_data\r
- return unless chunks = parse_chunks\r
- \r
- results = split_array_at(parse_chunks) {|chunk|chunk.customer?}\r
- results.map do |chunks|\r
- {\r
- :customer => chunks.select{|x|x.customer?}[0],\r
- :net => chunks.select{|x|x.network?}[0],\r
- :contacts => chunks.select{|x|x.contact?}\r
- }\r
- end\r
- end\r
- \r
- # Return a hash with :customer, :net, and :contacts info filled in.\r
- def get_most_specific_owner\r
- return unless datas = get_parsed_data\r
- \r
- datas_with_bitmasks = datas.map do |data| \r
- bitmask = data[:net]['CIDR'].split('/')[1].to_i\r
- [bitmask, data]\r
- end\r
- #datas_with_bitmasks.sort.each{|x|puts x[0]}\r
- winner = datas_with_bitmasks.sort[-1][1]\r
- end\r
-\r
- end # of class ArinWhoisParser\r
-\r
-module_function\r
-\r
- def raw_whois(query_string, host)\r
- s = TCPsocket.open(host, 43)\r
- s.write(query_string+"\n")\r
- ret = s.read\r
- s.close\r
- return ret\r
- end\r
-\r
- def lookup(ip)\r
- data = raw_whois("+#{ip}", 'whois.arin.net')\r
- arin = ArinWhoisParser.new data\r
- arin.get_most_specific_owner\r
- end\r
- \r
- def lookup_location(ip)\r
- result = lookup(ip)\r
- result[:customer].location\r
- end\r
- \r
- def lookup_address(ip)\r
- result = lookup(ip)\r
- result[:customer].address\r
- end\r
-\r
- def lookup_info(ip)\r
- if result = lookup(ip)\r
- "#{result[:net]['CIDR']} => #{result[:customer].owner} (#{result[:customer].address})"\r
- else\r
- "Address not found."\r
- end\r
- end\r
-\r
-end\r
-\r
-\r
-\r
-#################################################################\r
-## The Plugin\r
-##\r
-\r
-class IPLookupPlugin < Plugin\r
+#################################################################
+# IP Lookup Plugin
+# ----------------------------
+# by Chris Gahan (chris@ill-logic.com)
+#
+# Purpose:
+# ------------------
+# Lets you lookup the owner and their address for any IP address
+# or IRC user.
+#
+#################################################################
+
+require 'socket'
+require 'resolv'
+
+#################################################################
+## ARIN Whois module...
+##
+
+module ArinWhois
+
+ class Chunk < Hash
+ def customer?
+ keys.grep(/^(City|Address|StateProv|(Org|Cust)Name)$/).any?
+ end
+
+ def network?
+ keys.grep(/^(CIDR|NetHandle|Parent)$/).any?
+ end
+
+ def contact?
+ keys.grep(/^(R|Org)(Tech|Abuse)(Handle|Name|Phone|Email)$/).any?
+ end
+
+ def valid?
+ customer? or network? or contact?
+ end
+
+ def owner
+ self[keys.grep(/^(Org|Cust)Name$/).first]
+ end
+
+ def location
+ [ self['City'], self['StateProv'], self['Country'] ].compact.join(', ')
+ end
+
+ def address
+ [ self['Address'], location, self['PostalCode'] ].compact.join(', ')
+ end
+
+ end
+
+ class ArinWhoisParser
+
+ def initialize(data)
+ @data = data
+ end
+
+ def split_array_at(a, &block)
+ return a unless a.any?
+ a = a.to_a
+
+ results = []
+ last_cutpoint = 0
+
+ a.each_with_index do |el,i|
+ if block.call(el)
+ unless i == 0
+ results << a[last_cutpoint...i]
+ last_cutpoint = i
+ end
+ end
+ end
+
+ if last_cutpoint < a.size or last_cutpoint == 0
+ results << a[last_cutpoint..-1]
+ end
+
+ results
+ end
+
+ # Whois output format
+ # ------------------------
+ # Owner info block:
+ # {Org,Cust}Name
+ # Address
+ # City
+ # StateProv
+ # PostalCode
+ # Country (2-digit)
+ #
+ # Network Information:
+ # CIDR (69.195.25.0/25)
+ # NetHandle (NET-72-14-192-0-1)
+ # Parent (NET-72-0-0-0-0)
+ #
+ # Contacts:
+ # ({R,Org}{Tech,Abuse}{Handle,Name,Phone,Email})*
+
+ def parse_chunks
+ return if @data =~ /^No match found /
+ chunks = @data.gsub(/^# ARIN WHOIS database, last updated.+/m, '').scan(/(([^\n]+\n)+\n)/m)
+ chunks.map do |chunk|
+ result = Chunk.new
+
+ chunk[0].scan(/([A-Za-z]+?):(.*)/).each do |tuple|
+ tuple[1].strip!
+ result[tuple[0]] = tuple[1].empty? ? nil : tuple[1]
+ end
+
+ result
+ end
+ end
+
+
+ def get_parsed_data
+ return unless chunks = parse_chunks
+
+ results = split_array_at(parse_chunks) {|chunk|chunk.customer?}
+ results.map do |chunks|
+ {
+ :customer => chunks.select{|x|x.customer?}[0],
+ :net => chunks.select{|x|x.network?}[0],
+ :contacts => chunks.select{|x|x.contact?}
+ }
+ end
+ end
+
+ # Return a hash with :customer, :net, and :contacts info filled in.
+ def get_most_specific_owner
+ return unless datas = get_parsed_data
+
+ datas_with_bitmasks = datas.map do |data|
+ bitmask = data[:net]['CIDR'].split('/')[1].to_i
+ [bitmask, data]
+ end
+ #datas_with_bitmasks.sort.each{|x|puts x[0]}
+ winner = datas_with_bitmasks.sort[-1][1]
+ end
+
+ end # of class ArinWhoisParser
+
+module_function
+
+ def raw_whois(query_string, host)
+ s = TCPsocket.open(host, 43)
+ s.write(query_string+"\n")
+ ret = s.read
+ s.close
+ return ret
+ end
+
+ def lookup(ip)
+ data = raw_whois("+#{ip}", 'whois.arin.net')
+ arin = ArinWhoisParser.new data
+ arin.get_most_specific_owner
+ end
+
+ def lookup_location(ip)
+ result = lookup(ip)
+ result[:customer].location
+ end
+
+ def lookup_address(ip)
+ result = lookup(ip)
+ result[:customer].address
+ end
+
+ def lookup_info(ip)
+ if result = lookup(ip)
+ "#{result[:net]['CIDR']} => #{result[:customer].owner} (#{result[:customer].address})"
+ else
+ "Address not found."
+ end
+ end
+
+end
+
+
+
+#################################################################
+## The Plugin
+##
+
+class IPLookupPlugin < Plugin
def help(plugin, topic="")
"iplookup [ip address / domain name] => lookup info about the owner of the IP address from the ARIN whois database"
- end\r
- \r
- def iplookup(m, params)\r
- reply = ""\r
- if params[:domain]\r
- begin\r
- ip = Resolv.getaddress(params[:domain])\r
- reply += "#{params[:domain]} | "\r
- rescue => e\r
- m.reply "#{e.message}"\r
- return\r
- end\r
- else\r
- ip = params[:ip]\r
- end\r
- \r
- reply += ArinWhois.lookup_info(ip)\r
- m.reply reply\r
- end\r
-\r
- def userip(m, params)\r
- #users = @channels[m.channel].users\r
- #m.reply "users = #{users.inspect}"\r
- #m.reply @bot.sendq("WHO #{params[:user]}")\r
- end\r
- \r
-end\r
-\r
+ end
+
+ def iplookup(m, params)
+ reply = ""
+ if params[:domain]
+ begin
+ ip = Resolv.getaddress(params[:domain])
+ reply += "#{params[:domain]} | "
+ rescue => e
+ m.reply "#{e.message}"
+ return
+ end
+ else
+ ip = params[:ip]
+ end
+
+ reply += ArinWhois.lookup_info(ip)
+ m.reply reply
+ end
+
+ def userip(m, params)
+ #users = @channels[m.channel].users
+ #m.reply "users = #{users.inspect}"
+ #m.reply @bot.sendq("WHO #{params[:user]}")
+ end
+
+end
+
plugin = IPLookupPlugin.new
-plugin.map 'iplookup :ip', :action => 'iplookup', :requirements => {:ip => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/}\r
-plugin.map 'iplookup :domain', :action => 'iplookup', :requirements => {:domain => /^[a-z0-9\.\-]{4,255}$/i}\r
+plugin.map 'iplookup :ip', :action => 'iplookup', :requirements => {:ip => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/}
+plugin.map 'iplookup :domain', :action => 'iplookup', :requirements => {:domain => /^[a-z0-9\.\-]{4,255}$/i}
plugin.map 'userip :user', :action => 'userip', :requirements => {:user => /\w+/}
-\r
-\r
-if __FILE__ == $0\r
- include ArinWhois\r
- data = open('whoistest.txt').read\r
- c = ArinWhoisParser.new data\r
- puts c.get_parsed_data.inspect\r
-end
\ No newline at end of file
+
+
+if __FILE__ == $0
+ include ArinWhois
+ data = open('whoistest.txt').read
+ c = ArinWhoisParser.new data
+ puts c.get_parsed_data.inspect
+end
end
end
end
+
plugin = KarmaPlugin.new
plugin.map 'karmastats', :action => 'stats'
plugin.map 'karma :key', :defaults => {:key => false}
-# Original Author:
-# Michael Brailsford <brailsmt@yahoo.com>
-# aka brailsmt
-# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
-# Purpose: Provide for humorous larts and praises
-# Original Copyright:
-# 2002 Michael Brailsford. All rights reserved.
-# Copyright: 2006 Giuseppe Bilotta. All rights reserved.
-# License: This plugin is licensed under the BSD license. The terms of
-# which follow.
+#-- vim:sw=2:et
+#++
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+# :title: lart/praise plugin for rbot
#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
+# Author:: Michael Brailsford <brailsmt@yahoo.com> aka brailsmt
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
+# Copyright:: (C) 2002 Michael Brailsford. All rights reserved.
+# Copyright:: (C) 2006 Giuseppe Bilotta. All rights reserved.
+#
+# License:: This plugin is licensed under the BSD license. The terms of
+# which follow.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# Purpose:: Provide for humorous larts and praises
class LartPlugin < Plugin
#-- vim:sw=2:et
#++
#
-# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
-# Copyright (C) 2006 Giuseppe Bilotta
+# :title: linkbot management for rbot
+#
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+# Copyright:: (C) 2006 Giuseppe Bilotta
+# License:: GPL v2
#
# Based on an idea by hagabaka (Yaohan Chen <yaohan.chen@gmail.com>)
#
#
# This plugin also shows how to create 'fake' messages from a plugin, letting
# the bot parse them.
+#
# TODO a possible enhancement to the Irc framework could be to create 'fake'
# servers to make this even easier.
+
class LinkBot < Plugin
BotConfig.register BotConfigArrayValue.new('linkbot.nicks',
:default => [],
random_markov(m, message)
end
end
+
plugin = MarkovPlugin.new
plugin.map 'markov ignore :action :option', :action => "ignore"
plugin.map 'markov ignore :action', :action => "ignore"
+#-- vim:sw=2:et
+#++
+#
+# :title: Nickserv management plugin for rbot
+#
+# Author:: Tom Gilbert (giblet) <tom@linuxbrit.co.uk>
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+#
+# Copyright:: (C) 2002-2005 Tom Gilbert
+# Copyright:: (C) 2006 Tom Gilbert, Giuseppe Bilotta
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta
+#
# Automatically lookup nicks in @registry and identify when asked
+#
# Takes over proper nick if required and nick is registered
-# TODO allow custom IDENTIFY and GHOST names
+
+# TODO:: allow custom IDENTIFY and GHOST names
class NickServPlugin < Plugin
--- /dev/null
+#-- vim:sw=2:et
+#++
+#
+# :title: Plugin title
+#
+# Author:: Your Name Goes Here <and.your@email>
+# Copyright:: (C) YYYY Your Name
+# License:: plugin licence
+#
+# More documentation, if needed/wanted
+
#-- vim:sw=2:et
#++
#
-# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/)
-#
-# A trivia quiz game. Fast paced, featureful and fun.
+# :title: Quiz plugin for rbot
#
# Author:: Mark Kretschmann <markey@web.de>
# Author:: Jocke Andersson <ajocke@gmail.com>
# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
# Author:: Yaohan Chen <yaohan.chen@gmail.com>
#
-# (c) 2006 Mark Kretschmann, Jocke Andersson, Giuseppe Bilotta
-# (c) 2007 Giuseppe Bilotta, Yaohan Chen
+# Copyright:: (C) 2006 Mark Kretschmann, Jocke Andersson, Giuseppe Bilotta
+# Copyright:: (C) 2007 Giuseppe Bilotta, Yaohan Chen
#
-# Licensed under GPL V2.
+# License:: GPL v2
+#
+# A trivia quiz game. Fast paced, featureful and fun.
-# FIXME interesting fact: in the Quiz class, @registry.has_key? seems to be
-# case insensitive. Although this is all right for us, this leads to rank vs
-# registry mismatches. So we have to make the @rank_table comparisons case
-# insensitive as well. For the moment, redefine everything to downcase before
-# matching the nick.
+# FIXME:: interesting fact: in the Quiz class, @registry.has_key? seems to be
+# case insensitive. Although this is all right for us, this leads to
+# rank vs registry mismatches. So we have to make the @rank_table
+# comparisons case insensitive as well. For the moment, redefine
+# everything to downcase before matching the nick.
#
-# TODO define a class for the rank table. We might also need it for scoring in
-# other games.
+# TODO:: define a class for the rank table. We might also need it for scoring
+# in other games.
#
-# TODO when Ruby 2.0 gets out, fix the FIXME 2.0 UTF-8 workarounds
+# TODO:: when Ruby 2.0 gets out, fix the FIXME 2.0 UTF-8 workarounds
# Class for storing question/answer pairs
QuizBundle = Struct.new( "QuizBundle", :question, :answer )
#-- vim:sw=2:et
#++
+#
+# :title: Roshambo (rock-paper-scissors) plugin for rbot
+#
+# Author:: Hans Fugal
+# Copyright:: (C) 2004 Hans Fugal
+#
# Play the game of roshambo (rock-paper-scissors)
-# Copyright (C) 2004 Hans Fugal
+#
# Distributed under the same license as rbot itself
require 'time'
#-- vim:sw=2:et\r
#++\r
#\r
-# RSS feed plugin for RubyBot\r
-# (c) 2004 Stanislav Karchebny <berkus@madfire.net>\r
-# (c) 2005 Ian Monroe <ian@monroe.nu>\r
-# (c) 2005 Mark Kretschmann <markey@web.de>\r
-# (c) 2006 Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\r
+# :title: RSS feed plugin for rbot\r
#\r
-# Licensed under MIT License.\r
+# Author:: Stanislav Karchebny <berkus@madfire.net>\r
+# Author:: Ian Monroe <ian@monroe.nu>\r
+# Author:: Mark Kretschmann <markey@web.de>\r
+# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\r
+#\r
+# Copyright:: (C) 2004 Stanislav Karchebny\r
+# Copyright:: (C) 2005 Ian Monroe, Mark Kretschmann\r
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta\r
+#\r
+# License:: MIT license\r
\r
require 'rss/parser'\r
require 'rss/1.0'\r
-# vim: set sw=2 et:\r
+#-- vim:sw=2:et\r
+#++\r
+#\r
+# :title: Salutations plugin for rbot\r
+#\r
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>\r
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta\r
+# License:: GPL v2\r
+#\r
# Salutations plugin: respond to salutations\r
-# TODO allow online editing of salutations\r
-# TODO *REMEMBER* to set @changed to true after edit\r
-# TODO or changes won't be saved\r
+#\r
+# TODO:: allow online editing of salutations\r
+#\r
+# TODO:: *REMEMBER* to set @changed to true after edit or changes won't be saved\r
\r
class SalutPlugin < Plugin\r
BotConfig.register BotConfigBooleanValue.new('salut.all_languages',\r
-# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/)
+#-- vim:sw=2:et
+#++
#
-# Create mini plugins on IRC.
+# :title: Script plugin for rbot
+#
+# Author:: Mark Kretschmann <markey@web.de>
+# Copyright:: (C) 2006 Mark Kretschmann
+# License:: GPL v2
#
-# Scripts are little Ruby programs that run in the context of the script plugin. You
-# can create them directly in an IRC channel, and invoke them just like normal rbot plugins.
+# Create mini plugins on IRC.
#
-# (c) 2006 Mark Kretschmann <markey@web.de>
-# Licensed under GPL V2.
+# Scripts are little Ruby programs that run in the context of the script
+# plugin. You can create them directly in an IRC channel, and invoke them just
+# like normal rbot plugins.
Command = Struct.new( "Command", :code, :nick, :created, :channel )
-# vim: set sw=2 et:
+#-- vim:sw=2:et
+#++
#
-# TODO: use lr=lang_<code> or whatever is most appropriate to let google know
-# it shouldn't use the bot's location to find the preferred language
+# :title: Google and Wikipedia search plugin for rbot
+#
+# Author:: Tom Gilbert (giblet) <tom@linuxbrit.co.uk>
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+#
+# Copyright:: (C) 2002-2005 Tom Gilbert
+# Copyright:: (C) 2006 Tom Gilbert, Giuseppe Bilotta
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta
+
+# TODO:: use lr=lang_<code> or whatever is most appropriate to let google know
+# it shouldn't use the bot's location to find the preferred language
+
require 'uri'
Net::HTTP.version_1_2
#-- vim:sw=2:et
#++
#
+# :title: ShortURL plugin for rbot
+#
+# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+# Copyright:: (C) 2007 Giuseppe Bilotta
+# License:: GPL v2
+#
# Plugin to handle ShortURL, merges the funcionality of the old rubyurl and tinyurl plugins
# Note that it's called ShortenURLs and not ShortURL, to prevent conflicts with
# the actual ruby package used
-#
-# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
-# (C) 2007 Giuseppe Bilotta
-# Based on existing rbot plugins, as mentioned above :)
require "shorturl"
require "uri"
-# Time Zone Plugin for rbot
-# (c) 2006 Ian Monroe <ian@monroe.nu>
-# Licensed under MIT License.
+#-- vim:sw=2:et
+#++
+#
+# :title: Time Zone Plugin for rbot
+#
+# Author:: Ian Monroe <ian@monroe.nu>
+# Copyright:: (C) 2006 Ian Monroe
+# License:: MIT license
require 'tzinfo'
-# Author: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+#-- vim:sw=2:et
+#++
+#
+# :title: Topic manipulation plugin for rbot
+#
+# Author:: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta
+# License:: GPL v2
+#
# Add a bunch of topic manipulation features
class TopicPlugin < Plugin
-# Weather plugin for rbot
+#-- vim:sw=2:et
+#++
#
-# NOAA National Weather Service support by MrChucho (mrchucho@mrchucho.net)
-# Copyright (C) 2006 Ralph M. Churchill
+# :title: Weather plugin for rbot
#
-# Weather Undeground support by Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
-# Copyright (C) 2006 Giuseppe Bilotta
+# Author:: MrChucho (mrchucho@mrchucho.net): NOAA National Weather Service support
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+#
+# Copyright:: (C) 2006 Ralph M. Churchill
+# Copyright:: (C) 2006-2007 Giuseppe Bilotta
+#
+# License:: GPL v2
require 'uri'
require 'rexml/document'
+#-- vim:sw=2:et
+#++
#
-# World of Warcraft Realm Status plugin for rbot
-# by MrChucho (mrchucho@mrchucho.net)
-# Copyright (C) 2006 Ralph M. Churchill
+# :title: World of Warcraft Realm Status plugin for rbot
#
-# Requires: insatiable appetite for World of Warcraft
+# Author:: MrChucho (mrchucho@mrchucho.net)
+# Copyright:: (C) 2006 Ralph M. Churchill
#
+# Requires:: insatiable appetite for World of Warcraft
+
require 'open-uri'
require 'rexml/document'
#-- vim:sw=2:et\r
#++\r
-\r
+#\r
+# :title: rbot auth management from IRC\r
+#\r
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>\r
+# Copyright:: (C) 2006,2007 Giuseppe Bilotta\r
+# License:: GPL v2\r
\r
class AuthModule < CoreBotModule\r
\r
#-- vim:sw=2:et\r
#++\r
-\r
+#\r
+# :title: rbot basic management from IRC\r
+#\r
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>\r
+# Copyright:: (C) 2006,2007 Giuseppe Bilotta\r
+# License:: GPL v2\r
\r
class BasicsModule < CoreBotModule\r
\r
# when (/^(botsnack|ciggie)$/i)\r
# @bot.say m.replyto, @lang.get("thanks_X") % m.sourcenick if(m.public?)\r
# @bot.say m.replyto, @lang.get("thanks") if(m.private?)\r
- # when (/^(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi(\W|$)|yo(\W|$)).*/i)\r
- # @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick if(m.public?)\r
- # @bot.say m.replyto, @lang.get("hello") if(m.private?)\r
- # when (/^\s*(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi|yo(\W|$))[\s,-.]+#{Regexp.escape(@bot.nick)}$/i)\r
- # @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick\r
# when (/^#{Regexp.escape(@bot.nick)}!*$/)\r
# @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick\r
\r
#-- vim:sw=2:et\r
#++\r
-\r
+#\r
+# :title: rbot config management from IRC\r
+#\r
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>\r
+# Copyright:: (C) 2006,2007 Giuseppe Bilotta\r
+# License:: GPL v2\r
\r
class ConfigModule < CoreBotModule\r
\r
# end\r
\r
def bot_version(m, param)\r
- m.reply "I'm a v. #{$version} rubybot, (c) Tom Gilbert - http://linuxbrit.co.uk/rbot/"\r
+ m.reply "I'm a v. #{$version} rubybot, (c) Tom Gilbert and the rbot development team - http://linuxbrit.co.uk/rbot/"\r
end\r
\r
def handle_help(m, params)\r
#
# TODO find a way to manage session id (logging out, manually and/or
# automatically)
-#
require 'drb/drb'
#-- vim:sw=2:et
#++
#
-# Extensions to standard classes, to be used by the various plugins
+# :title: Standard classes extensions
+#
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+# Copyright:: (C) 2006,2007 Giuseppe Bilotta
+# License:: GPL v2
+#
+# This file collects extensions to standard Ruby classes and to some core rbot
+# classes to be used by the various plugins
+#
# Please note that global symbols have to be prefixed by :: because this plugin
# will be read into an anonymous module
+
# Extensions to the Array class
#
class ::Array
end
end
+
# Extensions to the String class
#
# TODO make ircify_html() accept an Hash of options, and make riphtml() just
end
end
+
# Extensions to the Regexp class, with some common and/or complex regular
# expressions.
#
end
+
module ::Irc
+#-- vim:sw=2:et
+#++
+#
+# :title: rbot HTTP provider
+#
+# Author:: Tom Gilbert <tom@linuxbrit.co.uk>
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+#
+# Copyright:: (C) 2002-2005 Tom Gilbert
+# Copyright:: (C) 2006 Tom Gilbert, Giuseppe Bilotta
+# Copyright:: (C) 2006,2007 Giuseppe Bilotta
+
module ::Irc
module Utils
begin
require 'net/https'
rescue LoadError => e
- error "Coudln't load 'net/https': #{e.inspect}"
+ error "Couldn't load 'net/https': #{e.inspect}"
error "Secured HTTP connections will fail"
end
+#-- vim:sw=2:et
+#++
+#
+# :title: rbot utilities provider
+#
+# Author:: Tom Gilbert <tom@linuxbrit.co.uk>
+# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
+#
+# Copyright:: (C) 2002-2006 Tom Gilbert
+# Copyright:: (C) 2007 Giuseppe Bilotta
+#
+# TODO some of these Utils should be rewritten as extensions to the approriate
+# standard Ruby classes and accordingly be moved to extends.rb
+
require 'net/http'
require 'uri'
require 'tempfile'
end
quit if $interrupted > 0
@socket.emergency_puts "PASS " + @config['server.password'] if @config['server.password']
- @socket.emergency_puts "NICK #{@config['irc.nick']}\nUSER #{@config['irc.user']} 4 #{@config['server.name']} :Ruby bot. (c) Tom Gilbert"
+ @socket.emergency_puts "NICK #{@config['irc.nick']}\nUSER #{@config['irc.user']} 4 #{@config['server.name']} :Ruby bot. (c) Tom Gilbert and the rbot development team"
quit if $interrupted > 0
myself.nick = @config['irc.nick']
myself.user = @config['irc.user']
#
# ==server events currently supported:
#
- # TODO handle errors ERR_NOSUCHNICK, ERR_NOSUCHCHANNEL, ERR_CANNOTSENDTOCHAN
+ # TODO handle errors ERR_NOSUCHNICK, ERR_NOSUCHCHANNEL
+ # TODO handle errors ERR_CHANOPRIVSNEEDED, ERR_CANNOTSENDTOCHAN
#
# welcome:: server welcome message on connect
# yourhost:: your host details (on connection)