l1l11 commited on
Commit
749d864
·
verified ·
1 Parent(s): 7e6081f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +251 -0
app.py ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import telebot
2
+ from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton, BotCommand
3
+ import re
4
+
5
+ # --- الإعدادات ---
6
+ TOKEN = '8210606198:AAGdFQTlpCAarpxsz5SfZtWsF7zFfafd5Pg'
7
+ DEVELOPER_ID = 7968256413 # ضع الـ ID الخاص بك هنا
8
+
9
+ bot = telebot.TeleBot(TOKEN)
10
+
11
+ # --- 1. دالة القائمة (هنا نضع الـ scope لضمان الظهور) ---
12
+ def set_bot_commands():
13
+ commands = [
14
+ BotCommand("start", "القائمة الرئيسية والأزرار"),
15
+ BotCommand("tool1", "مكتبة 1"),
16
+ BotCommand("tool2", " مكتبة 2"),
17
+ BotCommand("tool3", " مكتبة 3"),
18
+ BotCommand("dev", "تواصل مع المطور")
19
+ ]
20
+ bot.set_my_commands(commands, scope=BotCommandScopeDefault())
21
+
22
+
23
+
24
+ user_status = {}
25
+
26
+ # --- بنك الأكواد البرمجية ---
27
+ TOOLS_CODES = {
28
+ "c1": """``` #PyTool Kit
29
+ import os
30
+ print("لاتنسه متابعتي علئ قناتي التليجرام @ll14bo")
31
+ print("∞"*60)
32
+ os.system('pip install requests')
33
+ os.system('pip install pyfiglet')
34
+ os.system('pip install sys')
35
+ os.system('pip install py_compile')
36
+ os.system('pip install youtube_dl')
37
+ os.system('pip install uuid')
38
+ os.system('pip install time')
39
+ os.system('pip install os')
40
+ os.system('pip install random')
41
+ os.system('pip install datetime')
42
+ os.system('pip install string')
43
+ os.system('pip install secrets')
44
+ os.system('pip install webbrowser')
45
+ os.system('pip install hashlib')
46
+ os.system('pip install colorama')
47
+ os.system('pip install n')
48
+ os.system('pip install mm')
49
+ os.system('pip install new')
50
+ os.system('pip install sleep')
51
+ os.system('pip install BeautifulSoup')
52
+ os.system('pip install new')
53
+ os.system('pip install pafy')
54
+ os.system('pip install bs4')
55
+ os.system('pip install sys')
56
+ os.system('pip install json')
57
+ os.system('pip install random')
58
+ os.system('pip install uuid')
59
+ os.system('pip install secrets')
60
+ os.system('pip install datetime')
61
+ os.system('pip install *')
62
+ os.system('pip install argparse')
63
+ os.system('pip install InstagramAPI')
64
+ os.system('pip install sleep')
65
+ os.system('pip install string')
66
+ os.system('pip install uuid4')
67
+ os.system('pip install generate_user_agent')
68
+ os.system('pip install threading')
69
+ os.system('pip install json')
70
+ os.system('pip install datetime')
71
+ os.system('pip install token_hex')
72
+ os.system('pip install secrets')
73
+ os.system('pip install token_hex')
74
+ os.system('pip install Fore')
75
+ os.system('pip install secrets')
76
+ os.system('pip install uuid')
77
+ os.system('pip install re')
78
+ os.system('pip install b')
79
+ os.system('cls' if os.name == 'nt' else 'clear')
80
+ print("≠"*60)
81
+ print("تم اكتمال جميع المكاتب الان يمكن استخدام اي اداة بدون مشكله ")
82
+ print("Welcome to PyTool Kit")
83
+ ```""",
84
+ "c2": """``` #PYTool Kit
85
+ import os
86
+ print("لاتنسه متابعتي علئ قناتي التليجرام @bthon @ll14bo")
87
+ print("∞"*5)
88
+ os.system('pip install os')
89
+ os.system('pip install requests')
90
+ os.system('pip install instaloader')
91
+ os.system('pip webbrowser')
92
+ os.system('time')
93
+ ```""",
94
+ "c3": """``` #PyTool Kit
95
+ import os , sys
96
+ from time import sleep
97
+
98
+ installed = 0
99
+ os.system('pip3 install --upgrade pip')
100
+
101
+ try:
102
+ import requests
103
+ except:
104
+ os.system('pip install requests')
105
+ installed +=1
106
+
107
+ try:
108
+ import user_agent
109
+ except:
110
+ os.system('pip install user_agent')
111
+ installed +=1
112
+
113
+ try:
114
+ import colorama
115
+ except:
116
+ os.system('pip install colorama')
117
+ installed +=1
118
+
119
+ try:
120
+ import myigbot
121
+ except:
122
+ os.system('pip install myigbot')
123
+ installed +=1
124
+
125
+ try:
126
+ from uuid import uuid4
127
+ except:
128
+ os.system('pip install uuid')
129
+ installed +=1
130
+
131
+
132
+ try:
133
+ from bs4 import BeautifulSoup
134
+ except:
135
+ os.system('pip install bs4')
136
+ installed +=1
137
+
138
+ try:
139
+ import wget
140
+ except:
141
+ os.system('pip install wget')
142
+ installed +=1
143
+
144
+ try:
145
+ import telebot
146
+ except:
147
+ os.system('pip uninstall telebot')
148
+ os.system('pip uninstall PyTelegramBotAPI')
149
+ os.system('pip install PyTelegramBotAPI==3.6.7')
150
+ installed +=1
151
+
152
+ try:
153
+ import pyfiglet
154
+ except:
155
+ os.system('pip install pyfiglet')
156
+ installed +=1
157
+
158
+ try:
159
+ import webbrowser
160
+ except:
161
+ os.system('pip install webbrowser')
162
+ installed +=1
163
+
164
+ os.system('cls' if os.name == 'nt' else 'clear')
165
+
166
+ print('[-] Done Install '+str(installed)+ 'library')
167
+ webbrowser.open('https://t.me/ll14bo')
168
+ sleep(5)
169
+ quit()
170
+ ```"""
171
+ }
172
+ # --- 2. معالجة الأوامر ---
173
+ @bot.message_handler(commands=['start'])
174
+ def start(message):
175
+ user_status[message.chat.id] = None
176
+ markup = InlineKeyboardMarkup()
177
+ btn1 = InlineKeyboardButton("📂 مكتبة 1", callback_data="c1")
178
+ btn2 = InlineKeyboardButton("📂 مكتبة 2", callback_data="c2")
179
+ btn3 = InlineKeyboardButton("📂 مكتبة 3", callback_data="c3")
180
+ dev_btn = InlineKeyboardButton("👨‍💻 المطور Developer", callback_data="dev")
181
+
182
+ markup.row(btn1, btn2, btn3)
183
+ markup.row(dev_btn)
184
+
185
+ bot.send_message(message.chat.id, "أهلاً بك! اختر من القائمة أو الأزرار:", reply_markup=markup)
186
+
187
+
188
+
189
+ @bot.message_handler(commands=['start'])
190
+ def start(message):
191
+ user_status[message.chat.id] = None
192
+ markup = InlineKeyboardMarkup(row_width=2)
193
+ # إضافة أزرار الأكواد
194
+ btn1 = InlineKeyboardButton("📂lib مكتبة 1", callback_data="c1")
195
+ btn2 = InlineKeyboardButton("📂lib مكتبة 2", callback_data="c2")
196
+ btn3 = InlineKeyboardButton("📂lib مكتبة 3", callback_data="c3")
197
+ dev_btn = InlineKeyboardButton("👨‍💻 المطور Developer", callback_data="dev")
198
+
199
+ # إضافة أول 3 أزرار في صف واحد
200
+ markup.row(btn1, btn2, btn3)
201
+
202
+ # إضافة زر المطور في صف منفرد
203
+ markup.row(dev_btn)
204
+
205
+ bot.send_message(message.chat.id, "Welcome! Choose a tool code or contact me:", reply_markup=markup)
206
+
207
+ @bot.callback_query_handler(func=lambda call: True)
208
+ def handle_query(call):
209
+ if call.data == "dev":
210
+ user_status[call.message.chat.id] = 'waiting'
211
+ bot.send_message(call.message.chat.id, " Send your problem or anything else now (text, image, file) and the developer will get in touch...\n \n 📤 أرسل مشكلتك او أي شيء الآن (نص، صورة، ملف) وسيصل للمطور. \nالقناة @ll14bo")
212
+
213
+ elif call.data in TOOLS_CODES:
214
+ user_status[call.message.chat.id] = None
215
+ bot.send_message(call.message.chat.id, TOOLS_CODES[call.data], parse_mode='Markdown')
216
+
217
+ bot.answer_callback_query(call.id)
218
+
219
+ # 1. نظام تحويل رسائل المستخدم للمطور (يدعم كل الأنواع)
220
+ @bot.message_handler(func=lambda m: user_status.get(m.chat.id) == 'waiting',
221
+ content_types=['text', 'photo', 'document', 'video', 'voice'])
222
+ def forward_to_dev(message):
223
+ # إرسال رسالة تنبيه للمطور تحتوي على ID المستخدم
224
+ bot.send_message(DEVELOPER_ID, f"📩 رسالة من: `{message.chat.id}`\n(قم بالرد على هذه الرسالة للمراسلة)", parse_mode='Markdown')
225
+ # تحويل الرسالة الفعلية
226
+ bot.forward_message(DEVELOPER_ID, message.chat.id, message.message_id)
227
+ bot.reply_to(message, "The message was successfully forwarded.\n ✅ تم إرسال رسالتك بنجاح.")
228
+ user_status[message.chat.id] = None
229
+
230
+ # 2. نظام رد المطور (اعمل Reply على رسالة الـ ID)
231
+ @bot.message_handler(func=lambda message: message.from_user.id == DEVELOPER_ID and message.reply_to_message is not None)
232
+ def reply_to_user(message):
233
+ try:
234
+ # استخراج الـ ID من نص الرسالة التي تم الرد عليها
235
+ reply_text = message.reply_to_message.text if message.reply_to_message.text else message.reply_to_message.caption
236
+ match = re.search(r'\d{7,}', reply_text)
237
+
238
+ if match:
239
+ target_id = match.group()
240
+ bot.send_message(target_id, f"👨‍💻 **رد من المطور:**\n\n{message.text}", parse_mode='Markdown')
241
+ bot.reply_to(message, "✅ تم إرسال ردك للمستخدم.")
242
+ else:
243
+ bot.reply_to(message, "❌ لم أجد ID المستخدم في الرسالة. تأكد من الرد على الرسالة التي تحتوي على الرقم.")
244
+ except Exception as e:
245
+ bot.reply_to(message, f"❌ حدث خطأ: {e}")
246
+
247
+ bot.delete_my_commands()
248
+ set_bot_commands()
249
+
250
+ print("البوت يعمل الان.......")
251
+ bot.infinity_polling()