UNPKG

convo

Version:

Easily create conversations (for more natural bots)

49 lines (35 loc) 1.1 kB
# convo A tiny language for creating conversations. Useful for creating more natural bots and getting your computer to talk back to you. ## Usage Turn this: ```js /hi/i => q1: "What would you like to eat today?" /(?:i'd like an? )?(apple|pear|orange)/i => `Great! ${1}s are ${price}.` "no" => "Well, would you like anything else?" "no" => "Okay... is there anything else I can get you?" => q1 /.*/ => q1 /.*/ => "Thanks for your business! Would you like anything else?" => q1 /I don't like eating/i => "Well, you're pleasant. You sure?" => q1 /no/i => "Okay have a nice day!" ``` Into a conversation like this: ``` me: Hi there! seller: What would you like to eat today? me: I'd like an apple seller: Great! apples are $0.80. me: Awesome, thanks! seller: Thanks for your business! Would you like anything else? me: Actually, I don't like eating seller: Well, you're pleasant. You sure? me: No seller: Okay have a nice day! ``` ## Installation ``` npm install convo ``` ## API Coming soon. For now, check the examples folder. ## License MIT