Giter Site home page Giter Site logo

telegram_bot_helper's Introduction

telegram-bot-helper

Some utils to ease the connection with Telegram bot API

They include a TelegramAPIHelper class that will help you to manage retrieving and sending messages through the Telegram API. A Emoji class that should (when added more) give you a easy way to send emoticons. And a MessageProcessor/Job classes that will help you to handle some common bot answering.

JOB DESCRIPTION

The kind of jobs that this library would handle should be described in a JSON file this way:

[
{
    "job_id": "info",
    "message_type": "command",
    "keywords": ["start", "info"],
    "countdown": 3,
    "minutes_timeout": 20,
    "job_action": "phrase",
    "data": "We are working on it. In the meanwhile you will have to look at the code."
}
]
  • job_id: is an optional field to name the job
  • message_type: Indicates the type of messages that would trigger the action. There are three currently suported message types
  • user_message: After a user has written a message
  • command: After anyone has invoked our bot command /command
  • repeated_message: After a user(s) has(ve) written a message some number of times
  • keywords: The command or text we are looking for
  • minutes_timeout: For repeated_message the number of minutes within the keywords have to been written
  • countdown: For repeated_message the number of times the keywords have to appear
  • frequency: Return the job result only this % of times
  • job_action: The action triggered. There are currently five kind of job_actions suported:
  • phrase: Returns the data string
  • random_phrase: Returns a random string from the data strings list
  • blog_link: Returns a non used (in 24 hours) blog link from the RSS present at data field
  • audio: Returns a voice message already uploaded to Telegram servers which id is stored at data field
  • custom_poll: Returns a string (first item of the string list) with a custom keyboard of answers that are the rest of the string list
  • data: The data used to return a value

telegram_bot_helper's People

Contributors

figarocorso avatar papajulio avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

papajulio

telegram_bot_helper's Issues

Improve message matching

It currently matches a "needle" if it is at the beginning of the message, or at the end, or inside it between blank spaces, or the message is the needle.

We should use re to obtain a better matching procedure.

Add unittests

As the project is gaining more complexity it starts being mandatory to have some kind of quick/automated testing.

I've collected some messages retrieved from Tg API, but we can collect easily as many as we may need.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.