Git Product home page Git Product logo

funogram's Introduction

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)

funogram's People

Contributors

delneg avatar dolfik1 avatar fornever avatar liminiens avatar worldbeater avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.