Giter Club home page Giter Club logo

eva-telegram's Introduction

eva-telegram

Telegram bot extension for EVA ICS LM PLC

Requires EVA ICS 3.3 or newer.

Install

  • install tebot module

  • put telegram.py to /opt/eva/xc/extensions/

  • put sample configuration file telegram.yml to /opt/eva/etc/

  • modify sample configuration

  • load extension:

eva lm ext load tbot telegram -y

Macro execution

Start chat with your bot and follow the instructions.

  • if macros is started as "/macro some args", args are added to macro arguments.

  • current chat_id is passed into macro kwargs and may be used later.

Sending messages from macros

When loaded, e.g. as tbot, extension provides functions:

  • tbot_send
  • tbot_send_photo
  • tbot_send_video
  • tbot_send_audio
  • tbot_send_document

Function arguments are the same as for https://pypi.org/project/tebot/, refer to module documentation for more info, except first argument should be either API key ID or list of API key IDs. If "*" is specified, broadcast message is sent.

Examples

Send a message only to user who called macro

# chat_id variable is available in macro, as it was sent in kwargs
tbot_send(None, 'this is a reply', chat_id=chat_id)

Send broadcast message to all

tbot_send('*', 'this is a test')

Send image to users with API key IDs "operator" and "operator2":

with open('image.jpg', 'rb') as fh:
    tbot_send(['operator', 'operator2'], media=fh.read())

Command autocomplete

After log in, use /getcommands command, go to Telegram BotFather, enter /setcommands and paste it as-is.

Exclude command from the keyboard

To exclude command from the inline keyboard, put dot before macro in "inline-keyboard" section of the configuration.

Security

  • using master key is not recommended

  • write dedicated macros

  • if possible - use dedicated instance of LM PLC

eva-telegram's People

Contributors

divi255 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.