Module

TelegramBot

#Token

type Token = String

The Telegram Bot API Token.

#Options

type Options = { polling :: Boolean }

The Telegram Bot options.

#Message

type Message = { message_id :: Int, from :: Maybe User, date :: Int, chat :: Chat, location :: Maybe Location, text :: Maybe String }

The Telegram Message type. See https://core.telegram.org/bots/api#message

#User

type User = { id :: Int, first_name :: Maybe String, last_name :: Maybe String, username :: Maybe String }

The Telegram User type. See https://core.telegram.org/bots/api#user

#Chat

type Chat = { id :: Int, type :: String, first_name :: Maybe String, last_name :: Maybe String, username :: Maybe String }

The Telegram Chat type. See https://core.telegram.org/bots/api#chat

#Location

type Location = { longitude :: Number, latitude :: Number }

The Telegram Location type. See https://core.telegram.org/bots/api#location

#Bot

data Bot :: Type

#defaultOptions

#connect

#sendMessage

#onText

onText :: Bot -> Regex -> (F Message -> F Matches -> Effect Unit) -> (Effect Unit)

For adding a callback for on text matching a regex pattern.

#onText'

onText' :: Bot -> Regex -> (Foreign -> Foreign -> Effect Unit) -> (Effect Unit)

For getting the Foreign values directly. The callback is Message -> Matches -> Effect _ Unit.

#onMessage

onMessage :: Bot -> (F Message -> Effect Unit) -> (Effect Unit)

For adding a callback for all messages.

#onMessage'

onMessage' :: Bot -> (Foreign -> Effect Unit) -> (Effect Unit)

For getting the Foreign value directly from onMessage

#Promise

data Promise :: Type -> Type

#runPromise

#getMe

getMe :: Bot -> (Aff (F User))

For adding a callback for all messages.

Modules