1 694
مشترکین
اطلاعاتی وجود ندارد24 ساعت
+107 روز
+14130 روز
آرشیو پست ها
1 694
elif text == "🗑️ حذف منتج":
if not store_data:
await update.message.reply_text("❌ لا توجد منتجات لحذفها.")
return
keyboard = [[InlineKeyboardButton(f"🗑️ حذف: {ci['name']}", callback_data=f"adm_del_prod_{ck}")] for ck, ci in store_data.items()]
await update.message.reply_text("🗑️ اختر المنتج المراد حذفه:", reply_markup=InlineKeyboardMarkup(keyboard))
return
elif text == "⏱️ إضافة مدة للمنتج":
if not store_data:
await update.message.reply_text("❌ لا توجد منتجات.")
return
keyboard = [[InlineKeyboardButton(ci['name'], callback_data=f"adm_add_dur_{ck}")] for ck, ci in store_data.items()]
await update.message.reply_text("📌 اختر المنتج لإضافة المدة له:", reply_markup=InlineKeyboardMarkup(keyboard))
return
elif text == "🗑️ حذف مدة من منتج":
if not store_data:
await update.message.reply_text("❌ لا توجد منتجات.")
return
keyboard = [[InlineKeyboardButton(f"{ci['name']} ({di['name']})", callback_data=f"adm_del_dur_{ck}_{dk}")] for ck, ci in store_data.items() for dk, di in ci['durations'].items()]
await update.message.reply_text("🗑️ اختر المدة المراد حذفها:", reply_markup=InlineKeyboardMarkup(keyboard))
return
elif text == "📦 إضافة كود للمخزون":
if not store_data:
await update.message.reply_text("❌ لا توجد منتجات.")
return
keyboard = [[InlineKeyboardButton(f"{ci['name']} ({di['name']})", callback_data=f"adm_stock_{ck}_{dk}")] for ck, ci in store_data.items() for dk, di in ci['durations'].items()]
await update.message.reply_text("📦 اختر المدة للإضافة:", reply_markup=InlineKeyboardMarkup(keyboard))
return
elif text == "📋 إدارة المتجر":
msg = "📦 المتجر والمخزون:\n\n"
for ck, ci in store_data.items():
msg += f"📌 {ci['name']}\n"
for dk, di in ci['durations'].items():
msg += f" - ⏱️ {di['name']} | 💰 {di['points']} نقطة | المخزون:
{len(di['stock'])}\n"
await update.message.reply_text(msg, parse_mode="Markdown")
return
elif text == "📊 إحصائيات البوت":
stats_msg = f"📊 الإحصائيات:\n👥 المستخدمين: {len(user_points)}\n🔑 المفاتيح المباعة: {sum(len(k) for k in user_keys.values())}\n👑 البائعين: {len(sellers_dict)}"
await update.message.reply_text(stats_msg, parse_mode="Markdown")
return
elif text == "📢 إذاعة للكل":
admin_temp_state[user_id] = {"action": "broadcast"}
await update.message.reply_text("📢 أرسل نص الإذاعة:")
return
elif text == "👤 إضافة أدمن":
admin_temp_state[user_id] = {"action": "add_admin_id"}
await update.message.reply_text("👤 أرسل ID الأدمن الجديد:")
return
# 3. معالجة أزرار المستخدمين العاديين
if text == "حسابي 👤":
account_info = f"👤 My Account\n\n🆔 ID: {user.id}\n💰 Points: {user_points.get(user.id, 0)}\n🛒 Codes purchased: {len(user_keys.get(user.id, []))}\n🔗 Referrals: {user_referrals.get(user.id, 0)}\n\n🔗 Your link:\nhttps://t.me/{context.bot.username}?start={user.id}"
await update.message.reply_text(account_info, parse_mode="Markdown")
return
elif text == "الإحالة 🎁":
ref_msg = f"🎁 نظام الإحالة:\n\n👥 دعوتهم: {user_referrals.get(user.id, 0)}\n💰 الربح: 3 نقاط لكل شخص.\n\n🔗 رابطك:\nhttps://t.me/{context.bot.username}?start={user.id}"
await update.message.reply_text(ref_msg, parse_mode="Markdown")
return
elif text == "المتجر 🛍️":
if not store_data:
await update.message.reply_text("🛍️ المتجر فارغ.")
else:
await update.message.reply_text("🛍️ اختر المنتج:", reply_markup=get_store_keyboard())
return1 694
elif state["action"] == "add_dur_price":
try:
price = int(text)
cat_key = state["cat_key"]
dur_name = state["dur_name"]
dur_key = f"dur_{random.randint(1000, 9999)}"
store_data[cat_key]["durations"][dur_key] = {"name": dur_name, "points": price, "stock": []}
del admin_temp_state[user_id]
await update.message.reply_text(f"✅ تم إضافة المدة
{dur_name} بسعر {price} نقطة بنجاح!")
except:
await update.message.reply_text("❌ يرجى إرسال السعر بالأرقام.")
return
elif state["action"] == "add_stock_code":
cat_key = state["cat_key"]
dur_key = state["dur_key"]
store_data[cat_key]["durations"][dur_key]["stock"].append(text)
del admin_temp_state[user_id]
total_stock = len(store_data[cat_key]["durations"][dur_key]["stock"])
await update.message.reply_text(f"✅ تم إضافة الكود بنجاح!\n📦 إجمالي المخزون: {total_stock}")
return
elif state["action"] == "broadcast":
del admin_temp_state[user_id]
success_count = 0
for uid in user_points.keys():
try:
await context.bot.send_message(chat_id=uid, text=f"📢 إعلان هام:\n\n{text}", parse_mode="Markdown")
success_count += 1
except:
pass
await update.message.reply_text(f"✅ تمت الإذاعة إلى {success_count} مستخدم.")
return
elif state["action"] == "add_admin_id":
try:
new_ad = int(text)
del admin_temp_state[user_id]
if new_ad not in admins_list:
admins_list.append(new_ad)
await update.message.reply_text(f"✅ تم رفع المستخدم {new_ad} كأدمن.")
else:
await update.message.reply_text("ℹ️ المستخدم أدمن بالفعل.")
except:
await update.message.reply_text("❌ يرجى إرسال ID صحيح.")
return
# 2. معالجة أزرار لوحة تحكم الأدمن
if user_id in admins_list:
if text == "👑 لوحة الأدمن":
await update.message.reply_text("أهلاً بك في لوحة تحكم الأدمن:", reply_markup=get_admin_keyboard())
return
elif text == "🔙 العودة للقائمة الرئيسية":
await update.message.reply_text("القائمة الرئيسية:", reply_markup=get_main_keyboard(user_id))
return
elif text == "➕ إضافة نقاط":
admin_temp_state[user_id] = {"action": "add_points_id"}
await update.message.reply_text("👤 أرسل ID المستخدم لإضافة النقاط:")
return
elif text == "➖ خصم نقاط":
admin_temp_state[user_id] = {"action": "sub_points_id"}
await update.message.reply_text("👤 أرسل ID المستخدم لخصم النقاط:")
return
elif text == "🌟 زيادة نقاط للجميع":
admin_temp_state[user_id] = {"action": "add_all_points"}
await update.message.reply_text("🌟 أرسل عدد النقاط المراد إضافتها لكل مستخدمي البوت:")
return
elif text == "👑 إدارة البائعين":
keyboard = [
[InlineKeyboardButton("➕ إضافة بائع جديد", callback_data="adm_add_seller")],
[InlineKeyboardButton("🗑️ حذف بائع", callback_data="adm_del_seller_menu")]
]
await update.message.reply_text("👑 إدارة البائعين:", reply_markup=InlineKeyboardMarkup(keyboard))
return
elif text == "➕ إضافة منتج":
admin_temp_state[user_id] = {"action": "add_product_name"}
await update.message.reply_text("🏷️ أرسل اسم المنتج الجديد:")
return1 694
state = admin_temp_state[user_id]
if state["action"] == "add_points_id":
try:
target_id = int(text)
admin_temp_state[user_id] = {"action": "add_points_val", "target_id": target_id}
await update.message.reply_text("أدخل عدد النقاط المراد إضافتها:")
except:
await update.message.reply_text("❌ يرجى إرسال ID صحيح.")
return
elif state["action"] == "add_points_val":
try:
amount = int(text)
target_id = state["target_id"]
user_points[target_id] = user_points.get(target_id, 0) + amount
del admin_temp_state[user_id]
await update.message.reply_text(f"✅ تم إضافة {amount} نقطة للمستخدم
{target_id} بنجاح.", parse_mode="Markdown")
except:
await update.message.reply_text("❌ يرجى إرسال رقم صحيح.")
return
elif state["action"] == "sub_points_id":
try:
target_id = int(text)
admin_temp_state[user_id] = {"action": "sub_points_val", "target_id": target_id}
await update.message.reply_text("أدخل عدد النقاط المراد خصمها:")
except:
await update.message.reply_text("❌ يرجى إرسال ID صحيح.")
return
elif state["action"] == "sub_points_val":
try:
amount = int(text)
target_id = state["target_id"]
user_points[target_id] = user_points.get(target_id, 0) - amount
del admin_temp_state[user_id]
await update.message.reply_text(f"✅ تم خصم {amount} نقطة من المستخدم {target_id} بنجاح.", parse_mode="Markdown")
except:
await update.message.reply_text("❌ يرجى إرسال رقم صحيح.")
return
elif state["action"] == "add_all_points":
try:
amount = int(text)
for uid in user_points.keys():
user_points[uid] += amount
del admin_temp_state[user_id]
await update.message.reply_text(f"✅ تم إضافة {amount} نقطة لجميع المستخدمين في البوت بنجاح.")
except:
await update.message.reply_text("❌ يرجى إرسال رقم صحيح.")
return
elif state["action"] == "add_seller_id":
try:
seller_id = int(text)
admin_temp_state[user_id] = {"action": "add_seller_points", "seller_id": seller_id}
await update.message.reply_text("أدخل عدد النقاط *اليومية* التي يحصل عليها هذا البائع:")
except:
await update.message.reply_text("❌ يرجى إرسال ID صحيح للبائع.")
return
elif state["action"] == "add_seller_points":
try:
daily_pts = int(text)
seller_id = state["seller_id"]
sellers_dict[seller_id] = daily_pts
del admin_temp_state[user_id]
await update.message.reply_text(f"✅ تم تعيين المستخدم {seller_id} كبائع بنجاح!\n⭐ النقاط اليومية: {daily_pts} نقطة.", parse_mode="Markdown")
except:
await update.message.reply_text("❌ يرجى إرسال عدد نقاط صحيح.")
return
elif state["action"] == "add_product_name":
prod_name = text
prod_key = f"prod_{random.randint(1000, 9999)}"
store_data[prod_key] = {"name": prod_name, "durations": {}}
del admin_temp_state[user_id]
await update.message.reply_text(f"✅ تم إضافة المنتج {prod_name} بنجاح!", parse_mode="Markdown")
return
elif state["action"] == "add_dur_name":
cat_key = state["cat_key"]
admin_temp_state[user_id] = {"action": "add_dur_price", "cat_key": cat_key, "dur_name": text}
await update.message.reply_text(f"💰 أرسل الآن سعر هذه المدة ({text}) بالنقاط:")
return1 694
import asyncio
from telegram import Update, ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler, MessageHandler, CallbackQueryHandler, filters
import random
TOKEN = "8727568166:AAHZ-1SxUR1Ezh46C2a5emauFzBKAddSZ1Q"
ADMIN_ID = 7527313092
admins_list = [7527313092]
user_points = {}
user_keys = {}
user_referrals = {}
sellers_dict = {} # {seller_id: daily_points}
store_data = {
"prime_panel": {
"name": "⚡ PRIME PANEL",
"durations": {
"prime_1d": {"name": "1 Day", "points": 12, "stock": ["PRIME-11111-VIP", "PRIME-22222-VIP"]}
}
}
}
admin_temp_state = {}
def get_main_keyboard(user_id):
keyboard = [
[{"text": "حسابي 👤"}, {"text": "المتجر 🛍️"}],
[{"text": "مفاتيحي 🔑"}, {"text": "English 🌐"}],
[{"text": "الإحالة 🎁"}, {"text": "شحن نقاط ⭐"}],
[{"text": "تحميل APK 📱"}, {"text": "تحديث البانل 🔄"}],
[{"text": "اشتري صلاحية بائع 👑"}]
]
if user_id in admins_list:
keyboard.append([{"text": "👑 لوحة الأدمن"}])
return ReplyKeyboardMarkup(keyboard, resize_keyboard=True)
def get_admin_keyboard():
keyboard = [
["➕ إضافة نقاط", "➖ خصم نقاط"],
["🌟 زيادة نقاط للجميع"],
["➕ إضافة منتج", "🗑️ حذف منتج"],
["⏱️ إضافة مدة للمنتج", "🗑️ حذف مدة من منتج"],
["📦 إضافة كود للمخزون", "📋 إدارة المتجر"],
["📊 إحصائيات البوت", "👑 إدارة البائعين"],
["📢 إذاعة للكل", "👤 إضافة أدمن"],
["🔙 العودة للقائمة الرئيسية"]
]
return ReplyKeyboardMarkup(keyboard, resize_keyboard=True)
def get_store_keyboard():
keyboard = []
for cat_key, cat_info in store_data.items():
keyboard.append([InlineKeyboardButton(cat_info['name'], callback_data=f"store_cat_{cat_key}")])
return InlineKeyboardMarkup(keyboard)
def get_durations_keyboard(cat_key):
keyboard = []
cat_info = store_data[cat_key]
for dur_key, dur_info in cat_info['durations'].items():
stock_count = len(dur_info['stock'])
status_text = f"🟢 ({stock_count} متاح)" if stock_count > 0 else "🔴 (نفذت الكمية)"
keyboard.append([InlineKeyboardButton(f"⏱️ {dur_info['name']} — {dur_info['points']} نقطة {status_text}", callback_data=f"store_dur_{cat_key}_{dur_key}")])
keyboard.append([InlineKeyboardButton("◀️ Back", callback_data="back_to_store_main")])
return InlineKeyboardMarkup(keyboard)
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
user_id = update.effective_user.id
if user_id not in user_points:
user_points[user_id] = 0
if context.args:
try:
referrer_id = int(context.args[0])
if referrer_id != user_id and referrer_id in user_points:
user_points[referrer_id] += 3
user_referrals[referrer_id] = user_referrals.get(referrer_id, 0) + 1
try:
await context.bot.send_message(
chat_id=referrer_id,
text="🎁 مبروك! دخل مستخدم جديد عبر رابط الإحالة الخاص بك وتم إضافة
3 نقاط إلى رصيدك.",
parse_mode="Markdown"
)
except:
pass
except:
pass
await update.message.reply_text(
"مرحباً بك في البوت! اختر ما يناسبك من الأزرار أدناه:",
reply_markup=get_main_keyboard(user_id)
)
async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
text = update.message.text.strip()
user = update.effective_user
user_id = user.id
# 1. معالجة الحالات المؤقتة للأدمن
if user_id in admins_list and user_id in admin_temp_state:1 694
خلاص، ما تعملوش مسابقات اليوم يا مشرفين ❤️
غدوة إن شاء الله ديرو المسابقات.
شكراً ليكم، والله ما قصرتوا 🤍🔥
ربي يحفظكم ويعطيكم الصحة على مجهودكم 👑❤️
