terminalbot


Nameterminalbot JSON
Version 1.16.8 PyPI version JSON
download
home_pagehttps://mrfidal.in/cyber-security/terminalbot
SummaryA package to interact with a Telegram group by sending and receiving messages
upload_time2024-06-28 14:37:17
maintainerNone
docs_urlNone
authorFidal
requires_python>=3.6
licenseNone
keywords telegram bot messaging automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TerminalBot

TerminalBot is a powerful and easy-to-use Python package for interacting with Telegram groups. Whether you need to automate message sending, receive and process messages, or create complex workflows, TerminalBot provides a simple and effective solution.

## Introduction

Welcome to TerminalBot! If you've ever wished for an easier way to manage your interactions with Telegram groups, you've come to the right place. TerminalBot is designed with simplicity and efficiency in mind, making it the perfect tool for both beginners and advanced users. 
Imagine being able to automate repetitive tasks, send notifications, and interact with your Telegram community seamlessly from your terminal or Python scripts. With TerminalBot, you can do all this and more, without the hassle of complex setups or tedious coding. 
Our goal is to empower you with a tool that simplifies your workflow, saves you time, and enhances your productivity. TerminalBot leverages the full capabilities of the Telegram Bot API, providing a robust and reliable interface for your needs. Whether you're a developer looking to integrate Telegram into your applications, or a power user seeking to streamline your group management, TerminalBot has you covered.

## Features

- **Easy Installation**: Quickly install TerminalBot using pip.
- **Simple API**: Easy-to-use functions for sending and receiving messages.
- **Command Line Interface**: Convenient CLI for quick operations without writing code.
- **State Tracking**: Automatically tracks the last processed message to avoid duplicates.
- **Configurable**: Easily configure your bot with a JSON file for persistent state management.

## Benefits

- **Automation**: Automate your workflows by integrating TerminalBot with other systems.
- **Efficiency**: Save time by handling repetitive tasks through automated messaging.
- **Reliability**: Ensure messages are only processed once with state tracking.
- **Flexibility**: Use TerminalBot in your Python scripts or from the command line.
- **Scalability**: Scale your operations by leveraging the power of Telegram bots for large groups.

## Why Use TerminalBot?

- **Simplicity**: With a straightforward API and CLI, TerminalBot is easy to use even for beginners.
- **Versatility**: Suitable for various use cases, including notifications, alerts, customer support, and more.
- **Integration**: Seamlessly integrate with other Python packages and tools to build comprehensive solutions.
- **Community Support**: Join a growing community of users who leverage TerminalBot for their projects.

## Telegram API Support

TerminalBot fully supports all types and methods of the Telegram Bot API 7.4, allowing you to utilize the full capabilities of the Telegram platform. This includes sending and receiving messages, managing groups and channels, handling multimedia content, and more.

## Installation

You can install `terminalbot` using pip:

```bash
pip install terminalbot
```

## Usage Examples

### Using TerminalBot from the Command Line
### Receive a message

```bash
message=$(terminalbot --token "token" --id "@username")
echo "message is : $message"
```
- Replace <token> with your bot token and <username> with your group chat ID.

#### Receive and automatically send a response
```bash
message=$(terminalbot --token "token" --id "@username" --message-receive "Your message received")
echo "message is: $message"
```
- This command will automatically send the specified response message after receiving a message.

#### Send a message
```bash
terminalbot --token "token" --id "@username" --message "Hello world"
echo "Your message sent to the Telegram group"
```
- This command will automatically send the specified message to the Telegram group.

### 1. Receiving Messages

```python
import terminalbot

telegram_group = '@username'
telegram_bot = 'YOUR_BOT_TOKEN_HERE'

# Get the latest message
chat = terminalbot.get_message(telegram_bot, telegram_group)
if chat:
    print(f"Message received: {chat}")
else:
    print("No new messages")
```

### 2. Sending Messages

