Skip to content

Instantly share code, notes, and snippets.

@worldbeater
Last active March 17, 2019 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save worldbeater/0c0efb85c775626c6e226b7b11f6b265 to your computer and use it in GitHub Desktop.
Save worldbeater/0c0efb85c775626c6e226b7b11f6b265 to your computer and use it in GitHub Desktop.
Funogram Greetings Bot
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