Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa
Forked from emad-elsaid/irc-bot.rb
Created March 3, 2014 04:31
Show Gist options
  • Save MohamedAlaa/9318397 to your computer and use it in GitHub Desktop.
Save MohamedAlaa/9318397 to your computer and use it in GitHub Desktop.
#!/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