From 05fa1103796cdbda30afb7be1e569674d6076f87 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 16 Mar 2016 20:58:51 +0100 Subject: Move _guess_ example greeting to conversation closure constructor --- example/guess.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/example/guess.scm b/example/guess.scm index 2215380..e1b419c 100644 --- a/example/guess.scm +++ b/example/guess.scm @@ -22,6 +22,8 @@ (define (make-conversation chat_id) (let ((chat_id chat_id) (answer (random 100))) + (send chat_id + "Hi there! I just generated a random number for you to guess!") (lambda (text) (let ((guess (string->number text))) (if (number? guess) @@ -39,11 +41,9 @@ (print chat_id " -> \"" text "\"") (if (hash-table-exists? conversations chat_id) ((hash-table-ref conversations chat_id) text) - (begin (hash-table-set! conversations - chat_id - (make-conversation chat_id)) - (send chat_id - "Hi there! I just generated a random number for you to guess!"))))) + (hash-table-set! conversations + chat_id + (make-conversation chat_id))))) (randomize) (telebot:pollUpdates token -- cgit v1.2.3