Skip to content

PureScript interface for the Telegraf.js bot framework

License

Notifications You must be signed in to change notification settings

oliver3/purescript-telegraf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PureScript interface for the Telegraf [1] bot framework, using ReaderT to avoid having to supply the bot or ctx argument every time

[1] http:https://telegraf.js.org/

bower install purescript-telegraf --save
npm install telegraf --save
module Main where

import Prelude

import Control.Monad.Aff (launchAff_)
import Control.Monad.Eff (Eff)
import Telegraf (Configuration(..), TELEGRAF, getFrom, hears, reply, runWithTelegraf)

config :: Configuration
config = Polling { token: "My Telegram token from BotFather" }

main :: forall eff. Eff (telegraf :: TELEGRAF | eff) Unit
main = launchAff_ $ runWithTelegraf config do
  hears "hi" do
    user <- getFrom
    reply $ "Hey " <> user.first_name
    reply "What's up?"