Skip to main content

TeleSendTime

TeleSendTime is a Python module for Telegram message automation.

Installation

Use the package manager pip to install TeleSendTime.

pip install TeleSendTime
# or using Git
pip install git+https://gitlab.com/DarkSuniuM/TeleSendTime.git

Usage

# template.txt
# "$" prefixed words are variables
BTC Rate (USD): $rate
# app.py

import requests

from tele_sendtime import Automation
from tele_sendtime import load_template


automation = Automation('MY_BOT_TOKEN')


# chat_id => Chat ID or Channel Username (Note: You can use username only for channels)
# interval in seconds.
@automation.job(chat_id='@my_channel_username', template=load_template('template.txt'), interval=60)
def send_btc_rate_in_usd():
    # Sample API Call
    req = requests.get('https://api.coindesk.com/v1/bpi/currentprice/USD.json')
    rate = req.json()['bpi']['USD']['rate_float']

    # return type should be a list of strings or dictianories
    # Use dict when there is a template
    return [{'rate': rate}] 


@automation.job(chat_id='@my_channel_username', interval=60)
def send_btc_rate_in_eur():
    # Sample API Call
    req = requests.get('https://api.coindesk.com/v1/bpi/currentprice/EUR.json')
    rate = req.json()['bpi']['EUR']['rate_float']

    # When using String, Template get's ignored!
    return [f'BTC Price (EURO): {rate}']


# Run the automation bot.
automation.run()

To Do

  • Add Documentation
  • Improve Concurrency
  • Add Logging
  • Add support for other message types (photo, audio, document)
  • Add Tests

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

GNU LGPLv3

Metadata

Release files for TeleSendTime 0.1.2

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

Source distribution (sdist)

Source distribution for TeleSendTime 0.1.2
File Size Uploaded Provenance Actions
TeleSendTime-0.1.2.tar.gz 4.4 kB Without provenance Details for TeleSendTime-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 13.1 kB

Release files / TeleSendTime-0.1.2.tar.gz

Download URL TeleSendTime-0.1.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3bb984b6eaa2cd24b1509f5cc68aaefaec768bdc360210ea20dd6fec7d4554db
BLAKE2b-256 checksum
How to use checksums
f98217c3686d5c99ec2120b7f8dd6cb55f3bd04e4e8f57cd8178d982744bcff7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.1 CPython/3.8.5

Release files / TeleSendTime-0.1.2-py3-none-any.whl

Download URL TeleSendTime-0.1.2-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9cf09bc870be7549469b91f452d66f8d03c88a1b9ec6fd6771c747575bf13a0
BLAKE2b-256 checksum
How to use checksums
1f2aa2b85dbf85744656c1c38aae3f5bbdf02482ce54dc5b5c185e7a1a58af77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.1 CPython/3.8.5

Security for TeleSendTime 0.1.2

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.

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