-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
121 lines (96 loc) · 5.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
<head>
<title>bot.rb</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>bot.rb</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-comment">#!/usr/bin/env ruby</span></pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p>The basic usage script from <a href="https://github.com/JEG2/highline.git">https://github.com/JEG2/highline.git</a></p>
<h1 id="introduction">Introduction</h1>
<p>This bot is responsible for handling a short information conversation
with up to four choices.</p>
<h1 id="installation">Installation</h1>
<p>cd to greeenbot-core
npm install subprompts-bot</p>
<h1 id="issues">Issues</h1>
<ul>
<li>We only support four choices</li>
</ul>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">require</span> <span class="hljs-string">'./lib/greenbot.rb'</span></pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
<p>When the script starts, send out the first two prompts to the inbound
messager</p>
</div>
<div class="content"><div class='highlight'><pre>tell ENV[<span class="hljs-string">'PROMPT_1'</span>]
tell ENV[<span class="hljs-string">'PROMPT_2'</span>]
<span class="hljs-keyword">begin</span>
tasks = ENV[<span class="hljs-string">'MENU_CHOICES'</span>].split(<span class="hljs-string">','</span>).map(&<span class="hljs-symbol">:strip</span>)
tasks << <span class="hljs-string">'quit'</span>
tasks << <span class="hljs-string">'contactme'</span>
my_task = select(ENV[<span class="hljs-string">'MENU_PROMPT'</span>], tasks).downcase
<span class="hljs-keyword">case</span> my_task
<span class="hljs-keyword">when</span> <span class="hljs-string">'contactme'</span>
<span class="hljs-keyword">if</span> confirm(ENV[<span class="hljs-string">'CONFIRM_CONTACT'</span>])
contact_me = <span class="hljs-literal">true</span>
contact_me.remember(<span class="hljs-string">'contact_me'</span>)
name = ask(ENV[<span class="hljs-string">'WHO_TO_ASK_FOR'</span>])
name.remember(<span class="hljs-string">'who_to_ask_for'</span>)
<span class="hljs-keyword">if</span> confirm(ENV[<span class="hljs-string">'PREFER_ALTERNATE_CONTACT'</span>])
better_number = ask(ENV[<span class="hljs-string">'ALTERNATE_CONTACT_COLLECTION'</span>])
better_number.remember(<span class="hljs-string">'better_number'</span>)
<span class="hljs-keyword">end</span>
<span class="hljs-keyword">else</span>
tell(ENV[<span class="hljs-string">'DONT_CONTACT_PROMPT'</span>])
contact_me = <span class="hljs-literal">false</span>
contact_me.remember(<span class="hljs-string">'contact_me'</span>)
<span class="hljs-keyword">end</span>
<span class="hljs-keyword">when</span> <span class="hljs-string">'quit'</span>
<span class="hljs-keyword">break</span>
<span class="hljs-keyword">else</span>
<span class="hljs-keyword">case</span> tasks.map(&<span class="hljs-symbol">:downcase</span>).index(my_task)
<span class="hljs-keyword">when</span> <span class="hljs-number">0</span>
tell ENV[<span class="hljs-string">'FIRST_CHOICE'</span>]
<span class="hljs-keyword">when</span> <span class="hljs-number">1</span>
tell ENV[<span class="hljs-string">'SECOND_CHOICE'</span>]
<span class="hljs-keyword">when</span> <span class="hljs-number">2</span>
tell ENV[<span class="hljs-string">'THIRD_CHOICE'</span>]
<span class="hljs-keyword">when</span> <span class="hljs-number">3</span>
tell ENV[<span class="hljs-string">'FOURTH_CHOICE'</span>]
<span class="hljs-keyword">end</span>
<span class="hljs-keyword">end</span>
<span class="hljs-keyword">end</span> <span class="hljs-keyword">while</span> <span class="hljs-literal">true</span>
tell ENV[<span class="hljs-string">'SIGNATURE'</span>]</pre></div></div>
</li>
</ul>
</div>
</body>
</html>