Skip to main content

Simplest telegram bot

The simplest telegram bot out there that could be embedded into your apps as a notification service and could listen and execute remote commands.

Installation

pip install pytele

Introduction

The simplest telegram bot out there that could be embedded into your apps as a notification service and can listen and execute remote commands.

from telegram import Bot

bot = Bot() # takens the BOT's token from environment variables - TELEGRAM_BOT_TOKEN
bot.send_msg(to='chait_id', msg='your message')

The bot could listen and execute remote commands. In order to get started, please create a .yaml file with the following structure:

# commands.yaml

commands:
  1:
    name: Git status
    description: Get status of git from current directory
    command: /gitstatus
    action: git status
  2:
    name: Linux list
    description: List all file under current directory
    command: /ls
    action: ls

The action field should be exactly the same as the command executed on the CLI, e.g.

action: ls - will list current directory
action: ls /etc - will list all files under /etc

Once created, register the commands via register_commands(...) method and start listening. The specified interval, instructs the bot at what intervals to poll messages from telegram servers. Defaults to 3 but could be overwritten.

bot.register_commands('example_commands.yaml')
bot.listen(interval=5)

Metadata

Release files for pytele 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytele 0.1.0
File Size Uploaded Provenance Actions
pytele-0.1.0.tar.gz 5.2 kB Without provenance Details for pytele-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytele 0.1.0
File Interpreter ABI Platform Actions
pytele-0.1.0-py3-none-any.whl Python 3 none any Details for pytele-0.1.0-py3-none-any.whl

Total release size: 10.8 kB

Release files / pytele-0.1.0.tar.gz

Download URL pytele-0.1.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8564fe93e42b43c7883bd2c7d5b23243de0635f3d7b9fb243fd951a0634f5bdc
BLAKE2b-256 checksum
How to use checksums
b1fcda1f3be4992775918db809e1f49950607618956375eb58b05c5c916d0f94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.10.5 Windows/10

Release files / pytele-0.1.0-py3-none-any.whl

Download URL pytele-0.1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b7aa8b11d52a2d749439c3e91064b8409b0b8a4d4dcf33f944d06b27c0a229cc
BLAKE2b-256 checksum
How to use checksums
7cff9828ddc0dafd21baee7a16efe0ce69b6731727790304a8a247bdd7287579
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0 CPython/3.10.5 Windows/10

Security for pytele 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page