Skip to main content

No project description provided

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytele-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

pytele-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pytele-0.1.0.tar.gz.

File metadata

  • Download URL: pytele-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.5 Windows/10

File hashes

Hashes for pytele-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8564fe93e42b43c7883bd2c7d5b23243de0635f3d7b9fb243fd951a0634f5bdc
MD5 68719a610baae45273211fd347f34d85
BLAKE2b-256 b1fcda1f3be4992775918db809e1f49950607618956375eb58b05c5c916d0f94

See more details on using hashes here.

File details

Details for the file pytele-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytele-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.5 Windows/10

File hashes

Hashes for pytele-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7aa8b11d52a2d749439c3e91064b8409b0b8a4d4dcf33f944d06b27c0a229cc
MD5 2e4832009095d586d004b63fd5587cb5
BLAKE2b-256 7cff9828ddc0dafd21baee7a16efe0ce69b6731727790304a8a247bdd7287579

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page