forked from uzyovoys/tadhack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoit.xml
531 lines (461 loc) · 22.7 KB
/
doit.xml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<context>
<pattern name="EnCity" value="entity://cities"/>
<pattern name="RuCity" value="entity://rucities"/>
<pattern name="City" value="($EnCity|$RuCity)"/>
<input id="help">
<pattern value="(/help|help) *"/>
<output>
<![CDATA[
I can create reminders and notify you through this chat.
Just send me a requests like:
Call mom in 2 hours
Buy flowers tomorrow
Do it in 3min
Go home at 5pm
Tell my friends about Doit bot
I can understand English, Spanish and Russian
Visit www.zenbot.org to create your own bot
]]>
</output>
</input>
<input id="hi">
<pattern value="(hi|hello|hola|привет*) *"/>
<output value="Привет привет" lang="ru"/>
<output value="Hola, solo escribe tu mensaje y selecciona la hora que deseas recibir la notificación. Mi trabajo ayudarte a recordar todo :) " lang="es"/>
<output value="Hi, just text your reminder and set the time and I'll help you to remember everything."/>
</input>
<input id="settings" pattern="/settings">
<output>
<item value="Sorry, I don't have any settings..."/>
<item value="Oops! Looks like I don't have any yet..."/>
</output>
</input>
<input id="thanks">
<pattern value="thank* [you *]"/>
<pattern value="(спасиб*|спс) [тебе *]"/>
<pattern value="(ok|ок)"/>
<pattern value="awesome"/>
<pattern value="(пока [пока]|bye [bye])"/>
<output lang="ru">
<item value="Всегда пожалуйста! Кстати ты можешь создать своего бота на www.zenbot.org"/>
<item value="Обращайтесь! Все сделаем!"/>
<item value="Загляни на http://hub.zenbot.org - там много интересного!"/>
</output>
<output lang="es">
<item value="¡No hay de que!"/>
<item value="¡Preguntanos! Siempre estamos para ayudarte"/>
<item value="Abré nuestra página web http://hub.zenbot.org - ¡encontrarás cosas interesantes!"/>
</output>
<output>
<item value="You are welcome! BTW you can create your own bots on www.zenbot.org"/>
<item value="Thanks, I'm doing all of this just for you :)"/>
<item value="Thanks for using me. You can find more interesting bots for Facebook, Slack and Telegram at http://hub.zenbot.org"/>
</output>
</input>
<input id="howareyou" pattern="how are you [doing]">
<output value="I'm fine thanks! Let's get this done, what do you need to remind?"/>
</input>
<input id="start" pattern="/start *">
<output>
<![CDATA[
Hi! I can create reminders and notify you through this chat
Just send me a request like "Call mom in 2 hours" or "Buy flowers tomorrow"
I can understand English and Russian
Visit www.zenbot.org to create your own bot
]]>
</output>
</input>
<input id="city" pattern="/city * [$City] *">
<context if="empty($City)" modal="true">
<output value="Please define your current city name" />
<input id="city" pattern="* $City *">
<context id="city"/>
</input>
<input id="unknown_city" pattern="*">
<output value="Ой.. Похоже, что я не знаю такого города.." lang="ru"/>
<output value="Sorry, I don't know such a city..."/>
</input>
</context>
<context id="city">
<var name="City">
<script>
<![CDATA[
var city;
for (var i = 0; i < City.length; i++) {
var c = City[i];
city = !city || city.population < c.population ? c : city;
}
if (!city) city = City;
city;
]]>
</script>
</var>
<var name="UserCity" value="$City" scope="user"/>
<output value="Отлично! Теперь я знаю, из какого ты города." lang="ru"/>
<output value="!Perfecto! Ahora se en que ciudad te encuentras." lang="es"/>
<output value="Ok! Now I know your current timezone."/>
</context>
</input>
<input id="remind" pattern="[Doit] [* (напомни* [мне] [про] | remind [me] [about] | recordar [me] [acerca])] { $Text [$When::Date] [$Time] }">
<context if="empty($UserCity) and empty($req_offset) and empty($req_lat)" modal="true">
<output value="Хорошо-хорошо, я все сделаю.. Но сначала мне нужно узнать, из какого ты города, чтобы определить твой часовой пояс." lang="ru"/>
<output value="Well, first of all I need to know the name of your current city to determine your timezone."/>
<input id="city" pattern="* $City *">
<var name="City">
<script>
<![CDATA[
var city;
for (var i = 0; i < City.length; i++) {
var c = City[i];
city = !city || city.population < c.population ? c : city;
}
if (!city) city = City;
city;
]]>
</script>
</var>
<var name="UserCity" value="$City" scope="user"/>
<context id="reminder_text" if="empty($Text)"/>
<context id="reminder_date" if="empty($Time)"/>
<context id="reminder"/>
</input>
<input id="unknown_city" pattern="*">
<output value="Ой.. Похоже, что я не знаю такого города.." lang="ru"/>
<output value="Opaa.. no conozco está ciudad...." lang="es"/>
<output value="Sorry, I don't know such a city..."/>
</input>
</context>
<context id="reminder" if="full($Text) and full($Time)"/>
<context id="reminder_text" if="empty($Text)" modal="true">
<output value='Что нужно напомнить?".' lang="ru"/>
<output value='What do you have to do?'/>
<sample value="Отмена" lang="ru"/>
<sample value="Cancelar" lang="es"/>
<sample value="Cancel"/>
<input pattern="$Text" id="text">
<context id="reminder" if="full($Time)"/>
<context id="reminder_date"/>
</input>
<input id="cancel" pattern="(cancel|отмена|отмени*|отбой|cancelar|cancela|cierra)">
<context id="cancel"/>
</input>
</context>
<context id="reminder_date" if="empty($Time)">
<output value='Когда нужно напомнить об этом?' lang="ru" if="empty($When)"/>
<output value='Во сколько нужно напомнить?' lang="ru"/>
<output value='When do you have to do it?' if="empty($When)"/>
<output value='At what time do you have to do it?'/>
<sample value="Отмена" lang="ru"/>
<sample value="Cancelar" lang="es"/>
<sample value="Cancel"/>
<input id="datetime">
<pattern value="[Doit] * {(* $Time) [$When::Date]} *"/>
<pattern value="[Doit] * $When::Date *"/>
<context id="reminder" if="full($Time)"/>
<context id="reminder_date"/>
</input>
<input id="now">
<pattern value="[Doit] * now *"/>
<pattern value="[Doit] * (сейчас|щас|шас) *"/>
<output value="⏰ $Text"/>
</input>
</context>
<context id="reminder">
<var name="UserCity" if="empty($UserCity) and full($req_lat)" value="javascript: var c = {lat: req_lat, lon: req_lon}; c"/>
<var name="ts" if="empty($UserCity)" value="javascript: var ts = {gmtOffset: req_offset * 60}; ts"/>
<get var="ts" url="http://api.timezonedb.com" if="empty($ts)">
<param name="key" value="FRV82TNBHN8K"/>
<param name="format" value="json"/>
<param name="lat" value='get("lat", $UserCity)'/>
<param name="lng" value='get("lon", $UserCity)'/>
</get>
<var name="Time">
<script>
<![CDATA[
var time = { hour: Time.hour, minute: Time.minute, second: Time.second, relative: Time.relative, part: Time.part };
if (!time.part && time.hour < 9) {
time.hour = time.hour + 12;
}
time;
]]>
</script>
</var>
<var name="When" value="javascript: When.date" if="full($when)"/>
<var name="When" value="$req_timestamp" if="empty($When)"/>
<var name="Text" value="cap($Text)" scope="context"/>
<var name="DateTime" value="dt($When, $Time)"/>
<var name="DateTime" value="$DateTime + 24*60*60000" if="$DateTime lt $req_timestamp + $req_offset * 60000"/>
<var name="DateTime" value="javascript: DateTime - req_offset * 60000" if='get("relative", $Time)'/>
<var name="DateTime" value='javascript: DateTime - ts.gmtOffset * 1000' if='!get("relative", $Time)'/>
<var name="FacebookPayload" channel="facebook">
<![CDATA[
{
"recipient" : { "id" : "$req_client" },
"message" : {
"text": "$Text",
"quick_replies": [
{
"content_type":"text",
"title":"Postpone",
"payload":"$Text"
},
{
"content_type":"text",
"title":"10 min",
"payload":"in 10 minutes $Text"
},
{
"content_type":"text",
"title":"30 min",
"payload":"in 30 minutes $Text"
},
{
"content_type":"text",
"title":"Done",
"payload":"/done"
}
]
}
}
]]>
</var>
<var name="FacebookPayload" channel="facebook" lang="ru">
<![CDATA[
{
"recipient" : { "id" : "$req_client" },
"message" : {
"text": "$Text",
"quick_replies": [
{
"content_type":"text",
"title":"Отложить",
"payload":"$Text"
},
{
"content_type":"text",
"title":"10 минут",
"payload":"через 10 минут $Text"
},
{
"content_type":"text",
"title":"30 минут",
"payload":"через 30 минут $Text"
},
{
"content_type":"text",
"title":"Сделано",
"payload":"/done ru"
}
]
}
}
]]>
</var>
<var name="FacebookPayload" channel="facebook" lang="es">
<![CDATA[
{
"recipient" : { "id" : "$req_client" },
"message" : {
"text": "$Text",
"quick_replies": [
{
"content_type":"text",
"title":"Posponer",
"payload":"$Text"
},
{
"content_type":"text",
"title":"10 minutos",
"payload":"dentro de 10 minutos $Text"
},
{
"content_type":"text",
"title":"30 minutos",
"payload":"dentro de 30 minutos $Text"
},
{
"content_type":"text",
"title":"Hecho",
"payload":"/done es"
}
]
}
}
]]>
</var>
<var name="SlackPayload" channel="slack">
<![CDATA[
[
{
"attachment_type" : "default",
"fallback" : "There is no additional actions available",
"callback_id" : "remind",
"text" : "$Text",
"actions" : [
{
"name" : "input",
"type" : "button",
"text" : "Postpone",
"value" : "$Text"
},
{
"name" : "input",
"type" : "button",
"text" : "10 min",
"value" : "$Text in 10 minutes"
},
{
"name" : "input",
"type" : "button",
"text" : "30 min",
"value" : "$Text in 30 minutes"
},
{
"name" : "input",
"type" : "button",
"text" : "Done",
"value" : "/done"
}
]
}
]
]]>
</var>
<var name="SlackPayload" channel="slack" lang="ru">
<![CDATA[
[
{
"attachment_type" : "default",
"fallback" : "There is no additional actions available",
"callback_id" : "remind",
"text" : "$Text",
"actions" : [
{
"name" : "input",
"type" : "button",
"text" : "Отложить",
"value" : "$Text"
},
{
"name" : "input",
"type" : "button",
"text" : "Через 10 мин",
"value" : "$Text через 10 минут "
},
{
"name" : "input",
"type" : "button",
"text" : "Через 30 мин",
"value" : "$Text через 30 минут"
},
{
"name" : "input",
"type" : "button",
"text" : "Сделано",
"value" : "/done ru"
}
]
}
]
]]>
</var>
<var name="SlackPayload" channel="slack" lang="es">
<![CDATA[
[
{
"attachment_type" : "default",
"fallback" : "There is no additional actions available",
"callback_id" : "remind",
"text" : "$Text",
"actions" : [
{
"name" : "input",
"type" : "button",
"text" : "Posponer",
"value" : "$Text"
},
{
"name" : "input",
"type" : "button",
"text" : "Dentro de 10 min",
"value" : "$Text Dentro de 10 minutos "
},
{
"name" : "input",
"type" : "button",
"text" : "Dentro de 30 min",
"value" : "$Text Dentro de 30 minutos"
},
{
"name" : "input",
"type" : "button",
"text" : "Hecho",
"value" : "/done es"
}
]
}
]
]]>
</var>
<var name="SparkPayload" channel="spark">
<![CDATA[
{
"roomId" : "$req_spark_room",
"markdown" : "$Text"
}
]]>
</var>
<get var="Result" url="https://im.zenbot.org/api/schedule" channel="telegram">
<param name="timestamp" value="$DateTime"/>
<param name="callback" value="https://api.telegram.org/bot$req_telegram_token/sendMessage?chat_id=$req_telegram_chat&text=⏰ $Text"/>
</get>
<get var="Result" url="https://im.zenbot.org/api/schedule" channel="slack">
<param name="timestamp" value="$DateTime"/>
<param name="callback" value="https://slack.com/api/chat.postMessage?token=$req_slack_token&channel=$req_slack_channel&as_user=false&username=Doit&icon_emoji=:alarm_clock:&attachments=$SlackPayload"/>
</get>
<get var="Result" url="https://im.zenbot.org/api/schedule" channel="facebook">
<param name="timestamp" value="$DateTime"/>
<param name="callback" value="https://graph.facebook.com/v2.6/me/messages?access_token=$req_facebook_token"/>
<param name="payload" value="$FacebookPayload"/>
</get>
<get var="Result" url="https://im.zenbot.org/api/schedule" channel="spark">
<param name="timestamp" value="$DateTime"/>
<param name="callback" value="https://api.ciscospark.com/v1/messages"/>
<param name="headers" value="Authorization: Bearer $req_spark_token"/>
<param name="payload" value="$SparkPayload"/>
</get>
<var name="CallbackId" value="$Result" if="full($Result)" scope="context"/>
<var name="DateTime" value="javascript: DateTime + ts.gmtOffset * 1000"/>
<var name="DateFmt" value='fmt($DateTime, "EEEE dd.MM", $req_lang)' if='eq($req_lang, "ru")'/>
<var name="TimeFmt" value='fmt($DateTime, "HH:mm", $req_lang)' if='eq($req_lang, "ru")'/>
<var name="DateFmt" value='fmt($DateTime, "EEEE, MMMM dd", $req_lang)' if='!eq($req_lang, "ru")'/>
<var name="TimeFmt" value='fmt($DateTime, "hh:mm a", $req_lang)' if='!eq($req_lang, "ru")'/>
<output value='Хорошо, я напомню тебе "$Text" в $TimeFmt ($DateFmt)' lang="ru"/>
<output value='OK, I will remind you "$Text" at $TimeFmt $DateFmt'/>
<sample value="Отмена" lang="ru"/>
<sample value="Cancel"/>
<input id="cancel" pattern="[Doit] (cancel|cancelar|cancela|cierra|no|nope|отмена|отмени*|отбой|стоп|нет|не [надо|нужно])">
<context id="cancel">
<output value="Хорошо, не буду создавать это напоминание." lang="ru"/>
<output value="Ok, canceling this reminder."/>
<get var="Result" url="https://im.zenbot.org/api/schedule/cancel" if="full($CallbackId)">
<param name="id" value="$CallbackId"/>
</get>
</context>
</input>
<input>
<pattern value="(no|нет) * $Date [* $Time]"/>
<pattern value="(no|нет) * {[* $Date] (* $Time)}"/>
<get var="Result" url="https://im.zenbot.org/api/schedule/cancel" if="full($CallbackId)">
<param name="id" value="$CallbackId"/>
</get>
</input>
</context>
</input>
<input id="cancel" pattern="[Doit] (cancel|cancelar|cancela|cierra|no|nope|отмена|отмени*|отбой|стоп|нет|не [надо|нужно])">
<context id="cancel">
<output value="Хорошо, не буду создавать это напоминание." lang="ru"/>
<output value="Ok, canceling this reminder."/>
</context>
</input>
</context>