```python
import terminalbot

telegram_group = '@username'
telegram_bot = 'YOUR_BOT_TOKEN_HERE'

# Send a message
message_to_send = "Hello from terminalbot!"
terminalbot.send_message(telegram_bot, telegram_group, message_to_send)
print(f"Sent message: {message_to_send}")
```

### 3. Receiving and Executing Commands

```python
import terminalbot
import os

telegram_group = '@username'
telegram_bot = 'YOUR_BOT_TOKEN_HERE'

# Get the latest message and execute it as a command
chat = terminalbot.get_message(telegram_bot, telegram_group)
if chat:
    print(f"Executing command: {chat}")
    os.system(chat)
else:
    print("No new commands")
```

### 4. Handling Continuous Loop with Message Processing

```python
import terminalbot
import time

telegram_group = '@username'
telegram_bot = 'YOUR_BOT_TOKEN_HERE'

def main_loop(bot_token, group_chat_id):
    bot = terminalbot.TelegramBot(bot_token, group_chat_id)
    
    while True:
        message = bot.get_message()
        if message:
            print(f"Message received: {message}")
            if message.lower() == "stop terminalbot":
                print("Stopping bot.")
                break
            os.system(message)  # Example: Execute a command received via message
            print(f"Executed command: {message}")
        time.sleep(1)

if __name__ == '__main__':
    main_loop(telegram_bot, telegram_group)
```

### 5. Receiving Messages and Sending Replies

```python
import terminalbot
import os

telegram_group = '@username'
telegram_bot = 'YOUR_BOT_TOKEN_HERE'

# Get the latest message
chat = terminalbot.get_message(telegram_bot, telegram_group)
if chat:
    # Execute the received command
    os.system(chat)
    print(f"Message received: {chat}")
    
    # Send a reply message with the executed command
    message_to_send = f"Executed command: {chat}"
    terminalbot.send_message(telegram_bot, telegram_group, message_to_send)
else:
    print("No new commands or messages")
```

## Thank You

Thank you for using TerminalBot! We hope this package makes your interaction with Telegram groups easier and more efficient. If you have any suggestions or feature requests, please don't hesitate to reach out.

            

