All Projects → g4s8 → teletakes

g4s8 / teletakes

Licence: MIT License
True Object-Oriented Telegram Bot Framework

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to teletakes

Novagram
An Object-Oriented PHP library for Telegram Bots
Stars: ✭ 112 (+522.22%)
Mutual labels:  telegram, oop
alleycat-reactive
A simple Python library to provide an API to implement the Reactive Object Pattern (ROP).
Stars: ✭ 15 (-16.67%)
Mutual labels:  oop
Battleship
An Object-Oriented VBA experiment
Stars: ✭ 66 (+266.67%)
Mutual labels:  oop
design-patterns
Simple examples of Design Patterns with PHP Examples
Stars: ✭ 75 (+316.67%)
Mutual labels:  oop
laravel-transporter
Transporter is a futuristic way to send API requests in PHP. This is an OOP approach to handling API requests.
Stars: ✭ 282 (+1466.67%)
Mutual labels:  oop
LMPHP
Multi-language management and support on the site.
Stars: ✭ 19 (+5.56%)
Mutual labels:  oop
Mastering-Javascript
📚 PinterCoding University. Author : Gun Gun Febrianza
Stars: ✭ 43 (+138.89%)
Mutual labels:  oop
ecasbot
EC AntiSpam bot for the Telegram messenger
Stars: ✭ 17 (-5.56%)
Mutual labels:  telegram
2801
Curso 2801 - Fundamentos do C#
Stars: ✭ 76 (+322.22%)
Mutual labels:  oop
oop-exercises
Exercises for those who want to learn Object Oriented Programming in C++ 🔥
Stars: ✭ 27 (+50%)
Mutual labels:  oop
OOP-JavaScript
Learn OOP JavaScript ⚡
Stars: ✭ 23 (+27.78%)
Mutual labels:  oop
FOODIE
Fortran Object-Oriented Differential-equations Integration Environment, FOODIE
Stars: ✭ 109 (+505.56%)
Mutual labels:  oop
pimf-framework
Micro framework for PHP that emphasises minimalism and simplicity
Stars: ✭ 42 (+133.33%)
Mutual labels:  oop
euler2D-kfvs-Fortran2003
2D solver for Euler equations in quadrilateral grid, using kinetic flux vector splitting scheme, written in OOP F2003
Stars: ✭ 17 (-5.56%)
Mutual labels:  oop
ro.py
ro.py is a modern, asynchronous Python 3 wrapper for the Roblox API.
Stars: ✭ 65 (+261.11%)
Mutual labels:  oop
JavaScript-Bootcamp
Complete Documentation For JavaScript Bootcamp Course By Osama Elzero.
Stars: ✭ 27 (+50%)
Mutual labels:  oop
unit-converter
Convert standard units from one to another with this easy to use, lightweight package
Stars: ✭ 104 (+477.78%)
Mutual labels:  oop
node-red-contrib-actionflows
Provides a set of nodes to enable an extendable design pattern for flows.
Stars: ✭ 38 (+111.11%)
Mutual labels:  oop
TelegramShillBot
A simple Telegram bot, written in Python, that you can use to shill (i.e. send messages) your token, or whatever, to channels.
Stars: ✭ 42 (+133.33%)
Mutual labels:  telegram
python-yamlable
A thin wrapper of PyYaml to convert Python objects to YAML and back
Stars: ✭ 28 (+55.56%)
Mutual labels:  oop

Teletakes

True Object-Oriented Telegram Framework with same design as in https://www.takes.org/

EO principles respected here DevOps By Rultor.com

CircleCI Build Status Build status

codecov Download Codacy Badge PDD status License

Install

Add teletakes as maven dependency and telegrambots dependency:

<dependency>
   <groupId>com.g4s8</groupId>
   <artifactId>teletakes</artifactId>
   <version>0.1</version> <!-- put latest version here -->
</dependency>
<dependency>
   <groupId>org.telegram</groupId>
   <artifactId>telegrambots</artifactId>
   <version>${telegram.version}</version>
</dependency>

Quick start

To start Telegram bot you need to instanciate BotSimple and register it as a bot via telegrambots library:

 new TelegramBotsApi().registerBot(
    new BotSimple(
      new TkFork(
        new FkMessage(
            "hello",
            req -> new RsText(
                new FormattedText(
                    "Hello %s", new RqUser(req).value().getFirstName()
                )
            )
        )
      )
    )
 );

Examples

Handle commands

This take answers for /version command:

new TkFork(
   new FkCommand(
     "/version"
     new TkText("1.0")
   )
)

Show keyboard

This take shows keyboard on user Telegram client:

new TkFixed(
    new RsReplyKeyboard(
        new RsText("Hello"),
        new ListOf<Iterable<Text>>(
            new ListOf<>(
                new TextOf("Menu"),
                new TextOf("Settings")
            )
        )
    )
)

Inline buttons

Telegram message can include "inline buttons" with callbacks, where callback is a strings which will be sent sent to a bot on button click. This take will show a button and handle its clicks:

new TkFork(
    new FkMessage(
        Pattern.compile(".*"),
        new TkFixed(
            new RsInlineKeyboard(
                new RsText("inline buttons"),
                new ListOf<Iterable<Map.Entry<String, String>>>(
                    new ListOf<Map.Entry<String, String>>(
                        new MapEntry<>("Confirm", "click:on-confirm"),
                        new MapEntry<>("Cancel", "click:on-cancel")
                    )
                )
            )
        )
    ),
    new FkCallbackQuery(
        "click:on-confirm",
        new TkText("Confirmed")
    ),
    new FkCallbackQuery(
        "click:on-cancel",
        new TkText("Canceled")
    )
)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].