Skip to content

Conversation

Copy link

Copilot AI commented Dec 13, 2025

The ytdlp download feature was triggering when URLs were sent to saved messages (messages to self), creating unwanted downloads.

Changes

  • Early exit for saved messages: Compare message.chat.id with bot's user ID and return before processing
  • User ID caching: Lazily fetch and cache bot user ID to avoid repeated get_me() calls
  • Applies to both triggers: Automatic URL detection and .dl command both skip saved messages
@UserBot.on_message(filters.regex(video_url_regex) & filters.me)
async def video_downloader(bot: UserBot, message: Message, from_reply=False):
    global _bot_user_id
    
    # Don't download if the message is sent to saved messages (to myself)
    if _bot_user_id is None:
        me = await bot.get_me()
        _bot_user_id = me.id
    
    if message.chat.id == _bot_user_id:
        return
    
    # ... rest of download logic
Original prompt

make it so that the ytdlp download feature does not work when I send a matching URL to saved messages, aka to myself.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 13, 2025
Copilot AI changed the title [WIP] Disable ytdlp download feature for saved messages Disable ytdlp download in saved messages Dec 13, 2025
Copilot AI requested a review from athphane December 13, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants