telegram-bot-simple
Easy to use library for building Telegram bots.
https://github.com/fizruk/telegram-bot-simple#readme
Version on this page: | 0.14.2 |
LTS Haskell 23.1: | 0.14.4 |
Stackage Nightly 2024-12-27: | 0.14.4 |
Latest on Hackage: | 0.14.4 |
telegram-bot-simple-0.14.2@sha256:c2a553eaad9efe51c0214b61950e327eff22d4a3f5eeebe280dd5f17f9dabc81,5644
Module documentation for 0.14.2
- Telegram
- Telegram.Bot
- Telegram.Bot.Simple
- Telegram.Bot
telegram-bot-simple
Easy to use library for building Telegram bots in Haskell.
LambdaConf 2018 workshop
This library was featured in a LambdaConf 2018 workshop. The supplementary materials for the workshop is available at https://github.com/fizruk/lambdaconf-2018-workshop.
Examples
See bot examples here: https://github.com/fizruk/telegram-bot-simple/tree/master/telegram-bot-simple/examples
Use cabal build all -fexamples
to build it.
If you are building with stack then use stack build --flag telegram-bot-simple:examples
.
Contributing
Contributions are welcome! Feel free to ping me on GitHub, file an issue or submit a PR :)
Compatibility
telegram-bot-api | telegram-bot-simple |
---|---|
0.10 | 6.5 |
0.11.1 | 6.5.1 |
0.12 | 6.7 |
0.13 | 7.0 |
0.14 | 7.3 |
0.14.2 | 7.4 |
Nick
Changes
0.14.2 – 2024-08-26
- Fix
ExceptionInLinkedThread
(see #189).
0.14.1 – 2024-05-26
- Support
telegram-bot-api == 7.3.1
.
0.14 – 2024-05-25
- Drop support GHC 8.10, 9.0, add support GHC 9.8, 9.10 (see #182).
- Support
telegram-bot-api == 7.3
. - Ignore updates that produces parsing errors (see #175).
0.13 – 2024-02-06
- Support GHC 9.6 (see #163).
- Support
telegram-bot-api == 7.0
. - Fix bot hanging via rethrowing exceptions (see #170).
0.12 – 2023-04-29
-
Add support for testing WebApps (see #148);
-
Add nix flake (see #149);
-
Improve documentation for
callbackQueryDataRead
(see #153); -
Support
telegram-bot-api == 6.7
(breaking changes included). -
Migration guide:
- Provide
InlineQueryResultGeneric
(seedefInlineQueryResultGeneric
). - Provide
InlineQueryResultGenericThumbnail
(seedefInlineQueryResultGenericThumbnail
). - Specify your own
InlineQueryResult
(see helpers for each data constructor).
- Provide
0.11.1
- Add
RunTG
instances for newly added methods in 6.5.1.
0.11
- Add default implementations to all requests (see #138);
- Add
RunTG
that simplifies making requests (see #139);
0.10
-
Compilation time reduced by splitting types and methods (see #136);
-
All
Telegram.Bot.API.*
modules moved totelegram-bot-api
package (see #137); -
Telegram.Bot.Simple.Webhook
module added; -
Migration guide:
- In the most cases you need to add
telegram-bot-api
package in project dependency list; - If you are using webhooks then you also need to import
Telegram.Bot.Simple.Webhook
fromtelegram-bot-simple
;
- In the most cases you need to add
0.9
-
Make package complaint with Telegram Bot API 6.5 (breaking changes included) (see #135):
KeyboardButton
extended withrequest_user
andrequest_chat
fields;KeyboardButtonRequestUser
andKeyboardButtonRequestChat
types added;Message
extended withuser_shared
andchat_shared
fields;ChatMember
andChatPermissions
:can_send_media_messages
replaced with following fields:can_send_audios
;can_send_documents
;can_send_photos
;can_send_videos
;can_send_video_notes
;can_send_voice_notes
;
use_independent_chat_permissions
field added tosetChatPermissions
andrestrictChatMember
methods;ChatJoinRequest
extended withuser_chat_id
field.Update
type fixed and aligned with the spec.
0.8
-
Make package complaint with Telegram Bot API 6.4 (breaking changes included) (see #134):
ReplyKeyboardMarkup
extended withis_persistent
;Message
extended withhas_media_spoiler
;Chat
extended withhas_hidden_members
andhas_aggressive_anti_spam_enabled
;editForumTopic
method: fieldsname
andicon_custom_emoji_id
become optional;has_spoiler
field added to:- data constructors:
InputMediaPhoto
,InputMediaVideo
andInputMediaAnimation
; - method:
sendPhoto
,sendVideo
andsendAnimation
;
- data constructors:
- Following message events added
ForumTopicEdited
,GeneralForumTopicHidden
andGeneralForumTopicUnhidden
; - General topic forum management, i.e. added following functions:
editGeneralForumTopic
,closeGeneralForumTopic
,reopenGeneralForumTopic
,hideGeneralForumTopic
andunhideGeneralForumTopic
;
0.7
-
Make package complaint with Telegram Bot API 6.3 (breaking changes included) (see #133):
Chat
extended withis_forum
,active_usernames
andemoji_status_custom_emoji_id
;Message
extended withforum_topic_created
,forum_topic_closed
andforum_topic_reopened
;- Following message events added
ForumTopicCreated
,ForumTopicClosed
andForumTopicReopened
; can_manage_topics
field added toChatAdministratorRights
,ChatPermissions
andChatMember
data types;PromoteChatMemberRequest
extended withcan_manage_topics
too;message_thread_id
field added to following methods requests:sendMessage
,sendPhoto
,sendVideo
,sendAnimation
,sendAudio
,sendDocument
,sendSticker
,sendVideoNote
,sendVoice
,sendLocation
,sendVenue
,sendContact
,sendPoll
,sendDice
,sendInvoice
,sendGame
,sendMediaGroup
,copyMessage
andforwardMessage
;- Forum management, i.e. added following functions:
createForumTopic
,editForumTopic
,closeForumTopic
,reopenForumTopic
,deleteForumTopic
,unpinAllForumTopicMessages
andgetForumTopicIconStickers
;
0.6.2
- Fix decoding for
VideoChatStarted
(see #132);
0.6.1
- Fix response parsing in
UpdatingMessages
(see #131); - Move from short polling to long polling (see #129);
0.6
-
Fix newlines unexpected removing in
UpdateParser
module (see #124); -
Add WebHooks support (see #127);
-
Fix
parse_mode
encoding insendPhoto
,sendDocument
,sendVideo
andsendAnimation
methods (see #123 and 5ee5289); -
Make package complaint with Telegram Bot API 6.2 (breaking changes included) (see fab1aee):
- Added
createInvoiceLink
method; - Added
getCustomEmojiStickers
method; User
extended withis_premium
andadded_to_attachment_menu
;Chat
extended withhas_restricted_voice_and_video_messages
,join_to_send_messages
,join_by_request
;MessageEntityType
extended withcustom_emoji
;file_size
field forAnimation
,Audio
,Document
,Video
,VideoNote
Voice
,File
changed fromInt
toInteger
;SticketSet
modified:contains_masks
is optional now and becoming a subject of further deprecation in a future,type
added;- Added
StickerSetType
: could beregular
,mask
andcustom_emoji
.
- Added
0.5.2
- Helpers from
UpdateParser
module fixed,commandWithBotName
added (see #121);
0.5.1
- Fix inconsistency around
ParseMode
(see #114); - Fix
copyMessage
method (see #116); - Add CI via GitHub Actions (see #119);
- Fix GHC 9.0 compilation regression (see #120);
0.5
-
Add
MarkdownV2
toParseMode
haddock suggestion (see #110); -
Make package complaint with Telegram Bot API 6.0 (breaking changes included) (see #112):
WebAppInfo
data type added.KeyboardButton
,InlineKeyboardButton
extended withweb_app
record.SentWebAppMessage
data type added.answerWebAppQuery
method added.MenuButton
data type added.setChatMenuButton
,getChatMenuButton
methods added.ChatAdministratorRights
data type added.setMyDefaultAdministratorRights
,getMyDefaultAdministratorRights
methods added.- :warning:
ChatMember
records changed:can_manage_voice_chats
renamed tocan_manage_video_chat
. - :warning:
PromoteChatMemberRequest
records changed:can_manage_voice_chats
renamed tocan_manage_video_chats
. - :warning:
Message
records changed:voice_chat_scheduled
,voice_chat_started
,voice_chat_ended
, andvoice_chat_participants_invited
renamed tovideo_chat_scheduled
,video_chat_started
,video_chat_ended
, andvideo_chat_participants_invited
correspondingly.
0.4.5
0.4.4
- Fix build on Windows (see #107);
0.4.3
- Add support
spoiler
message type andprotect_content
field for various methods (see #103);
0.4.2
- Fix GHC 9.0 compilation (see #102 );
0.4.1
0.4
- Add Payments methods (see #93);
- Add Passport methods (see #90);
- Resolve discrepancies with Bot API 5.5 (see #87, #88)
- Make
startPolling
polymorphic (see #86); - Add Updating messages methods (see #85) ;
- Add missing methods (see #83, #84);
- Add
GameBot
(see #82, #95); - Allow return different types in
BotM
(see #79, #98); - Fix
UserId
integer overflow (see #78); - Upgrade
EchoBot
example with sticker replies (see #77); - Refactor file uploads (see #76);
- Add Stickers methods (see #72, #73, #74 and #75);
- Refactor
FileInfo
(see #71); - Add Game methods (see #70);
- Fix
MessageId
integer overflow (see #69); - Add missing types (see #66, #81);
0.3.8
- Fix notification disable mechanism in
sendDocument
function (see #54); - Implement
getFile
andsendPhoto
API methods (see #49);
0.3.7
- Add inline mode support (see #45);
0.3.6
0.3.5
- Restore backward compatibility with older GHCs (see #40);
0.3.4
0.3.3
- Derive Hashable for MessageId (see #36);
0.3.2
0.3.1
- Implement sendDocument function support. (see #31);
- Add Travis CI (see #32);
- Add MonadFail instance for UpdateParser (see #27);
0.3.0
- Add
underline
andstrikethrough
MessageEntityTypes
(see #25); - Fix for Stack 15 (see #24);
- Fix installation after breaking change in
servant-0.16
(see #21); - Add
phonenumber
type (see #23); - Add
cashtag
message entity type (close #19) (see #20); - Feat/kick chat member (see #17);
- Feat/delete message method (see #16);
- Fix
startBotAsync
, addprocessActionsIndefinitely
(see #12); - Add some badges to README (Hackage/Stackage/Travis) (see 11f13f3);
- Remove temporary
files/scripts
from repo (see 6bc9f48); - Add info about LambdaConf 2018 workshop and contributing (see 1ba4d95);
- Add
Data.Monoid
import to fix builds on GHC 8.2 (see c798001);
0.2.0
-
Major changes:
- Add bot jobs support (see
9e0424e
); - Add
Telegram.Bot.Simple.Debug
(see7db84c5
,49679d4
,5ba949b
); - Introduce
BotEnv
with model state and action queue (see98c869a
); - Add support for message editing (see
b7c83a4
); - Introduce
replyOrEdit
helper (seeecc21cd
); - Add useLatestUpdateInJobs helper to enable reply in jobs (see
385f9e6
,8a12ceb
,448bcd2
);
- Add bot jobs support (see
-
Minor changes:
- Add
getEnvToken
helper (seece7d1f7
); - Add
IsString
instance forTelegram.Token
(seef105bb9
); - Print Servant errors when
getUpdates
fails (seebc7c5bb
); - Split
Telegram.Bot.Simple
into several submodules (see8ed2783
); - Add
withEffect
helper inTelegram.Bot.Simple.Eff
(seeaebba52
); - More Haddock documentation;
- Add
-
Fixes: