All Projects → ruslanys → Telegraff

ruslanys / Telegraff

Licence: apache-2.0
Kotlin DSL для разработки Telegram ботов

Programming Languages

kotlin
9241 projects
dsl
153 projects

Projects that are alternatives of or similar to Telegraff

Telegrambots
Java library to create bots using Telegram Bots API
Stars: ✭ 2,728 (+2136.07%)
Mutual labels:  telegram-bot, spring-boot, telegram
Telegram Spring Boot Starter
Telegram Bot API Spring Boot Starter
Stars: ✭ 79 (-35.25%)
Mutual labels:  telegram-bot, spring-boot, telegram
Telegram Bot
Telegram Bot using AWS API Gateway and AWS Lambda
Stars: ✭ 96 (-21.31%)
Mutual labels:  telegram-bot, telegram
Osint San
Framework для сбора данных из открытых источников. В Framework используется большое количество API, их необходимо зарегистрировать самому.​
Stars: ✭ 99 (-18.85%)
Mutual labels:  framework, telegram
Telegram Bot Github
Allows to you receive GitHub notifications right in the Telegram
Stars: ✭ 103 (-15.57%)
Mutual labels:  telegram-bot, telegram
Libtelegram
Fast, efficient, header-only C++ Telegram bot API library using polling or FastCGI
Stars: ✭ 88 (-27.87%)
Mutual labels:  telegram-bot, telegram
Tgdr
Telegram directory to discover channels, bots and groups.
Stars: ✭ 91 (-25.41%)
Mutual labels:  telegram-bot, telegram
Easyfxml
A collection of tools and libraries for easier development on the JavaFX platform!
Stars: ✭ 102 (-16.39%)
Mutual labels:  framework, spring-boot
Awesome Telegram Cn
telegram 开发资源、机器人资源整理
Stars: ✭ 78 (-36.07%)
Mutual labels:  telegram-bot, telegram
Zanzara
Asynchronous PHP Telegram Bot Framework built on top of ReactPHP
Stars: ✭ 107 (-12.3%)
Mutual labels:  telegram-bot, telegram
Hackernewsbot
📰 Telegram bot that posts new hot stories from Hacker News to telegram channel
Stars: ✭ 103 (-15.57%)
Mutual labels:  telegram-bot, telegram
Mattata
A powerful, plugin-based, multi-purpose Telegram bot designed to serve a wide variety of purposes
Stars: ✭ 107 (-12.3%)
Mutual labels:  telegram-bot, telegram
Nazurin
🎉 Images collection done right. Telegram 图片收藏机器人 / A Telegram bot which helps you collect ACG illustrations.
Stars: ✭ 88 (-27.87%)
Mutual labels:  telegram-bot, telegram
Daysandbox bot
Telegram bot that deletes messages with URL from users joined in less than 24 hours
Stars: ✭ 82 (-32.79%)
Mutual labels:  telegram-bot, telegram
Telebot.nim
Async client for Telegram Bot API in pure Nim [Bot API 5.1]
Stars: ✭ 93 (-23.77%)
Mutual labels:  telegram-bot, telegram
Integram
Integrate Telegram into your workflow – Trello, Gitlab, Bitbucket and other bots
Stars: ✭ 1,365 (+1018.85%)
Mutual labels:  telegram-bot, telegram
Telegram Clonebot
Simple Bot to clone Google Drive Files (or Folders) to your Team Drive[or Normal Drive]. P.S This is not a Mirror Bot. Enjoy ✌🏻
Stars: ✭ 114 (-6.56%)
Mutual labels:  telegram-bot, telegram
Turibot
TuriBot is a simple way to communicate with Telegram APIs in PHP
Stars: ✭ 68 (-44.26%)
Mutual labels:  telegram-bot, telegram
Telegram.bot.framework
Simple framework for building Telegram bots
Stars: ✭ 73 (-40.16%)
Mutual labels:  telegram-bot, telegram
Vk To Telegram Bot
Bot for auto-reposting posts from VK to Telegram channel
Stars: ✭ 103 (-15.57%)
Mutual labels:  telegram-bot, telegram

Telegraff

Подключение

repositories {
    maven {
        url "https://dl.bintray.com/ruslanys/maven"
    }
}

Gradle:

compile("me.ruslanys.telegraff:telegraff-starter:1.0.0")

Maven:

<dependency>
    <groupId>me.ruslanys.telegraff</groupId>
    <artifactId>telegraff-starter</artifactId>
    <version>1.0.0</version>
</dependency>

Настройка

telegram.access-key=                  # api key
telegram.mode=                        # polling (default), webhook
telegram.webhook-base-url=            # required for webhook mode
telegram.webhook-endpoint-url=        # optional

Использование

Положите файл с расширением .kts в папку c ресурсами handlers: resources/handlers/ExampleHandler.kts.

enum class PaymentMethod {
    CARD, CASH
}

handler("/taxi", "такси") {
    step<String>("locationFrom") {
        question {
            MarkdownMessage("Откуда поедем?")
        }
    }

    step<String>("locationTo") {
        question {
            MarkdownMessage("Куда поедем?")
        }
    }

    step<PaymentMethod>("paymentMethod") {
        question {
            MarkdownMessage("Оплата картой или наличкой?", "Картой", "Наличкой")
        }

        validation {
            when (it.toLowerCase()) {
                "картой" -> PaymentMethod.CARD
                "наличкой" -> PaymentMethod.CASH
                else -> throw ValidationException("Пожалуйста, выбери один из вариантов")
            }
        }
    }

    process { state, answers ->
        val from = answers["locationFrom"] as String
        val to = answers["locationTo"] as String
        val paymentMethod = answers["paymentMethod"] as PaymentMethod

        // Business logic

        MarkdownMessage("Заказ принят. Поедем из $from в $to. Оплата $paymentMethod.")
    }
}

Устройство

Обработка сообщений

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].