terminalbot


Nameterminalbot JSON
Version 2.0.0 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-30 17:11:42
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 2.0.0

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")
```
- For more projects, please visit our site : <a href="https://mrfidal.in/cyber-security/terminalbot/projects">Link</a>

## 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/82/4e/b1d0f6dac6130aba3e8a5c3eeb51af95fa29a3a04f86621937f5e84e088a/terminalbot-2.0.0.tar.gz",
    "platform": null,
    "description": "# TerminalBot 2.0.0\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- For more projects, please visit our site : <a href=\"https://mrfidal.in/cyber-security/terminalbot/projects\">Link</a>\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": "2.0.0",
    "project_urls": {
        "Homepage": "https://mrfidal.in/cyber-security/terminalbot"
    },
    "split_keywords": [
        "telegram",
        "bot",
        "messaging",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89357a5db66bb73a284c05ba6ce6e8488363b1beb6a477e20e153e68ff8fad8e",
                "md5": "eb1a442ce7da68853e4fac316911ced7",
                "sha256": "807f0ad9ca4f63dbc8e7d67528e06e77e5253ab68405ab2aa89797f301f93813"
            },
            "downloads": -1,
            "filename": "terminalbot-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "eb1a442ce7da68853e4fac316911ced7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6483,
            "upload_time": "2024-06-30T17:11:40",
            "upload_time_iso_8601": "2024-06-30T17:11:40.546262Z",
            "url": "https://files.pythonhosted.org/packages/89/35/7a5db66bb73a284c05ba6ce6e8488363b1beb6a477e20e153e68ff8fad8e/terminalbot-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "824eb1d0f6dac6130aba3e8a5c3eeb51af95fa29a3a04f86621937f5e84e088a",
                "md5": "7e286be72fd7e6c67345e68e4e3f94fc",
                "sha256": "d7bec5477cc6e9b9381433e99d037c03cff9ce9dfc87bd06d1148cbb09f5bb40"
            },
            "downloads": -1,
            "filename": "terminalbot-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7e286be72fd7e6c67345e68e4e3f94fc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6477,
            "upload_time": "2024-06-30T17:11:42",
            "upload_time_iso_8601": "2024-06-30T17:11:42.879057Z",
            "url": "https://files.pythonhosted.org/packages/82/4e/b1d0f6dac6130aba3e8a5c3eeb51af95fa29a3a04f86621937f5e84e088a/terminalbot-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-30 17:11:42",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "terminalbot"
}
        
Elapsed time: 0.27178s