telegramid


Nametelegramid JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/ByteBreach/telegramid
SummaryA package to fetch Telegram group chat ID, user ID, username, and message info
upload_time2024-06-30 05:08:22
maintainerNone
docs_urlNone
authorFidal
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # telegramid

`telegramid` is a Python package for easily fetching Telegram bot information such as chat ID, user ID, username, and message details using the Telegram Bot API.

## Overview
Managing interactions with Telegram bots often involves retrieving specific information such as chat IDs, user IDs, usernames, and details about incoming messages. The telegramid package simplifies this process by providing straightforward functions to fetch these details using the Telegram Bot API.

## Usage
### Fetching Chat ID, User ID, and Username
To retrieve essential information about the Telegram bot's interactions:

```python
from telegramid import telegram_chat

# Replace 'YOUR_TELEGRAM_BOT_TOKEN' with your actual Telegram bot token
token = "YOUR_TELEGRAM_BOT_TOKEN"

# Fetch chat ID
chat_id = telegram_chat.id(token)
if chat_id:
    print(f"Chat ID: {chat_id}")
else:
    print("Failed to fetch chat ID within the specified time.")

# Fetch user ID
user_id = telegram_chat.user_id(token)
if user_id:
    print(f"User ID: {user_id}")
else:
    print("Failed to fetch user ID within the specified time.")

# Fetch username
username = telegram_chat.username(token)
if username:
    print(f"Username: {username}")
else:
    print("Failed to fetch username within the specified time.")

```

### Fetching Message Information
To retrieve detailed information about the latest message received by the bot:
```python
# Fetch message info
message_info = telegram_chat.message_info(token)
if message_info:
    print(f"Telegram group ID: {message_info['group_id']}")
    print(f"Telegram group username: {message_info['group_username']}")
    print(f"Message sender user ID: {message_info['user_id']}")
    print(f"Message sender username: {message_info['username']}")
else:
    print("Failed to fetch message info within the specified time.")
```


### Explanation:

- **Overview:** Provides a brief introduction to the package's purpose and benefits.
- **Usage:** Offers practical examples of using the package functions to fetch essential Telegram bot information.
- **Functionality Details:** Explains the package's features, including synchronous fetching, retry mechanism, handling timeouts, and the structure of returned message information.
- **Additional Information:** Provides guidance on ensuring bot permissions and refers users to official Telegram Bot API documentation for more information.
- **License:** Mentions the licensing terms under which the package is distributed.

This README.md file is designed to provide comprehensive information and guidance for users of the `telegramid` package, enhancing clarity and usability.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ByteBreach/telegramid",
    "name": "telegramid",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Fidal",
    "author_email": "mrfidal@proton.me",
    "download_url": "https://files.pythonhosted.org/packages/85/7f/d2ed29e66ede70290d0729b9c9c768fdb1faa0d36c3947d6ebd4c7dce981/telegramid-1.0.0.tar.gz",
    "platform": null,
    "description": "# telegramid\r\n\r\n`telegramid` is a Python package for easily fetching Telegram bot information such as chat ID, user ID, username, and message details using the Telegram Bot API.\r\n\r\n## Overview\r\nManaging interactions with Telegram bots often involves retrieving specific information such as chat IDs, user IDs, usernames, and details about incoming messages. The telegramid package simplifies this process by providing straightforward functions to fetch these details using the Telegram Bot API.\r\n\r\n## Usage\r\n### Fetching Chat ID, User ID, and Username\r\nTo retrieve essential information about the Telegram bot's interactions:\r\n\r\n```python\r\nfrom telegramid import telegram_chat\r\n\r\n# Replace 'YOUR_TELEGRAM_BOT_TOKEN' with your actual Telegram bot token\r\ntoken = \"YOUR_TELEGRAM_BOT_TOKEN\"\r\n\r\n# Fetch chat ID\r\nchat_id = telegram_chat.id(token)\r\nif chat_id:\r\n    print(f\"Chat ID: {chat_id}\")\r\nelse:\r\n    print(\"Failed to fetch chat ID within the specified time.\")\r\n\r\n# Fetch user ID\r\nuser_id = telegram_chat.user_id(token)\r\nif user_id:\r\n    print(f\"User ID: {user_id}\")\r\nelse:\r\n    print(\"Failed to fetch user ID within the specified time.\")\r\n\r\n# Fetch username\r\nusername = telegram_chat.username(token)\r\nif username:\r\n    print(f\"Username: {username}\")\r\nelse:\r\n    print(\"Failed to fetch username within the specified time.\")\r\n\r\n```\r\n\r\n### Fetching Message Information\r\nTo retrieve detailed information about the latest message received by the bot:\r\n```python\r\n# Fetch message info\r\nmessage_info = telegram_chat.message_info(token)\r\nif message_info:\r\n    print(f\"Telegram group ID: {message_info['group_id']}\")\r\n    print(f\"Telegram group username: {message_info['group_username']}\")\r\n    print(f\"Message sender user ID: {message_info['user_id']}\")\r\n    print(f\"Message sender username: {message_info['username']}\")\r\nelse:\r\n    print(\"Failed to fetch message info within the specified time.\")\r\n```\r\n\r\n\r\n### Explanation:\r\n\r\n- **Overview:** Provides a brief introduction to the package's purpose and benefits.\r\n- **Usage:** Offers practical examples of using the package functions to fetch essential Telegram bot information.\r\n- **Functionality Details:** Explains the package's features, including synchronous fetching, retry mechanism, handling timeouts, and the structure of returned message information.\r\n- **Additional Information:** Provides guidance on ensuring bot permissions and refers users to official Telegram Bot API documentation for more information.\r\n- **License:** Mentions the licensing terms under which the package is distributed.\r\n\r\nThis README.md file is designed to provide comprehensive information and guidance for users of the `telegramid` package, enhancing clarity and usability.\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A package to fetch Telegram group chat ID, user ID, username, and message info",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/ByteBreach/telegramid"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a1dce7543f40ce7c739b5ae87d1524864d62a12a4a7da1f9eff897e2b7670022",
                "md5": "14b10f79d0d0039a0831aa2552a8481a",
                "sha256": "07fefee86975cd0b2a7023bc761d5b5823306ae829e84ff05bc7ae1b15fbaf88"
            },
            "downloads": -1,
            "filename": "telegramid-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "14b10f79d0d0039a0831aa2552a8481a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4331,
            "upload_time": "2024-06-30T05:08:19",
            "upload_time_iso_8601": "2024-06-30T05:08:19.787359Z",
            "url": "https://files.pythonhosted.org/packages/a1/dc/e7543f40ce7c739b5ae87d1524864d62a12a4a7da1f9eff897e2b7670022/telegramid-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "857fd2ed29e66ede70290d0729b9c9c768fdb1faa0d36c3947d6ebd4c7dce981",
                "md5": "739a514e72b5b36734c4d37a703c733f",
                "sha256": "ba754f6819d8e52ec812695acec15e6a4bd905177f0494ff2e65692f3726c765"
            },
            "downloads": -1,
            "filename": "telegramid-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "739a514e72b5b36734c4d37a703c733f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3857,
            "upload_time": "2024-06-30T05:08:22",
            "upload_time_iso_8601": "2024-06-30T05:08:22.177091Z",
            "url": "https://files.pythonhosted.org/packages/85/7f/d2ed29e66ede70290d0729b9c9c768fdb1faa0d36c3947d6ebd4c7dce981/telegramid-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-30 05:08:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ByteBreach",
    "github_project": "telegramid",
    "github_not_found": true,
    "lcname": "telegramid"
}
        
Elapsed time: 0.34996s