# filegram
filegram is a Python package to send files to Telegram groups.
## Installation
You can install filegram using pip:
```
pip install filegram
```
## Features
- Send files to Telegram groups easily from Python scripts or command line.
- Supports sending all types of files including images, PDFs, documents, etc.
- Flexible options to send specific files, files matching a pattern, or all files from a directory.
## Benefits
- **Easy Integration:** Quickly integrate file sending functionality into your Python projects.
- **Supports All File Types:** Send any type of file supported by Telegram.
- **Command-line Interface:** Use filegram from the command line for easy automation and scripting.
- **Cross-platform:** Works on Windows, macOS, and Linux.
- **Pythonic API:** Simple and intuitive Python API for sending files programmatically.
## Usage
## Command-line Usage:
```bash
filegram --token "YOUR_BOT_TOKEN" --chat "@your_group_id" [--path /path/to/directory] [--file filename] [--filetype *.pdf]
filegram --token "YOUR_BOT_TOKEN" --chat "-230702347074" [--path /path/to/directory] [--file filename] [--filetype *.pdf]
```
### Options:
- ` -h`, `--help` Show this help message and exit
- `--path /path/to/directory` Directory path to send files from (default: current directory)
- `--file filename` Specific file to send
- `--filetype *.pdf` File type to send (e.g., *.pdf)
### Examples:
- To send all files from the current directory:
```bash
filegram --token "YOUR_BOT_TOKEN" --chat "@your_group_id"
```
- To send all files from a specific directory:
```bash
filegram --token "YOUR_BOT_TOKEN" --chat "@your_group_id" --path /path/to/directory
```
- To send a specific file:
```bash
filegram --token "YOUR_BOT_TOKEN" --chat "@your_group_id" --file filename.txt
```
- To send files matching a specific file type:
```bash
filegram --token "YOUR_BOT_TOKEN" --chat "@your_group_id" --filetype *.pdf
```
- To send all files matching a pattern:
```bash
filegram --token "YOUR_BOT_TOKEN" --chat "@your_group_id" --filetype *.png
```
- To send all files from a specific directory and a specific file:
```bash
filegram --token "YOUR_BOT_TOKEN" --chat "@your_group_id" --path /path/to/directory --file file.txt
```
### Basic Usage:
```python
import filegram
# Replace these variables with your bot token and chat ID
BOT_TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = '@your_group_id'
directory_path = '/path/to/your/directory'
# Send all files from the current directory
if filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path):
print("Files sent successfully")
else:
print("Failed to send files")
```
or
```python
import filegram
# Replace these variables with your bot token and chat ID
BOT_TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = '-098340207'
directory_path = '/path/to/your/directory'
# Send all files from the current directory
if filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path):
print("Files sent successfully")
else:
print("Failed to send files")
```
### Additional Usages:
- To send specific types of files from a directory:
```python
import filegram
# Replace these variables with your bot token, chat ID, directory path, and file type
BOT_TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = '@your_group_id'
directory_path = '/path/to/your/directory'
file_type = '*.jpg'
if filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path, filetype=file_type):
print("JPEG files sent successfully")
else:
print("Failed to send JPEG files")
```
- To send a specific file type:
```python
import filegram
# Replace these variables with your bot token and chat ID
BOT_TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = '@your_group_id'
directory_path = '/path/to/your/directory'
file_type = '*.css'
# Send all files from the specified directory with the specified file type
if filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path, filetype=file_type):
print("Files sent successfully")
else:
print("Failed to send files")
```
- To send a single file type from a directory:
```python
import filegram
# Replace these variables with your bot token, chat ID, directory path, and file type
BOT_TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = '@your_group_id'
directory_path = '/path/to/your/directory'
file_type = '*.docx'
if filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path, filetype=file_type):
print("DOCX files sent successfully")
else:
print("Failed to send DOCX files")
```
- To send a specific file and check if it's sent:
```python
import filegram
# Replace these variables with your bot token, chat ID, and file path
BOT_TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = '@your_group_id'
file_path = '/path/to/your/file.txt'
if filegram.send_file(BOT_TOKEN, CHAT_ID, file_path):
print("File sent successfully")
else:
print("Failed to send file")
```
- To send all files from the current directory:
```python
import filegram
# Replace these variables with your bot token and chat ID
BOT_TOKEN = 'YOUR_BOT_TOKEN'
CHAT_ID = '@your_group_id'
if filegram.send_files(BOT_TOKEN, CHAT_ID):
print("All files from the current directory sent successfully")
else:
print("Failed to send files")
```
## Thanks for Using filegram!
We hope you find filegram helpful for your projects. If you have any questions, suggestions, or issues, please feel free to open an issue on [GitHub](https://github.com/ByteBreach/filegram).
Raw data
{
"_id": null,
"home_page": "https://mrfidal.in/cyber-security/filegram",
"name": "filegram",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "telegram files send",
"author": "Fidal",
"author_email": "mrfidal@proton.me",
"download_url": "https://files.pythonhosted.org/packages/7e/a5/17e46b7f5c816551f47a2786d28afa6bb00d805b65a5b32c5c5994548de8/filegram-1.2.16.tar.gz",
"platform": null,
"description": "# filegram\r\n\r\nfilegram is a Python package to send files to Telegram groups.\r\n\r\n## Installation\r\n\r\nYou can install filegram using pip:\r\n\r\n```\r\npip install filegram\r\n```\r\n\r\n## Features\r\n\r\n- Send files to Telegram groups easily from Python scripts or command line.\r\n- Supports sending all types of files including images, PDFs, documents, etc.\r\n- Flexible options to send specific files, files matching a pattern, or all files from a directory.\r\n\r\n## Benefits\r\n\r\n- **Easy Integration:** Quickly integrate file sending functionality into your Python projects.\r\n- **Supports All File Types:** Send any type of file supported by Telegram.\r\n- **Command-line Interface:** Use filegram from the command line for easy automation and scripting.\r\n- **Cross-platform:** Works on Windows, macOS, and Linux.\r\n- **Pythonic API:** Simple and intuitive Python API for sending files programmatically.\r\n\r\n## Usage\r\n\r\n## Command-line Usage:\r\n\r\n```bash\r\nfilegram --token \"YOUR_BOT_TOKEN\" --chat \"@your_group_id\" [--path /path/to/directory] [--file filename] [--filetype *.pdf]\r\nfilegram --token \"YOUR_BOT_TOKEN\" --chat \"-230702347074\" [--path /path/to/directory] [--file filename] [--filetype *.pdf]\r\n```\r\n\r\n### Options:\r\n\r\n- ` -h`, `--help` Show this help message and exit\r\n \r\n- `--path /path/to/directory` Directory path to send files from (default: current directory)\r\n \r\n- `--file filename` Specific file to send\r\n \r\n- `--filetype *.pdf` File type to send (e.g., *.pdf)\r\n\r\n### Examples:\r\n\r\n - To send all files from the current directory:\r\n\r\n```bash\r\nfilegram --token \"YOUR_BOT_TOKEN\" --chat \"@your_group_id\"\r\n```\r\n\r\n - To send all files from a specific directory:\r\n\r\n```bash\r\nfilegram --token \"YOUR_BOT_TOKEN\" --chat \"@your_group_id\" --path /path/to/directory\r\n```\r\n\r\n- To send a specific file:\r\n \r\n```bash\r\nfilegram --token \"YOUR_BOT_TOKEN\" --chat \"@your_group_id\" --file filename.txt\r\n```\r\n\r\n- To send files matching a specific file type:\r\n\r\n```bash\r\nfilegram --token \"YOUR_BOT_TOKEN\" --chat \"@your_group_id\" --filetype *.pdf\r\n```\r\n\r\n- To send all files matching a pattern:\r\n \r\n```bash\r\nfilegram --token \"YOUR_BOT_TOKEN\" --chat \"@your_group_id\" --filetype *.png\r\n ```\r\n\r\n - To send all files from a specific directory and a specific file:\r\n \r\n```bash\r\nfilegram --token \"YOUR_BOT_TOKEN\" --chat \"@your_group_id\" --path /path/to/directory --file file.txt\r\n```\r\n\r\n### Basic Usage:\r\n\r\n```python\r\nimport filegram\r\n\r\n# Replace these variables with your bot token and chat ID\r\nBOT_TOKEN = 'YOUR_BOT_TOKEN'\r\nCHAT_ID = '@your_group_id'\r\ndirectory_path = '/path/to/your/directory'\r\n\r\n# Send all files from the current directory\r\nif filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path):\r\n print(\"Files sent successfully\")\r\nelse:\r\n print(\"Failed to send files\")\r\n```\r\nor\r\n```python\r\nimport filegram\r\n\r\n# Replace these variables with your bot token and chat ID\r\nBOT_TOKEN = 'YOUR_BOT_TOKEN'\r\nCHAT_ID = '-098340207'\r\ndirectory_path = '/path/to/your/directory'\r\n\r\n# Send all files from the current directory\r\nif filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path):\r\n print(\"Files sent successfully\")\r\nelse:\r\n print(\"Failed to send files\")\r\n```\r\n\r\n### Additional Usages:\r\n\r\n- To send specific types of files from a directory:\r\n\r\n```python\r\nimport filegram\r\n\r\n# Replace these variables with your bot token, chat ID, directory path, and file type\r\nBOT_TOKEN = 'YOUR_BOT_TOKEN'\r\nCHAT_ID = '@your_group_id'\r\ndirectory_path = '/path/to/your/directory'\r\nfile_type = '*.jpg'\r\n\r\nif filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path, filetype=file_type):\r\n print(\"JPEG files sent successfully\")\r\nelse:\r\n print(\"Failed to send JPEG files\")\r\n```\r\n\r\n- To send a specific file type:\r\n\r\n```python\r\nimport filegram\r\n\r\n# Replace these variables with your bot token and chat ID\r\nBOT_TOKEN = 'YOUR_BOT_TOKEN'\r\nCHAT_ID = '@your_group_id'\r\ndirectory_path = '/path/to/your/directory'\r\nfile_type = '*.css'\r\n\r\n# Send all files from the specified directory with the specified file type\r\nif filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path, filetype=file_type):\r\n print(\"Files sent successfully\")\r\nelse:\r\n print(\"Failed to send files\")\r\n```\r\n\r\n- To send a single file type from a directory:\r\n\r\n```python\r\nimport filegram\r\n\r\n# Replace these variables with your bot token, chat ID, directory path, and file type\r\nBOT_TOKEN = 'YOUR_BOT_TOKEN'\r\nCHAT_ID = '@your_group_id'\r\ndirectory_path = '/path/to/your/directory'\r\nfile_type = '*.docx'\r\n\r\nif filegram.send_files(BOT_TOKEN, CHAT_ID, directory_path, filetype=file_type):\r\n print(\"DOCX files sent successfully\")\r\nelse:\r\n print(\"Failed to send DOCX files\")\r\n```\r\n\r\n- To send a specific file and check if it's sent:\r\n\r\n```python\r\nimport filegram\r\n\r\n# Replace these variables with your bot token, chat ID, and file path\r\nBOT_TOKEN = 'YOUR_BOT_TOKEN'\r\nCHAT_ID = '@your_group_id'\r\nfile_path = '/path/to/your/file.txt'\r\n\r\nif filegram.send_file(BOT_TOKEN, CHAT_ID, file_path):\r\n print(\"File sent successfully\")\r\nelse:\r\n print(\"Failed to send file\")\r\n```\r\n\r\n- To send all files from the current directory:\r\n\r\n```python\r\nimport filegram\r\n\r\n# Replace these variables with your bot token and chat ID\r\nBOT_TOKEN = 'YOUR_BOT_TOKEN'\r\nCHAT_ID = '@your_group_id'\r\n\r\nif filegram.send_files(BOT_TOKEN, CHAT_ID):\r\n print(\"All files from the current directory sent successfully\")\r\nelse:\r\n print(\"Failed to send files\")\r\n```\r\n\r\n## Thanks for Using filegram!\r\n\r\nWe hope you find filegram helpful for your projects. If you have any questions, suggestions, or issues, please feel free to open an issue on [GitHub](https://github.com/ByteBreach/filegram).\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A package to send files to Telegram groups",
"version": "1.2.16",
"project_urls": {
"Homepage": "https://mrfidal.in/cyber-security/filegram"
},
"split_keywords": [
"telegram",
"files",
"send"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "804f0a3de508760ea1d9163e9fe2d20537b448366bc81ccc9072c7d8b26a8b28",
"md5": "16017a9c3ecb613232794361dc18b9f5",
"sha256": "1a6d0e43b3dd899304b6ffd6acc0e68fdab8aa80d7473df2ed176ed00d0c93cd"
},
"downloads": -1,
"filename": "filegram-1.2.16-py3-none-any.whl",
"has_sig": false,
"md5_digest": "16017a9c3ecb613232794361dc18b9f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5071,
"upload_time": "2024-06-29T14:12:37",
"upload_time_iso_8601": "2024-06-29T14:12:37.616053Z",
"url": "https://files.pythonhosted.org/packages/80/4f/0a3de508760ea1d9163e9fe2d20537b448366bc81ccc9072c7d8b26a8b28/filegram-1.2.16-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7ea517e46b7f5c816551f47a2786d28afa6bb00d805b65a5b32c5c5994548de8",
"md5": "fb3d9312d04f62568c70854159c70abb",
"sha256": "4b805b7492596c918cbd34b58c743d748fbda9dd9973bb6552c5b0ec3308c34a"
},
"downloads": -1,
"filename": "filegram-1.2.16.tar.gz",
"has_sig": false,
"md5_digest": "fb3d9312d04f62568c70854159c70abb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4819,
"upload_time": "2024-06-29T14:12:39",
"upload_time_iso_8601": "2024-06-29T14:12:39.510856Z",
"url": "https://files.pythonhosted.org/packages/7e/a5/17e46b7f5c816551f47a2786d28afa6bb00d805b65a5b32c5c5994548de8/filegram-1.2.16.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-29 14:12:39",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "filegram"
}