c:\trane\K5Agent>ruby K5bot.rb Hello > add pattern /Use the login name (.*)/, use_the_login_name def use_the_login_name(pattern=nil, input=nil) return "#{input} doesn't match #{pattern}" unless input =~ pattern return 'Default response from use_the_login_name' end # method_def use_the_login_name > add pattern /Use the password (.*)/, use_the_password def use_the_password(pattern=nil, input=nil) return "#{input} doesn't match #{pattern}" unless input =~ pattern return 'Default response from use_the_password' end # method_def use_the_password > add pattern /Upvote the first page of hidden comments/, upvote_the_first_page_of_hidden_comments def upvote_the_first_page_of_hidden_comments(pattern=nil, input=nil) return "#{input} doesn't match #{pattern}" unless input =~ pattern return 'Default response from upvote_the_first_page_of_hidden_comments' end # method_def upvote_the_first_page_of_hidden_comments > add pattern /Post a diary of the first page of hidden comments/, post_a_diary_of_the_first_page_of_hidden_comments def post_a_diary_of_the_first_page_of_hidden_comments(pattern=nil, input=nil) return "#{input} doesn't match #{pattern}" unless input =~ pattern return 'Default response from post_a_diary_of_the_first_page_of_hidden_comments' end # method_def post_a_diary_of_the_first_page_of_hidden_comments > add pattern /logout/, logout def logout(pattern=nil, input=nil) return "#{input} doesn't match #{pattern}" unless input =~ pattern return 'Default response from logout' end # method_def logout > quit Bye! c:\trane\K5Agent>gvim K5agent.rb c:\trane\K5Agent>ruby K5bot.rb Hello I have loaded c:/trane/K5Agent/K5agent-api.yaml. > add pattern /login to k$5/, login_to_k5 def login_to_k5(pattern=nil, input=nil) return "#{input} doesn't match #{pattern}" unless input =~ pattern return 'Default response from login_to_k5' end # method_def login_to_k5 > login to k5 is a synonym for login to k$5 Okay, (?i-mx:login to k5) has been added, and will now call login_to_k5. > login to kuro5hin is a synonym for login to k$5 Okay, (?i-mx:login to kuro5hin) has been added, and will now call login_to_k5. >