Class: RobutWhois::Plugin
- Inherits:
-
Object
- Object
- RobutWhois::Plugin
- Includes:
- Robut::Plugin
- Defined in:
- lib/robut_whois/plugin.rb
Instance Method Summary collapse
-
#handle(time, sender_nick, message) ⇒ Object
Responds with
message
if the command sent to robut is ‘echo’. -
#usage ⇒ Object
Returns a description of how to use this plugin.
Instance Method Details
#handle(time, sender_nick, message) ⇒ Object
Responds with message
if the command sent to robut is ‘echo’.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/robut_whois/plugin.rb', line 8 def handle(time, sender_nick, ) words = .split = words.first domain = words[1] if == 'whois' && domain begin reply Whois.query(domain).to_s rescue Timeout::Error reply "Sorry #{sender_nick}, request timed out for #{domain}" rescue Whois::ServerNotFound reply "Sorry #{sender_nick}, Unable to find a WHOIS server for #{domain}" end end end |
#usage ⇒ Object
Returns a description of how to use this plugin
24 25 26 |
# File 'lib/robut_whois/plugin.rb', line 24 def usage "whois <domain> - Returns the WHOIS information for a domain" end |