telega alternatives and similar packages
Based on the "Control" category
Do you think we are missing an alternative of telega or a related project?
Inline Telegram Bot API library
Work in progress, there is an application for testing design of this library: https://github.com/iokasimov/elections-bot
This library provides ORM-like toolkit to deal with methods of Telegram Bot API - types and classes were designed in terms of
Objects and their
Update: object that webhook consumes, can be either an incoming
Movingin/out some group chat.
Message: every object contains
Content, can be either
Content: can be either
File: Can be either
Origin: indicates where is message from, contains
Callback: this is what webhook consumes on pressing inline keyboard's button.
Group: can be either
Super, contains chat ID and title.
Moving: indicates which
Senderleaved some chat or which
Senders joined, also contains
Sender: can be either a
Member: shows the status of a bot or user in group chat, contains
Accessible: provides lens for objects within other objects.
Identifiable: provides identification of objects to use it for requests.
persistmethods that returns you value of some type on success. The "on success" definition is rather vague, for example: if you try to edit object and it remains the same, nothing will returns. Use
persist_to not decode API answer (because if decoding fails the next applicative or monadic action will not happen).
Available persistent actions over objects:
Reply: everything that you can
See payload and returning value in
Also, you can
Also, there are special persistent actions for chat members:
Kick: kick user from group, user can not return unless unbanned first
Restrict: change what some member in group can do.
Promote: change what some admin in group can do.
Sending inline keyboard
let text = "Just click any button..." let button1 = Button "Press me!" $ Callback "1" let button2 = Button "Or press me!" $ Callback "2" let button3 = Button "No, press me!" $ Callback "3" let keyboard = Inline [button1, button2, button3] void . persist . Send chat_id $ text :&: keyboard
Handling pressing buttons with notification
webhook (Query _ (Datatext cbq_id _ _ bn)) = do let text = "The button you pressed is: " <> bn persist $ Trigger @Notification cbq_id text
Deleting all incoming messages
webhook (Incoming _ msg) = do let chat_id = ident $ access @Origin msg persist (Delete @Message chat_id $ ident msg)