diff --git a/src/Makefile b/src/Makefile index 2f6eac6..28e7728 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ .SECONDARY: -SHELL=/bin/bash -x +SHELL=/bin/bash ROOT_DIR=/mnt/servers/aws.fredericofalcao.com/api.fredericofalcao.com/data/emails #SRC_EML_FILES=$(notdir $(shell find "$(ROOT_DIR)" -type f -name "*.eml" | head -n 2)) LATEST_FILE:=$(shell find "$(ROOT_DIR)" -name "*.eml" -printf '%T@ %p\n' | sort -n | tail -1) @@ -16,17 +16,20 @@ SRC_FILES=$(subst .score.txt,.notification.txt,$(SRC_SCORE_FILES)) all: $(SRC_FILES) +# 8. Upload telegram available bot commands +upload-available-bot-commands: ../process-telegram-updates/commands/01_learn.inc.php ../process-telegram-updates/commands/02_memory.inc.php + cd ../process-telegram-updates && make upload-available-commands + # 7. Processed received messages -process-telegram-updates: ../process-telegram-updates/process_message.php - cd ../process-telegram-updates && make +process-telegram-updates: ../process-telegram-updates/commands/01_learn.inc.php ../process-telegram-updates/commands/02_memory.inc.php + cd ../process-telegram-updates && make -../process-telegram-updates/process_message.php: - printf '%s\n' \ - ' $@ +../process-telegram-updates/commands/02_memory.inc.php: .dummy + echo '"/memories","description"=>"list all the memories","callback"=>function($$from,$$chat,$$date,$$text){telegram_send_text($$chat["id"],file_get_contents(__DIR__."/../data/learnings.txt"));}];' > $@ + +../process-telegram-updates/commands/01_learn.inc.php: .dummy + echo '"/learn","description"=>"learn a new instruction","callback"=>function($$from,$$chat,$$date,$$text){file_put_contents(__DIR__."/../data/learnings.txt", substr($$text,7)."\n",FILE_APPEND);}];' > $@ # 6. Run the MAIL-ROUTE script to either notify the user of a new message, or ignore @@ -78,7 +81,7 @@ telegram_notification.log: email_message.eml -F caption="Here is your file 📎" \ -F document="@$<" > $@ - +.dummy: clean: rm *.sys *.txt *.log *.eml