Skip to content

PureScript interface for the Telegraf.js bot framework

License

Notifications You must be signed in to change notification settings

sli/purescript-telegraf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 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] 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?"

About

PureScript interface for the Telegraf.js bot framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PureScript 77.6%
  • JavaScript 22.4%