Last active
March 17, 2019 20:34
-
-
Save worldbeater/0c0efb85c775626c6e226b7b11f6b265 to your computer and use it in GitHub Desktop.
Funogram Greetings Bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Program | |
open Funogram.Bot | |
open Funogram.Api | |
open ExtCore.Control | |
open System | |
/// Handler for '/hello'. | |
let onHello context = | |
maybe { | |
let! message = context.Update.Message | |
let! name = message.Chat.FirstName | |
sprintf "Hello, %s!" name | |
|> sendMessage message.Chat.Id | |
|> api context.Config | |
|> Async.Ignore | |
|> Async.Start | |
} |> ignore | |
/// Handles all Telegram events. | |
let update context = | |
processCommands context | |
[ cmd "/hello" onHello ] | |
|> ignore | |
[<EntryPoint>] | |
let main _ = | |
startBot { | |
defaultConfig with | |
Token = "bot-token" | |
} update None | |
|> Async.RunSynchronously | |
|> ignore | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://medium.com/@worldbeater/funogram-writing-telegram-bots-in-f-f27a873fa548