Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.