Update and rename info.py to Bot.py#62
Update and rename info.py to Bot.py#62Manuthakur01 wants to merge 1 commit intoLearningBotsOfficial:mainfrom
Conversation
📝 WalkthroughWalkthroughConfiguration values updated in Bot.py including API credentials (API_ID, API_HASH, BOT_TOKEN), admin/channel settings (ADMINS, USERNAME, LOG_CHANNEL, MOVIE_GROUP_LINK, CHANNELS), and database connection parameters (DATABASE_URI, DATABASE_NAME). No functional logic modifications. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Bot.py`:
- Around line 16-18: The file currently embeds secrets as default values for
API_ID, API_HASH, BOT_TOKEN (and the DB URI at the later lines), so replace
those getenv calls that use hardcoded defaults with fail-fast required env
lookups (e.g., use environ[...] or an equivalent that raises when missing) for
API_ID, API_HASH, BOT_TOKEN and the DB connection variables referenced later
(lines ~28-29), remove all hardcoded tokens/credentials from the code, and
ensure the application raises a clear error at startup if any required
environment variable is not set so secrets must be provided via
environment/config management.
- Line 24: Default for MOVIE_GROUP_LINK in Bot.py contains a duplicated scheme
("https://https://...") making the URL invalid; update the MOVIE_GROUP_LINK
default to a valid URL (e.g., replace the current default with
"https://t.me/funchannel013") so environ.get('MOVIE_GROUP_LINK', ...) returns a
correct link when unset and ensure no extra scheme or whitespace remains.
| API_ID = int(environ.get('API_ID', '32130352')) | ||
| API_HASH = environ.get('API_HASH', 'fddbf986bb12dee0c05b32594188d75e') | ||
| BOT_TOKEN = environ.get('BOT_TOKEN', '8293394314:AAGNYE5w99XbCfV9zZRlhSBIVsLRIgWZr-A') |
There was a problem hiding this comment.
Remove committed secrets and require env vars at startup.
Line 16, Line 17, Line 18, Line 28, and Line 29 currently include hardcoded credentials/tokens (including DB credentials in URI). This is a critical secret-leak risk.
🔐 Proposed fix (fail-fast required envs, no secret defaults)
+def get_required_env(name):
+ value = environ.get(name)
+ if not value:
+ raise RuntimeError(f"Missing required environment variable: {name}")
+ return value
+
-API_ID = int(environ.get('API_ID', '32130352'))
-API_HASH = environ.get('API_HASH', 'fddbf986bb12dee0c05b32594188d75e')
-BOT_TOKEN = environ.get('BOT_TOKEN', '8293394314:AAGNYE5w99XbCfV9zZRlhSBIVsLRIgWZr-A')
+API_ID = int(get_required_env('API_ID'))
+API_HASH = get_required_env('API_HASH')
+BOT_TOKEN = get_required_env('BOT_TOKEN')
-DATABASE_URI = environ.get('DATABASE_URI', "mongodb+srv://manuthakur:[email protected]/?appName=manuthakur")
-DATABASE_NAME = environ.get('DATABASE_NAME', "manuthakur")
+DATABASE_URI = get_required_env('DATABASE_URI')
+DATABASE_NAME = get_required_env('DATABASE_NAME')Also applies to: 28-29
🧰 Tools
🪛 Gitleaks (8.30.0)
[high] 17-17: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Bot.py` around lines 16 - 18, The file currently embeds secrets as default
values for API_ID, API_HASH, BOT_TOKEN (and the DB URI at the later lines), so
replace those getenv calls that use hardcoded defaults with fail-fast required
env lookups (e.g., use environ[...] or an equivalent that raises when missing)
for API_ID, API_HASH, BOT_TOKEN and the DB connection variables referenced later
(lines ~28-29), remove all hardcoded tokens/credentials from the code, and
ensure the application raises a clear error at startup if any required
environment variable is not set so secrets must be provided via
environment/config management.
| ADMINS = [int(admin) if id_pattern.search(admin) else admin for admin in environ.get('ADMINS', '8553992570').split()] | ||
| USERNAME = environ.get('USERNAME', "https://t.me/manuthakur01") # ADMIN USERNAME | ||
| LOG_CHANNEL = int(environ.get('LOG_CHANNEL', '-1003885974344')) | ||
| MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://https://t.me/funchannel013') |
There was a problem hiding this comment.
Fix malformed default URL for movie group link.
Line 24 default value has a double scheme (https://https://...), so it resolves to an invalid URL when MOVIE_GROUP_LINK is unset.
🔧 Proposed fix
-MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://https://t.me/funchannel013')
+MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://t.me/funchannel013')📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://https://t.me/funchannel013') | |
| MOVIE_GROUP_LINK = environ.get('MOVIE_GROUP_LINK', 'https://t.me/funchannel013') |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Bot.py` at line 24, Default for MOVIE_GROUP_LINK in Bot.py contains a
duplicated scheme ("https://https://...") making the URL invalid; update the
MOVIE_GROUP_LINK default to a valid URL (e.g., replace the current default with
"https://t.me/funchannel013") so environ.get('MOVIE_GROUP_LINK', ...) returns a
correct link when unset and ensure no extra scheme or whitespace remains.
Summary by CodeRabbit