Skip to content
F# Telegram Bot Api library
F#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs/files/img
src
.gitignore
.travis.yml
LICENSE
README.md

README.md

Travis build status NuGet

Funogram

F# Telegram Bot Api library!

Getting Started

Firstly you need to install Funogram. Installation for .NET Core users:

dotnet add package Funogram

Installation for .NET Framework users:

Install-Package Funogram

Writing a Bot

To get your first bot running just use startBot function from Funogram.Bot module. If you don't need any additional configuration, you can use defaultConfig constant that stores default settings. Note that you need to extend default config with your own bot token received from BotFather. Here you go:

open Funogram.Bot

startBot { defaultConfig with Token = "your token" } onUpdate None

Every update received from Telegram Bot API will be passed to onUpdate function. It should handle user input according to UpdateContext passed. Use processCommands function to process commands addressed to your Bot, cmd and cmdScan can help you.

let onUpdate (context: UpdateContext) =
  processCommands context [
    cmd "/start" onStart
    cmd "/help" onHelp
  ]

Use Funogram.Api module to communicate with Telegram API with the help of request builders implemented using curried functions, for example sendMessage, sendPhoto and so on.

"Hello, world!"
|> sendMessage chatId
|> api accessToken
|> Async.RunSynchronously
|> ignore (* or process API response somehow *)

So, that is it! Use Intellisence-driven development approach to explore all Funogram features! For further learning you may take a look at sample Telegram bots built using this library: Test Bot, Memes Bot

Articles

Funogram: Writing Telegram Bots In F#

Funogram.Keyboard: How to reserve seats on an airplane using F # and telegram

Plugins and Extensions

Funogram.Keyboard

Work in Progress

Old methods moved in Funogram.Rest module. New more functional api available in Funogram.Api module.

Not recommended to use functions who ends with Base, because it's may be changed in future. If you want to use this functions, you need to minimize usage of it (write wrapper, for example).

Completed 👍:

  • getUpdates
  • getMe
  • forwardMessage
  • sendMessage (not tested ForceReply)
  • getUserProfilePhotos
  • getFile (not tested)
  • kickChatMember (not tested)
  • unbanChatMember (not tested)
  • leaveChat (not tested)
  • getChat
  • getChatAdministrators (not tested)
  • getChatMembersCount (not tested)
  • getChatMember (not tested)
  • answerCallbackQuery (not tested)
  • editMessageText (not tested)
  • editMessageCaption (not tested)
  • editMessageReplyMarkup (not tested)
  • deleteMessage (not tested)
  • answerInlineQuery (not tested)
  • sendInvoice (not tested)
  • answerShippingQuery (not tested)
  • answerPreCheckoutQuery (not tested)
  • sendPhoto
  • sendAudio (not tested)
  • sendDocument (not tested)
  • sendSticker (not tested)
  • sendVideo (not tested)
  • sendVoice (not tested)
  • sendVideoNote (not tested)
  • sendLocation (not tested)
  • sendVenue (not tested)
  • sendContact (not tested)
  • sendChatAction (not tested)
  • sendGame (not tested)
  • setGameScore (not tested)
  • getGameHighScores (not tested)
  • restrictChatMember (not tested)
  • promoteChatMember (not tested)
  • kickChatMember (not tested)
  • exportChatInviteLink (not tested)
  • setChatPhoto (not tested)
  • deleteChatPhoto (not tested)
  • setChatTitle (not tested)
  • setChatDescription (not tested)
  • pinChatMessage (not tested)
  • unpinChatMessage (not tested)
You can’t perform that action at this time.