TelegramMonitor广告管理模块
Project description
TelegramMonitor广告模块
这是TelegramMonitor项目的广告管理模块,提供远程广告配置和显示功能。
⚠️ 重要说明
此模块是TelegramMonitor的核心依赖,删除或修改将导致主程序无法正常运行。
功能特点
- 🌐 远程配置 - 自动从远程服务器同步广告配置
- 📊 智能显示 - 基于优先级和频率的智能广告轮播
- 🔒 系统集成 - 与主程序深度集成,确保稳定运行
- ⏰ 时间控制 - 支持广告的开始和结束时间设置
安装
pip install telegram-monitor-ads
使用方法
from telegram_monitor_ads import AdManager, AdConfig
# 创建配置
config = AdConfig.from_env()
# 创建广告管理器
ad_manager = AdManager(config)
# 检查是否应该显示广告
if ad_manager.should_display_ad():
ad_content = await ad_manager.get_current_ad()
print(ad_content)
配置说明
环境变量
AD_PRIMARY_URL- 主要广告配置URLAD_BACKUP_URL- 备用广告配置URLAD_SYNC_INTERVAL- 同步间隔(秒)AD_DEFAULT_FREQUENCY- 默认显示频率
广告配置格式
{
"version": "1.0.0",
"system_check": "telegram_monitor_ads_v1_0_0",
"ads": [
{
"id": "ad_001",
"title": "广告标题",
"content": "广告内容",
"url": "https://example.com",
"is_active": true,
"frequency": 10,
"priority": 5,
"start_time": "2024-01-01T00:00:00Z",
"end_time": "2024-12-31T23:59:59Z"
}
]
}
许可证
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telegram_monitor_ads-1.0.0.tar.gz.
File metadata
- Download URL: telegram_monitor_ads-1.0.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f35dbf249dcdd4528cc63396e53d309e90dc17893f5b22b6438e3b1929fa2893
|
|
| MD5 |
1d7ee3b7d350912555a33279438fcda8
|
|
| BLAKE2b-256 |
3f89c07a8f935ab6a9964a4c2957829350ed701bb08a96aee7cc6b4d88fe8d17
|
File details
Details for the file telegram_monitor_ads-1.0.0-py3-none-any.whl.
File metadata
- Download URL: telegram_monitor_ads-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d2b47dbff40ac8150abdf64f916092c556c265e7a6a7f5d9e55683bd8eda3ee
|
|
| MD5 |
611210a80fd7683aaa1f4b8cb1a9b583
|
|
| BLAKE2b-256 |
81dbacd6e5c766e758e7fb28a771ec9b5f91c7dd663384096448af6ab145db20
|