Skip to main content

A Telegram bot for remote command execution with optional user authorization, customizable command validation, and customizable messages.

Project description

Remote Command Bot

A Telegram bot for remote command execution with optional user authorization, customizable command validation, and customizable messages.

Installation

pip install teleser

Usage

With custom messages and user authorization:

from teleser import TeleSerBot

AUTHORIZED_USERS = [123456789, 987654321]  # Replace with actual Telegram user IDs

CUSTOM_DANGEROUS_PATTERNS = [r"your_custom_pattern"]
CUSTOM_ALLOWED_COMMANDS = ["your_custom_command"]

CUSTOM_MESSAGES = {
    "start": "Welcome! You can use these commands: {allowed_commands}",
    "unauthorized": "Access denied. You are not authorized.",
    "command_result": "Here's the output:\n{result}",
}

def main():
    bot = TeleSerBot(
        "TELEGRAM_BOT_TOKEN",
        authorized_users=AUTHORIZED_USERS,
        dangerous_patterns=CUSTOM_DANGEROUS_PATTERNS,
        allowed_commands=CUSTOM_ALLOWED_COMMANDS,
        custom_messages=CUSTOM_MESSAGES
    )
    bot.run_sync()

if __name__ == '__main__':
    main()

Without customization (default settings):

from teleser import TeleSerBot

def main():
    bot = TeleSerBot("TELEGRAM_BOT_TOKEN")
    bot.run_sync()


if __name__ == '__main__':
    main()

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

teleser-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

teleser-0.1.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file teleser-0.1.2.tar.gz.

File metadata

  • Download URL: teleser-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-45-generic

File hashes

Hashes for teleser-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6793485a512168a3aad3784ac6e9ebc590954ce87d308878e2686dc511860503
MD5 d8a2121e19326b5454f46c875bfdd06a
BLAKE2b-256 9e3b13ed867e49eefe6e140075c3ad635e2f45090fb2ee52af99ba8868baf257

See more details on using hashes here.

File details

Details for the file teleser-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: teleser-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-45-generic

File hashes

Hashes for teleser-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cf21f24c3d7823a7b0333a0fbdf60b430498be07e5ffc7fdaba07512fb183741
MD5 3ba92f659f7fa6ecef1761112e202105
BLAKE2b-256 4cb19889eefaf9b0a178cd67744ee4fdc57af6d6f55d4670d04b944d0ec9b8b3

See more details on using hashes here.

Supported by

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