main module
בוט שומר קבצי קוד - Code Keeper Bot נקודת הכניסה הראשית לבוט
- async main.log_user_activity(update, context)[מקור]
רישום פעילות משתמש במערכת.
- פרמטרים:
update (
Update
) – אובייקט Update מטלגרםcontext (
DEFAULT_TYPE
) – הקונטקסט של השיחה
הערה
פונקציה זו נקראת אוטומטית עבור כל פעולה של משתמש
- main.get_lock_collection()[מקור]
מחזיר את קולקציית הנעילות ממסד הנתונים.
- Returns:
קולקציית הנעילות
- Return type:
- Raises:
SystemExit – אם מסד הנתונים לא אותחל כראוי
הערה
משתמש במסד הנתונים שכבר נבחר ב-DatabaseManager
- main.ensure_lock_indexes()[מקור]
יוצר אינדקס TTL על שדה expires_at לניקוי אוטומטי של נעילות ישנות. :rtype:
None
הערה
אם יצירת האינדקס נכשלת, המערכת תמשיך לעבוד ללא TTL אוטומטי
- Return type:
None
- main.cleanup_mongo_lock()[מקור]
מנקה את נעילת MongoDB בעת יציאה מהתוכנית.
הערה
פונקציה זו נרשמת עם atexit ורצה אוטומטית בסיום התוכנית
- main.manage_mongo_lock()[מקור]
רוכש נעילה מבוזרת ב-MongoDB כדי להבטיח שרק מופע אחד של הבוט רץ.
- Returns:
True אם הנעילה נרכשה בהצלחה, False אחרת
- Return type:
הערה
תומך בהמתנה לשחרור נעילה קיימת עבור blue/green deployments
- class main.CodeKeeperBot[מקור]
Bases:
object
המחלקה הראשית של Code Keeper Bot.
מחלקה זו מנהלת את כל הפונקציונליות של הבוט, כולל: - הגדרת handlers לפקודות ומסרים - ניהול שיחות מורכבות - אינטגרציות עם שירותים חיצוניים - ניהול מסד נתונים
- application
אובייקט Application של python-telegram-bot
- github_handler
מנהל אינטגרציית GitHub
- backup_handler
מנהל מערכת הגיבויים
- async help_command(update, context)[מקור]
פקודת עזרה מפורטת
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async save_command(update, context)[מקור]
פקודת שמירת קוד
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async list_command(update, context)[מקור]
הצגת רשימת הקטעים של המשתמש
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async search_command(update, context)[מקור]
חיפוש קטעי קוד
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async check_commands(update, context)[מקור]
בדיקת הפקודות הזמינות (רק לאמיר)
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async stats_command(update, context)[מקור]
הצגת סטטיסטיקות המשתמש או מנהל
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async handle_document(update, context)[מקור]
טיפול בקבצים שנשלחים לבוט
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async handle_text_message(update, context)[מקור]
טיפול בהודעות טקסט (קוד פוטנציאלי)
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- main.setup_handlers(application, db_manager)[מקור]
Register basic command handlers required for the bot to operate.
- פרמטרים:
application (telegram.ext.Application)
- async main.setup_bot_data(application)[מקור]
A post_init function to setup application-wide data.
- Return type:
- פרמטרים:
application (telegram.ext.Application)