Python | Machine Learning | Coding | R
67.3K subscribers
1.25K photos
89 videos
153 files
906 links
Help and ads: @hussein_sheikho

Discover powerful insights with Python, Machine Learning, Coding, and R—your essential toolkit for data-driven solutions, smart alg

List of our channels:
https://t.me/addlist/8_rRW2scgfRhOTc0

https://telega.io/?r=nikapsOH
Download Telegram
🚀 Comprehensive Tutorial: Build a Folder Monitoring & Intruder Detection System in Python

In this comprehensive, step-by-step tutorial, you will learn how to build a real-time folder monitoring and intruder detection system using Python.

🔐 Your Goal:
Create a background program that:
- Monitors a specific folder on your computer.
- Instantly captures a photo using the webcam whenever someone opens that folder.
- Saves the photo with a timestamp in a secure folder.
- Runs automatically when Windows starts.
- Keeps running until you manually stop it (e.g., via Task Manager or a hotkey).

Read and get code: https://hackmd.io/@husseinsheikho/Build-a-Folder-Monitoring

#Python #Security #FolderMonitoring #IntruderDetection #OpenCV #FaceCapture #Automation #Windows #TaskScheduler #ComputerVision


✉️ Our Telegram channels: https://t.me/addlist/0f6vfFbEMdAwODBk

📱 Our WhatsApp channel: https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Please open Telegram to view this post
VIEW IN TELEGRAM
8🔥1🎉1
# Add these imports to the top of bot.py
import csv
import io
import database as db

async def export_members(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Exports channel members to a CSV file."""
user = update.effective_user
chat = update.effective_chat

if chat.type != 'channel':
await update.message.reply_text("This command can only be used in a channel.")
return

# --- Permission Check ---
try:
admins = await context.bot.get_chat_administrators(chat.id)
is_creator = False
for admin in admins:
if admin.user.id == user.id and admin.status == 'creator':
is_creator = True
break

if not is_creator:
await update.message.reply_text("Sorry, only the channel creator can use this command.")
return

except Exception as e:
await update.message.reply_text(f"An error occurred while checking permissions: {e}")
return

await update.message.reply_text("Exporting members... This may take a moment for large channels.")

# The rest of the logic will go here in the next step

# In the main() function of bot.py, uncomment and add the handler:
# application.add_handler(CommandHandler("export", export_members))

# At the start of main(), also add the database setup call:
db.setup_database()

# Hashtags: #BotLogic #Permissions #Security #TelegramAPI


---

#Step 4: Fetching Members and Generating the CSV File

This is the continuation of the export_members function. After passing the permission check, the bot will fetch the list of administrators (as a reliable way to get some members) and generate a CSV file in memory.

NOTE: The Bot API has limitations on fetching a complete list of non-admin members in very large channels. This example reliably fetches administrators. A more advanced "userbot" would be needed to guarantee fetching all members.
2