Skip to content

A powerful and easy-to-use Haskell library that provides a comprehensive wrapper for the Telegram Bot API.

License

Notifications You must be signed in to change notification settings

arist76/haskell-telegram-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

haskell-telegram-bot

docs telegram bot api python-telegram-bot api coverage license ghc version issue tracker

A simple and pure API implementation for the Telegram Bot API in Haskell. It aims to provide a type-safe way to build Telegram bots using Haskell's strong type system, making it easy to create maintainable and robust bots.

Features

  • Simple to use
  • Helps to build a type-safe Telegram bot
  • Utilizes Haskell's type safety to create awesome, maintainable, and easy-to-implement bots

Installation

Usage

This repo Basically defines a Bot data type that represents a Telegram bot and provides functions for constructing and interacting with the Telegram bot API. The module includes functions for making HTTP requests to the Telegram API which take Bot as an argument.

The Bot can be accessed throught the BotBuilder data type which is an implementation of the builder design pattern. BotBuilder is a minimal representation of the Bot type without including private fields. It provides a constructor initBot for creating a BotBuilder with an empty token, and a withToken function for setting the token on a BotBuilder instance. The buildBot function is used to convert a BotBuilder instance to a Bot instance.

import Bot

builder :: BotBuilder
builder = initBot

-- Add the token to the builder
builderWithToken :: BotBuilder
builderWithToken = 
    withToken
        "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
        builder

-- Build the Bot instance
myBot :: Bot
myBot = buildBot builder

All the Telegram bot methods are (will be) implemented. so you can use each method like this

updates :: IO (Either BotError [Update])
updates = getUpdates

is similar to

curl https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/getUpdates

Documentation

License

This project is released under the MIT License.

GHC Version

This library is currently compatible with GHC version 9 and above

Issue Tracker

Please report any bugs or issues in the Issue Tracker.

About

A powerful and easy-to-use Haskell library that provides a comprehensive wrapper for the Telegram Bot API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 100.0%