项目作者: oliver3

项目描述 :
PureScript interface for the Telegraf.js bot framework
高级语言: PureScript
项目地址: git://github.com/oliver3/purescript-telegraf.git
创建时间: 2017-12-19T10:46:28Z
项目社区:https://github.com/oliver3/purescript-telegraf

开源协议:MIT License

下载


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

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

  1. bower install purescript-telegraf --save
  2. npm install telegraf --save
  1. module Main where
  2. import Prelude
  3. import Control.Monad.Aff (launchAff_)
  4. import Control.Monad.Eff (Eff)
  5. import Telegraf (Configuration(..), TELEGRAF, getFrom, hears, reply, runWithTelegraf)
  6. config :: Configuration
  7. config = Polling { token: "My Telegram token from BotFather" }
  8. main :: forall eff. Eff (telegraf :: TELEGRAF | eff) Unit
  9. main = launchAff_ $ runWithTelegraf config do
  10. hears "hi" do
  11. user <- getFrom
  12. reply $ "Hey " <> user.first_name
  13. reply "What's up?"