Raw data

            {
    "_id": null,
    "home_page": "https://mrfidal.in/cyber-security/terminalbot",
    "name": "terminalbot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "telegram bot messaging automation",
    "author": "Fidal",
    "author_email": "mrfidal@proton.me",
    "download_url": "https://files.pythonhosted.org/packages/09/5d/b23f0576ef6e8c3b5727452978726918dd5e0a75d4bd53b1f7daa9cefb12/terminalbot-1.16.8.tar.gz",
    "platform": null,
    "description": "# TerminalBot\r\n\r\nTerminalBot is a powerful and easy-to-use Python package for interacting with Telegram groups. Whether you need to automate message sending, receive and process messages, or create complex workflows, TerminalBot provides a simple and effective solution.\r\n\r\n## Introduction\r\n\r\nWelcome to TerminalBot! If you've ever wished for an easier way to manage your interactions with Telegram groups, you've come to the right place. TerminalBot is designed with simplicity and efficiency in mind, making it the perfect tool for both beginners and advanced users. \r\nImagine being able to automate repetitive tasks, send notifications, and interact with your Telegram community seamlessly from your terminal or Python scripts. With TerminalBot, you can do all this and more, without the hassle of complex setups or tedious coding. \r\nOur goal is to empower you with a tool that simplifies your workflow, saves you time, and enhances your productivity. TerminalBot leverages the full capabilities of the Telegram Bot API, providing a robust and reliable interface for your needs. Whether you're a developer looking to integrate Telegram into your applications, or a power user seeking to streamline your group management, TerminalBot has you covered.\r\n\r\n## Features\r\n\r\n- **Easy Installation**: Quickly install TerminalBot using pip.\r\n- **Simple API**: Easy-to-use functions for sending and receiving messages.\r\n- **Command Line Interface**: Convenient CLI for quick operations without writing code.\r\n- **State Tracking**: Automatically tracks the last processed message to avoid duplicates.\r\n- **Configurable**: Easily configure your bot with a JSON file for persistent state management.\r\n\r\n## Benefits\r\n\r\n- **Automation**: Automate your workflows by integrating TerminalBot with other systems.\r\n- **Efficiency**: Save time by handling repetitive tasks through automated messaging.\r\n- **Reliability**: Ensure messages are only processed once with state tracking.\r\n- **Flexibility**: Use TerminalBot in your Python scripts or from the command line.\r\n- **Scalability**: Scale your operations by leveraging the power of Telegram bots for large groups.\r\n\r\n## Why Use TerminalBot?\r\n\r\n- **Simplicity**: With a straightforward API and CLI, TerminalBot is easy to use even for beginners.\r\n- **Versatility**: Suitable for various use cases, including notifications, alerts, customer support, and more.\r\n- **Integration**: Seamlessly integrate with other Python packages and tools to build comprehensive solutions.\r\n- **Community Support**: Join a growing community of users who leverage TerminalBot for their projects.\r\n\r\n## Telegram API Support\r\n\r\nTerminalBot fully supports all types and methods of the Telegram Bot API 7.4, allowing you to utilize the full capabilities of the Telegram platform. This includes sending and receiving messages, managing groups and channels, handling multimedia content, and more.\r\n\r\n## Installation\r\n\r\nYou can install `terminalbot` using pip:\r\n\r\n```bash\r\npip install terminalbot\r\n```\r\n\r\n## Usage Examples\r\n\r\n### Using TerminalBot from the Command Line\r\n### Receive a message\r\n\r\n```bash\r\nmessage=$(terminalbot --token \"token\" --id \"@username\")\r\necho \"message is : $message\"\r\n```\r\n- Replace <token> with your bot token and <username> with your group chat ID.\r\n\r\n#### Receive and automatically send a response\r\n```bash\r\nmessage=$(terminalbot --token \"token\" --id \"@username\" --message-receive \"Your message received\")\r\necho \"message is: $message\"\r\n```\r\n- This command will automatically send the specified response message after receiving a message.\r\n\r\n#### Send a message\r\n```bash\r\nterminalbot --token \"token\" --id \"@username\" --message \"Hello world\"\r\necho \"Your message sent to the Telegram group\"\r\n```\r\n- This command will automatically send the specified message to the Telegram group.\r\n\r\n### 1. Receiving Messages\r\n\r\n```python\r\nimport terminalbot\r\n\r\ntelegram_group = '@username'\r\ntelegram_bot = 'YOUR_BOT_TOKEN_HERE'\r\n\r\n# Get the latest message\r\nchat = terminalbot.get_message(telegram_bot, telegram_group)\r\nif chat:\r\n    print(f\"Message received: {chat}\")\r\nelse:\r\n    print(\"No new messages\")\r\n```\r\n\r\n### 2. Sending Messages\r\n\r\n```python\r\nimport terminalbot\r\n\r\ntelegram_group = '@username'\r\ntelegram_bot = 'YOUR_BOT_TOKEN_HERE'\r\n\r\n# Send a message\r\nmessage_to_send = \"Hello from terminalbot!\"\r\nterminalbot.send_message(telegram_bot, telegram_group, message_to_send)\r\nprint(f\"Sent message: {message_to_send}\")\r\n```\r\n\r\n### 3. Receiving and Executing Commands\r\n\r\n```python\r\nimport terminalbot\r\nimport os\r\n\r\ntelegram_group = '@username'\r\ntelegram_bot = 'YOUR_BOT_TOKEN_HERE'\r\n\r\n# Get the latest message and execute it as a command\r\nchat = terminalbot.get_message(telegram_bot, telegram_group)\r\nif chat:\r\n    print(f\"Executing command: {chat}\")\r\n    os.system(chat)\r\nelse:\r\n    print(\"No new commands\")\r\n```\r\n\r\n### 4. Handling Continuous Loop with Message Processing\r\n\r\n```python\r\nimport terminalbot\r\nimport time\r\n\r\ntelegram_group = '@username'\r\ntelegram_bot = 'YOUR_BOT_TOKEN_HERE'\r\n\r\ndef main_loop(bot_token, group_chat_id):\r\n    bot = terminalbot.TelegramBot(bot_token, group_chat_id)\r\n    \r\n    while True:\r\n        message = bot.get_message()\r\n        if message:\r\n            print(f\"Message received: {message}\")\r\n            if message.lower() == \"stop terminalbot\":\r\n                print(\"Stopping bot.\")\r\n                break\r\n            os.system(message)  # Example: Execute a command received via message\r\n            print(f\"Executed command: {message}\")\r\n        time.sleep(1)\r\n\r\nif __name__ == '__main__':\r\n    main_loop(telegram_bot, telegram_group)\r\n```\r\n\r\n### 5. Receiving Messages and Sending Replies\r\n\r\n```python\r\nimport terminalbot\r\nimport os\r\n\r\ntelegram_group = '@username'\r\ntelegram_bot = 'YOUR_BOT_TOKEN_HERE'\r\n\r\n# Get the latest message\r\nchat = terminalbot.get_message(telegram_bot, telegram_group)\r\nif chat:\r\n    # Execute the received command\r\n    os.system(chat)\r\n    print(f\"Message received: {chat}\")\r\n    \r\n    # Send a reply message with the executed command\r\n    message_to_send = f\"Executed command: {chat}\"\r\n    terminalbot.send_message(telegram_bot, telegram_group, message_to_send)\r\nelse:\r\n    print(\"No new commands or messages\")\r\n```\r\n\r\n## Thank You\r\n\r\nThank you for using TerminalBot! We hope this package makes your interaction with Telegram groups easier and more efficient. If you have any suggestions or feature requests, please don't hesitate to reach out.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A package to interact with a Telegram group by sending and receiving messages",
    "version": "1.16.8",
    "project_urls": {
        "Homepage": "https://mrfidal.in/cyber-security/terminalbot"
    },
    "split_keywords": [
        "telegram",
        "bot",
        "messaging",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6287b74b3fffbd130a5849cf24b80fce7ee544f62967efa287bb80eb974d077d",
                "md5": "d4c33327162e720faabc2daaf8798de3",
                "sha256": "87fe55bafd1f5c57880553b7374d3780633721f9bbdbe9cd5f28e58626a93424"
            },
            "downloads": -1,
            "filename": "terminalbot-1.16.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d4c33327162e720faabc2daaf8798de3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6303,
            "upload_time": "2024-06-28T14:37:15",
            "upload_time_iso_8601": "2024-06-28T14:37:15.223402Z",
            "url": "https://files.pythonhosted.org/packages/62/87/b74b3fffbd130a5849cf24b80fce7ee544f62967efa287bb80eb974d077d/terminalbot-1.16.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "095db23f0576ef6e8c3b5727452978726918dd5e0a75d4bd53b1f7daa9cefb12",
                "md5": "0cb2b720653d44a3bf7ea0eabea0844a",
                "sha256": "1efc42cafa7e74b5b0ca4175e7a2976d323ea8cd8d7e87a4b751c8e04fb83c1c"
            },
            "downloads": -1,
            "filename": "terminalbot-1.16.8.tar.gz",
            "has_sig": false,
            "md5_digest": "0cb2b720653d44a3bf7ea0eabea0844a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6288,
            "upload_time": "2024-06-28T14:37:17",
            "upload_time_iso_8601": "2024-06-28T14:37:17.201141Z",
            "url": "https://files.pythonhosted.org/packages/09/5d/b23f0576ef6e8c3b5727452978726918dd5e0a75d4bd53b1f7daa9cefb12/terminalbot-1.16.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-28 14:37:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "terminalbot"
}
        
Elapsed time: 0.40615s