Skip to content

Instantly share code, notes, and snippets.

@emad-elsaid
Created March 2, 2014 11:47
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save emad-elsaid/9305425 to your computer and use it in GitHub Desktop.
Save emad-elsaid/9305425 to your computer and use it in GitHub Desktop.
Wikipedia IRC bot
#!/usr/bin/env ruby
require 'cinch' # gem install cinch --no-ri --no-rdoc
require 'askwiki' # gem install askwiki --no-ri --no-rdoc
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.freenode.org"
c.nick = "Ask_wikipedia"
c.channels = ["#cinch-bots"]
end
on :message do |m|
if m.message.start_with? 'askwiki'
query = m.message.gsub('askwiki','').strip
m.reply Askwiki.ask(query), true
end
end
end
bot.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment