This is a simple telegram bot written because I wanted to try implementing a server in OCaml that handles JSON data. It took awhile to figure out how to use Async but I had a lot of fun and I'm happy with how pleasant it has been to code in OCaml, especially once you've set it up properly. Real World OCaml and mjambon/atdgen were really helpful in helping me understand how to do this.
The bot responds with a photo of Dolly whenever /dolly
is sent.
Dolly is a dog that I lived with during my semester abroad at UT Austin. She shares the same love for ice cream as I do and I thought it'd be great if I could respond with her photos in my telegram chats.
You'll have to create your own Telegram
Bot and set then set up a
webhook so that
Telegram will forward messages sent to your bot. The server sends a
photo's file_id
in response to POST
requests from Telegram so
you'll have to upload some photos first and then update the match
statement in handle_dolly
.
> ./make.sh
> ocamlrun server.byte