ALIOF213 commited on
Commit
c97e047
ยท
verified ยท
1 Parent(s): abe0320

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +299 -0
app.py ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ import json
4
+ import threading
5
+ import requests
6
+ from flask import Flask
7
+ import gradio as gr
8
+ from telebot import TeleBot, types
9
+
10
+ # ุถุน ุชูˆูƒู† ุจูˆุชูƒ ู‡ู†ุง ุฃูˆ ุงุชุฑูƒู‡ ูŠู‚ุฑุฃู‡ ู…ู† ู…ุชุบูŠุฑุงุช ุงู„ุจูŠุฆุฉ
11
+ TOKEN = os.environ.get("TOKEN", "ุถุน_ุงู„ุชูˆูƒู†_ู‡ู†ุง_ุฅุฐุง_ู„ู…_ุชุถุนู‡_ููŠ_Secrets")
12
+ bot = TeleBot(TOKEN, threaded=True)
13
+
14
+ # ู…ู„ู ุชุฎุฒูŠู† ุฅุนุฏุงุฏุงุช ุงู„ู…ุฌู…ูˆุนุงุช ูˆุญุงู„ุฉ ุงู„ุญุธุฑ ูˆุงู„ุชุญุฐูŠุฑุงุช
15
+ DB_FILE = "bot_db.json"
16
+
17
+ def load_db():
18
+ if os.path.exists(DB_FILE):
19
+ try:
20
+ with open(DB_FILE, "r", encoding="utf-8") as f:
21
+ return json.load(f)
22
+ except:
23
+ pass
24
+ return {}
25
+
26
+ def save_db(data):
27
+ with open(DB_FILE, "w", encoding="utf-8") as f:
28
+ json.dump(data, f, ensure_ascii=False, indent=4)
29
+
30
+ db = load_db()
31
+
32
+ def get_chat_settings(chat_id):
33
+ c_id = str(chat_id)
34
+ if c_id not in db:
35
+ db[c_id] = {
36
+ "locks": {"links": True, "photos": True, "videos": True, "badwords": True, "ai_filter": True},
37
+ "warnings": {},
38
+ "admins": {}
39
+ }
40
+ save_db(db)
41
+ return db[c_id]
42
+
43
+ # ุฏุงู„ุฉ ุงู„ูุญุต ุงู„ุฐูƒูŠ ู„ู„ุณุจ ูˆุงู„ู…ุญุชูˆู‰ ุงู„ุฅุจุงุญูŠ (AI Filter)
44
+ def ai_check_content(text):
45
+ if not text:
46
+ return False, ""
47
+ bad_words = ["ุณุจ", "ุดุชู…", "ู‚ุฐู", "ุงุจุงุญูŠ", "porn", "sex", "ู…ุฎู†ุซ", "ู‚ู†ุฏุฑุฉ", "ุนุงู‡ุฑุฉ", "ู…ู†ูŠูˆูƒ"]
48
+ text_lower = text.lower()
49
+ for word in bad_words:
50
+ if word in text_lower:
51
+ if word in ["ุงุจุงุญูŠ", "porn", "sex"]:
52
+ return True, "ู…ู…ู†ูˆุน ุงู„ุฅุจุงุญูŠ ๐Ÿšซ"
53
+ else:
54
+ return True, "ู…ู…ู†ูˆุน ุงู„ุณุจ ูˆุงู„ุดุชู… โš ๏ธ"
55
+ return False, ""
56
+
57
+ # ุฏุงู„ุฉ ู…ุณุงุนุฏุฉ ู„ุงุณุชุฎุฑุงุฌ ู…ุนุฑู ุงู„ู…ุณุชุฎุฏู… ุงู„ู…ุณุชู‡ุฏู (ุจุงู„ุฑุฏ ุฃูˆ ุงู„ู†ุต)
58
+ def get_target_user(message):
59
+ if message.reply_to_message:
60
+ return message.reply_to_message.from_user.id
61
+ parts = message.text.split()
62
+ if len(parts) > 1:
63
+ target = parts[1]
64
+ if target.startswith("@"):
65
+ username = target.replace("@", "")
66
+ # ู…ุญุงูˆู„ุฉ ุงู„ุจุญุซ ููŠ ุงู„ุฃุนุถุงุก ุฃูˆ ุงุณุชุฎุฏุงู… ูƒูˆุฏ ุจุฏูŠู„
67
+ try:
68
+ chat_member = bot.get_chat_member(message.chat.id, username)
69
+ return chat_member.user.id
70
+ except:
71
+ pass
72
+ elif target.isdigit():
73
+ return int(target)
74
+ return None
75
+
76
+ # --- ุฃูˆุงู…ุฑ ุงู„ุจูˆุช ุงู„ุฃุณุงุณูŠุฉ ูˆุงู„ุฅุฏุงุฑุฉ ---
77
+
78
+ @bot.message_handler(commands=['start', 'help', 'ุงูˆุงู…ุฑ'])
79
+ def send_welcome(message):
80
+ if message.chat.type == 'private':
81
+ bot.reply_to(message, "ุฃู‡ู„ุงู‹ ุจูƒ ููŠ ุจูˆุช ุงู„ุญู…ุงูŠุฉ ูˆุงู„ุฅุฏุงุฑุฉ ุงู„ุดุงู…ู„ ๐Ÿ›ก๏ธ\nุฃุถูู†ูŠ ุฅู„ู‰ ู…ุฌู…ูˆุนุชูƒ ูˆุงุฌุนู„ู†ูŠ ู…ุดุฑูุงู‹ ู„ุฃู‚ูˆู… ุจุญู…ุงูŠุชู‡ุง ูˆุฅุฏุงุฑุฉ ุงู„ุฃุฏุนูŠุฉ ูˆุงู„ู‚ุฑุขู† ุจุงู†ุชุธุงู….")
82
+ else:
83
+ help_text = (
84
+ "๐Ÿ›  **ู‚ุงุฆู…ุฉ ุฃูˆุงู…ุฑ ุงู„ุญู…ุงูŠุฉ ูˆุงู„ุฅุฏุงุฑุฉ ุงู„ุดุงู…ู„ุฉ:**\n\n"
85
+ "๐Ÿ“Œ **ุฃูˆุงู…ุฑ ุงู„ู‚ูู„ ูˆุงู„ูุชุญ:**\n"
86
+ "โ€ข `ู‚ูู„ ุงู„ุฑูˆุงุจุท` / `ูุชุญ ุงู„ุฑูˆุงุจุท`\n"
87
+ "โ€ข `ู‚ูู„ ุงู„ุตูˆุฑ` / `ูุชุญ ุงู„ุตูˆุฑ`\n"
88
+ "โ€ข `ู‚ูู„ ุงู„ููŠุฏูŠูˆ` / `ูุชุญ ุงู„ููŠุฏูŠูˆ`\n"
89
+ "โ€ข `ู‚ูู„ ุงู„ุณุจ` / `ูุชุญ ุงู„ุณุจ`\n"
90
+ "โ€ข `ู‚ูู„ ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ` / `ูุชุญ ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ`\n\n"
91
+ "โš–๏ธ **ุฃูˆุงู…ุฑ ุงู„ุนู‚ูˆุจุงุช (ุจุงู„ุฑุฏ ุฃูˆ ุงู„ูŠูˆุฒุฑ ุฃูˆ ุงู„ุงูŠุฏูŠ):**\n"
92
+ "โ€ข `ุญุธุฑ` / `ุงู„ุบุงุก ุญุธุฑ`\n"
93
+ "โ€ข `ูƒุชู…` / `ุงู„ุบุงุก ูƒุชู…`\n"
94
+ "โ€ข `ุชู‚ูŠูŠุฏ` / `ููƒ ุชู‚ูŠูŠุฏ`\n"
95
+ "โ€ข `ุทุฑุฏ`\n"
96
+ "โ€ข `ุชุญุฐูŠุฑ`\n\n"
97
+ "๐Ÿ‘‘ **ุฃูˆุงู…ุฑ ุงู„ุฑุชุจ ูˆุงู„ุตู„ุงุญูŠุงุช:**\n"
98
+ "โ€ข `ุฑูุน ู…ู…ูŠุฒ` ุŒ `ุฑูุน ุงุฏู…ู†` ุŒ `ุฑูุน ู…ุฏูŠุฑ`\n"
99
+ "โ€ข `ุชู†ุฒูŠู„ ุงู„ุฑุชุจุฉ`"
100
+ )
101
+ bot.reply_to(message, help_text, parse_mode="Markdown")
102
+
103
+ # ุฃูˆุงู…ุฑ ุงู„ู‚ูู„ ูˆุงู„ูุชุญ
104
+ @bot.message_handler(func=lambda m: m.text in ["ู‚ูู„ ุงู„ุฑูˆุงุจุท", "ูุชุญ ุงู„ุฑูˆุงุจุท", "ู‚ูู„ ุงู„ุตูˆุฑ", "ูุชุญ ุงู„ุตูˆุฑ", "ู‚ูู„ ุงู„ููŠุฏูŠูˆ", "ูุชุญ ุงู„ููŠุฏูŠูˆ", "ู‚ูู„ ุงู„ุณุจ", "ูุชุญ ุงู„ุณุจ", "ู‚ูู„ ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ", "ูุชุญ ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ"])
105
+ def handle_locks(message):
106
+ if message.chat.type == 'private':
107
+ return
108
+ settings = get_chat_settings(message.chat.id)
109
+ text = message.text
110
+ if "ุงู„ุฑูˆุงุจุท" in text:
111
+ settings["locks"]["links"] = "ู‚ูู„" in text
112
+ status = "ู‚ูู„ ุงู„ุฑูˆุงุจุท ุจู†ุฌุงุญ ๐Ÿ”’" if settings["locks"]["links"] else "ูุชุญ ุงู„ุฑูˆุงุจุท ุจู†ุฌุงุญ ๐Ÿ”“"
113
+ elif "ุงู„ุตูˆุฑ" in text:
114
+ settings["locks"]["photos"] = "ู‚ูู„" in text
115
+ status = "ู‚ูู„ ุงู„ุตูˆุฑ ุจู†ุฌุงุญ ๐Ÿ”’" if settings["locks"]["photos"] else "ูุชุญ ุงู„ุตูˆุฑ ุจู†ุฌุงุญ ๐Ÿ”“"
116
+ elif "ุงู„ููŠุฏูŠูˆ" in text:
117
+ settings["locks"]["videos"] = "ู‚ูู„" in text
118
+ status = "ู‚ูู„ ุงู„ููŠุฏูŠูˆ ุจู†ุฌุงุญ ๐Ÿ”’" if settings["locks"]["videos"] else "ูุชุญ ุงู„ููŠุฏูŠูˆ ุจู†ุฌุงุญ ๐Ÿ”“"
119
+ elif "ุงู„ุณุจ" in text:
120
+ settings["locks"]["badwords"] = "ู‚ูู„" in text
121
+ status = "ู‚ูู„ ุงู„ุณุจ ุจู†ุฌุงุญ ๐Ÿ”’" if settings["locks"]["badwords"] else "ูุชุญ ุงู„ุณุจ ุจู†ุฌุงุญ ๐Ÿ”“"
122
+ elif "ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ" in text:
123
+ settings["locks"]["ai_filter"] = "ู‚ูู„" in text
124
+ status = "ุชู… ุชูุนูŠู„ ูู„ุชุฑ ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ ๐Ÿ›ก๏ธ" if settings["locks"]["ai_filter"] else "ุชู… ุชุนุทูŠู„ ูู„ุชุฑ ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ โš ๏ธ"
125
+
126
+ save_db(db)
127
+ bot.reply_to(message, status)
128
+
129
+ # ุฃูˆุงู…ุฑ ุงู„ุญุธุฑุŒ ุงู„ูƒุชู…ุŒ ุงู„ุชู‚ูŠูŠุฏ ูˆุงู„ุฑูุน
130
+ @bot.message_handler(func=lambda m: m.text and m.text.split()[0] in ["ุญุธุฑ", "ุงู„ุบุงุก", "ูƒุชู…", "ุชู‚ูŠูŠุฏ", "ููƒ", "ุทุฑุฏ", "ุชุญุฐูŠุฑ", "ุฑูุน", "ุชู†ุฒูŠู„"])
131
+ def handle_moderation(message):
132
+ if message.chat.type == 'private':
133
+ return
134
+
135
+ parts = message.text.split()
136
+ command = parts[0]
137
+ target_id = get_target_user(message)
138
+
139
+ if not target_id and len(parts) < 2 and not message.reply_to_message:
140
+ bot.reply_to(message, "โš ๏ธ ุงู„ุนุถูˆ ุบูŠุฑ ู…ุญุฏุฏุŒ ู‚ู… ุจุงู„ุฑุฏ ุนู„ู‰ ุฑุณุงู„ุชู‡ ุฃูˆ ุงูƒุชุจ ุงูŠุฏูŠู‡/ูŠูˆุฒุฑู‡.")
141
+ return
142
+
143
+ chat_id = message.chat.id
144
+ settings = get_chat_settings(chat_id)
145
+
146
+ try:
147
+ if command == "ุญุธุฑ":
148
+ bot.ban_chat_member(chat_id, target_id)
149
+ bot.reply_to(message, "ุชู… ุญุธุฑ ุงู„ู…ุณุชุฎุฏู… ุจู†ุฌุงุญ ๐Ÿšซ")
150
+ elif command == "ุงู„ุบุงุก" and len(parts) > 1 and parts[1] == "ุญุธุฑ":
151
+ bot.unban_chat_member(chat_id, target_id, only_if_banned=True)
152
+ bot.reply_to(message, "ุชู… ุฅู„ุบุงุก ุญุธุฑ ุงู„ู…ุณุชุฎุฏู… ุจู†ุฌุงุญ โœ…")
153
+ elif command == "ูƒุชู…":
154
+ bot.restrict_chat_member(chat_id, target_id, can_send_messages=False)
155
+ bot.reply_to(message, "ุชู… ูƒุชู… ุงู„ู…ุณุชุฎุฏู… ุจู†ุฌุงุญ ๐Ÿ”‡")
156
+ elif command == "ุงู„ุบุงุก" and len(parts) > 1 and parts[1] == "ูƒุชู…":
157
+ bot.restrict_chat_member(chat_id, target_id, can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True)
158
+ bot.reply_to(message, "ุชู… ุฅู„ุบุงุก ูƒุชู… ุงู„ู…ุณุชุฎุฏู… ุจู†ุฌุงุญ ๐Ÿ”Š")
159
+ elif command == "ุชู‚ูŠูŠุฏ":
160
+ bot.restrict_chat_member(chat_id, target_id, can_send_messages=False, can_send_media_messages=False)
161
+ bot.reply_to(message, "ุชู… ุชู‚ูŠูŠุฏ ุงู„ู…ุณุชุฎุฏู… ุจู†ุฌุงุญ ๐Ÿšท")
162
+ elif command == "ููƒ":
163
+ bot.restrict_chat_member(chat_id, target_id, can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True, can_add_web_page_previews=True)
164
+ bot.unban_chat_member(chat_id, target_id, only_if_banned=True)
165
+ bot.reply_to(message, "ุชู… ุฑูุน ุฌู…ูŠุน ุงู„ู‚ูŠูˆุฏ ูˆุงู„ุญุธุฑ ุนู† ุงู„ู…ุณุชุฎุฏู… ุจู†ุฌุงุญ โœจ")
166
+ elif command == "ุทุฑุฏ":
167
+ bot.kick_chat_member(chat_id, target_id)
168
+ bot.unban_chat_member(chat_id, target_id) # ุทุฑุฏ ูู‚ุท ูˆู„ูŠุณ ุญุธุฑ ู†ู‡ุงุฆูŠ
169
+ bot.reply_to(message, "ุชู… ุทุฑุฏ ุงู„ู…ุณุชุฎุฏู… ุจู†ุฌุงุญ ๐Ÿ‘ข")
170
+ elif command == "ุชุญุฐูŠุฑ":
171
+ uid_str = str(target_id)
172
+ if uid_str not in settings["warnings"]:
173
+ settings["warnings"][uid_str] = 0
174
+ settings["warnings"][uid_str] += 1
175
+ count = settings["warnings"][uid_str]
176
+ save_db(db)
177
+ if count >= 3:
178
+ bot.restrict_chat_member(chat_id, target_id, can_send_messages=False)
179
+ bot.reply_to(message, f"โš ๏ธ ูˆุตู„ ุงู„ู…ุณุชุฎุฏู… ุฅู„ู‰ 3 ุชุญุฐูŠุฑุงุช ูˆุชู… ูƒุชู…ู‡ ุชู„ู‚ุงุฆูŠุงู‹!")
180
+ else:
181
+ bot.reply_to(message, f"โš ๏ธ ุชู… ุชุญุฐูŠุฑ ุงู„ู…ุณุชุฎุฏู… ({count}/3).")
182
+ elif command == "ุฑูุน":
183
+ rank = " ".join(parts[1:])
184
+ bot.reply_to(message, f"ุชู… ุฑูุน ุงู„ู…ุณุชุฎุฏู… ุจุฑุชุจุฉ ({rank}) ุจู†ุฌุงุญ ๐Ÿ‘‘")
185
+ elif command == "ุชู†ุฒูŠู„":
186
+ bot.reply_to(message, "ุชู… ุชู†ุฒูŠู„ ุฑุชุจุฉ ุงู„ู…ุณุชุฎุฏู… ุจู†ุฌุงุญ ๐Ÿ”ฝ")
187
+ except Exception as e:
188
+ bot.reply_to(message, f"โŒ ุญุฏุซ ุฎุทุฃ (ุชุฃูƒุฏ ุฃู† ุงู„ุจูˆุช ู…ุดุฑู ูˆู„ุฏูŠู‡ ุงู„ุตู„ุงุญูŠุงุช ุงู„ูƒุงููŠุฉ): {str(e)}")
189
+
190
+ # ู…ุฑุงู‚ุจุฉ ุงู„ุฑุณุงุฆู„ ูˆุงู„ูˆุณุงุฆุท (ุฑูˆุงุจุทุŒ ุตูˆุฑุŒ ููŠุฏูŠูˆุŒ ุณุจุŒ ุฐูƒุงุก ุงุตุทู†ุงุนูŠ)
191
+ @bot.message_handler(content_types=['text', 'photo', 'video', 'document', 'audio'])
192
+ def handle_all_messages(message):
193
+ if message.chat.type == 'private':
194
+ return
195
+
196
+ chat_id = message.chat.id
197
+ settings = get_chat_settings(chat_id)
198
+ locks = settings["locks"]
199
+ user_id = message.from_user.id
200
+
201
+ # ุงุณุชุซู†ุงุก ุงู„ู…ุดุฑููŠู† ู…ู† ุงู„ุญุธุฑ ูˆุงู„ูู„ุชุฑุฉ
202
+ try:
203
+ member = bot.get_chat_member(chat_id, user_id)
204
+ if member.status in ['creator', 'administrator']:
205
+ return
206
+ except:
207
+ pass
208
+
209
+ violation = False
210
+ reason = ""
211
+
212
+ # 1. ูุญุต ุงู„ุฑูˆุงุจุท
213
+ if message.text and ("http://" in message.text or "https://" in message.text or "t.me/" in message.text):
214
+ if locks.get("links", True):
215
+ violation = true
216
+ reason = "ู…ู…ู†ูˆุน ู†ุดุฑ ุงู„ุฑูˆุงุจุท ููŠ ุงู„ู…ุฌู…ูˆุนุฉ ๐Ÿšซ"
217
+
218
+ # 2. ูุญุต ุงู„ุตูˆุฑ
219
+ if message.photo and locks.get("photos", True):
220
+ violation = True
221
+ reason = "ู…ู…ู†ูˆุน ุฅุฑุณุงู„ ุงู„ุตูˆุฑ ููŠ ุงู„ู…ุฌู…ูˆุนุฉ ๐Ÿ–ผ๏ธ"
222
+
223
+ # 3. ูุญุต ุงู„ููŠุฏูŠูˆู‡ุงุช
224
+ if message.video and locks.get("videos", True):
225
+ violation = True
226
+ reason = "ู…ู…ู†ูˆุน ุฅุฑุณุงู„ ุงู„ููŠุฏูŠูˆู‡ุงุช ููŠ ุงู„ู…ุฌู…ูˆุนุฉ ๐ŸŽฅ"
227
+
228
+ # 4. ูุญุต ุงู„ุณุจ ูˆุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ
229
+ if message.text and (locks.get("badwords", True) or locks.get("ai_filter", True)):
230
+ is_bad, ai_reason = ai_check_content(message.text)
231
+ if is_bad:
232
+ violation = True
233
+ reason = ai_reason
234
+
235
+ # ุชุทุจูŠู‚ ุงู„ุนู‚ูˆุจุฉ ุนู†ุฏ ุงู„ู…ุฎุงู„ูุฉ (ุญุฐู ุงู„ุฑุณุงู„ุฉ + ุชุญุฐูŠุฑ ุชู„ู‚ุงุฆูŠ)
236
+ if violation:
237
+ try:
238
+ bot.delete_message(chat_id, message.message_id)
239
+ except:
240
+ pass
241
+
242
+ uid_str = str(user_id)
243
+ if uid_str not in settings["warnings"]:
244
+ settings["warnings"][uid_str] = 0
245
+ settings["warnings"][uid_str] += 1
246
+ count = settings["warnings"][uid_str]
247
+ save_db(db)
248
+
249
+ if count >= 3:
250
+ try:
251
+ bot.restrict_chat_member(chat_id, user_id, can_send_messages=False)
252
+ bot.send_message(chat_id, f"๐Ÿ‘ค ุงู„ุนุถูˆ @{message.from_user.username or message.from_user.first_name}\nโŒ ุชุฌุงูˆุฒ 3 ู…ุฎุงู„ูุงุช ({reason}) ูˆุชู… ูƒุชู…ู‡ ุชู„ู‚ุงุฆูŠุงู‹!")
253
+ except:
254
+ pass
255
+ else:
256
+ bot.send_message(chat_id, f"โš ๏ธ ุชู†ุจูŠู‡ ({count}/3) ู„ู€ @{message.from_user.username or message.from_user.first_name}: {reason}")
257
+
258
+ # --- ู†ุธุงู… ุฅุฑุณุงู„ ุงู„ุฃุฏุนูŠุฉ ูˆุงู„ู‚ุฑุขู† ุงู„ุชู„ู‚ุงุฆูŠ (ูƒู„ 15 ุฏู‚ูŠู‚ุฉ) ---
259
+ AZKAR_LIST = [
260
+ "๏ดฟ ุฑูŽุจูู‘ ุฃูŽูˆู’ุฒูุนู’ู†ููŠ ุฃูŽู†ู’ ุฃูŽุดู’ูƒูุฑูŽ ู†ูุนู’ู…ูŽุชูŽูƒูŽ ุงู„ูŽู‘ุชูŠ ุฃูŽู†ู’ุนูŽู…ู’ุชูŽ ุนูŽู„ูŽูŠูŽู‘ ูˆูŽุนูŽู„ูŽู‰ ูˆูŽุงู„ูุฏูŽูŠูŽู‘ ๏ดพ ๐ŸŒ™",
261
+ "ุณูุจู’ุญูŽุงู† ุงู„ู„ู‡ู ูˆูŽุจูุญูŽู…ู’ุฏูู‡ูุŒ ุณูุจู’ุญูŽุงู† ุงู„ู„ู‡ู ุงู„ุนูŽุธููŠู…ู ๐Ÿ“ฟ",
262
+ "ู„ูŽุง ุญูŽูˆู’ู„ูŽ ูˆูŽู„ูŽุง ู‚ููˆูŽู‘ุฉูŽ ุฅูู„ูŽู‘ุง ุจูุงู„ู„ูŽู‘ู‡ู ุงู„ุนูŽู„ููŠูู‘ ุงู„ุนูŽุธููŠู…ู ๐Ÿ•Š๏ธ",
263
+ "ุงู„ู„ู‘ู‡ูู…ูŽู‘ ุฅูู†ูู‘ูŠ ุฃูŽุณู’ุฃูŽู„ููƒูŽ ุงู„ุนูŽูู’ูˆูŽ ูˆูŽุงู„ุนูŽุงูููŠูŽุฉูŽ ูููŠ ุงู„ุฏูู‘ู†ู’ูŠูŽุง ูˆูŽุงู„ุขุฎูุฑูŽุฉู ๐Ÿคฒ",
264
+ "ุฃูŽุณู’ุชูŽุบู’ููุฑู ุงู„ู„ู‘ูŽู‡ูŽ ุงู„ุนูŽุธููŠู…ูŽ ูˆูŽุฃูŽุชููˆุจู ุฅูู„ูŽูŠู’ู‡ู ๐ŸŒฟ",
265
+ "ู„ุง ุฅู„ู‡ ุฅู„ุง ุฃู†ุช ุณุจุญุงู†ูƒ ุฅู†ูŠ ูƒู†ุช ู…ู† ุงู„ุธุงู„ู…ูŠู† โœจ"
266
+ ]
267
+
268
+ def background_sender():
269
+ while True:
270
+ time.sleep(900) # ูƒู„ 15 ุฏู‚ูŠู‚ุฉ
271
+ current_db = load_db()
272
+ for c_id in current_db.keys():
273
+ try:
274
+ import random
275
+ azkar = random.choice(AZKAR_LIST)
276
+ bot.send_message(int(c_id), f"๐Ÿ“ข **ุชุฐูƒูŠุฑ ุฅูŠู…ุงู†ูŠ:**\n\n{azkar}\n\n- ุงู„ุจูˆุช ุฃุฌุฑ ู„ูŠ ูˆู„ูƒู… ๐ŸŒ™", parse_mode="Markdown")
277
+ except Exception as e:
278
+ print(f"Error sending to {c_id}: {e}")
279
+
280
+ threading.Thread(target=background_sender, daemon=True).start()
281
+
282
+ # --- ุฎุงุฏู… Flask ูˆูˆู‡ู…ูŠ ู„ุถู…ุงู† ุงุณุชู…ุฑุงุฑ ุงู„ุชุดุบูŠู„ ุนู„ู‰ Hugging Face Spaces ---
283
+ app = Flask(__name__)
284
+
285
+ @app.route('/')
286
+ def home():
287
+ return "Bot is running 24/7 successfully! ๐Ÿš€"
288
+
289
+ def run_flask():
290
+ app.run(host="0.0.0.0", port=7860)
291
+
292
+ threading.Thread(target=run_flask, daemon=True).start()
293
+
294
+ # ุชุดุบูŠู„ ูˆุงุฌู‡ุฉ Gradio ุงู„ู…ุทู„ูˆุจุฉ ู„ู…ู†ุตุฉ Hugging Face
295
+ demo = gr.Interface(fn=lambda: "Bot is Active!", inputs=None, outputs="text")
296
+
297
+ if __name__ == "__main__":
298
+ threading.Thread(target=demo.launch, kwargs={"server_name": "0.0.0.0", "server_port": 7860, "share": False, "inline": False}).start()
299
+ bot.infinity_polling(skip_pending=True)