Advertisement
Azure

Untitled

Nov 30th, 2011
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.14 KB | None | 0 0
  1. require 'yaml'
  2. require 'ap'
  3. y = YAML::load(open('./macros.yaml'))
  4.  
  5. lines = y["bod"]["lines"]
  6.  
  7. lines.each {|line|
  8.   if line.is_a? Hash
  9.     sleep line["seconds"] unless !line.has_key? "seconds"
  10.     if line.has_key?("type") && line["type"] == "action"
  11.       puts "action - #{line["msg"]}"
  12.     else
  13.       puts line["msg"]
  14.     end
  15.   elsif line.is_a? String
  16.     puts line
  17.   elsif line.is_a? Array
  18.     puts line.join("\n")
  19.   else
  20.     puts line.to_s
  21.   end
  22. }
  23.  
  24. # ----
  25.  
  26. =begin
  27. macros.yaml:
  28.  
  29. alart:
  30.   random:
  31.     - /!\ <input,'ALART'> /!\
  32.     - /// <input,'ALART'> ///
  33.     - \\\ <input,'ALART'> \\\
  34. bod:
  35.   lines:
  36.     - seconds: 2
  37.       type: action
  38.       msg: <input,nick> should go
  39.     - eat a
  40.     - bag of
  41.     - type: action
  42.       seconds: 5
  43.       msg: DICKS!!!!
  44. drink:
  45.   random:
  46.     - type: action
  47.       msg: gets <nick> a dr pepper
  48.     - type: action
  49.       msg: gets <nick> a coke
  50.     - type: action
  51.       msg: gets <nick> a pepsi
  52.     - type: action
  53.       msg: gets <nick> a glass of Sussex Golden ginger ale
  54. dumb bot:
  55.   random:
  56.     - Dumb human!
  57.     - Dumb meatbag!
  58.     - Stupid human!
  59.     - Stupid meatbag!
  60. =end
  61.  
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement