لوجيك | Logic
Kanalga Telegram’da o‘tish
#لوجيك | Logic وجهتك البرمجية الأولى بالوطن العربي شروحات - أكواد - وأحدث تقنيات برمجية - وحلول تقنية بواسطه: @TopVeGa
Ko'proq ko'rsatish4 850
Obunachilar
-224 soatlar
+207 kun
+4 37730 kun
Postlar arxiv
4 851
InlineKeyboardButton("حذف", callback_data=f"do_delete_{index}_{user_id}")
],
[
InlineKeyboardButton("رجوع للقائمة", callback_data=f"back_to_list_{user_id}")
]
]
markup = InlineKeyboardMarkup(buttons)
await callback_query.message.edit_text(f"{title}", reply_markup=markup)
await callback_query.answer()
@Client.on_callback_query(filters.regex(r"^do_play_(\d+)_(\d+)$"))
async def do_play(client, callback_query):
user_id = callback_query.from_user.id
group_id = callback_query.message.chat.id
index = int(callback_query.data.split("_")[2])
if user_id not in user_lists or index >= len(user_lists[user_id]):
return await callback_query.answer("هذا المقطع غير موجود.", show_alert=True)
item = user_lists[user_id][index]
c = await join_call(
item["bot_username"],
client,
callback_query.message,
item["audio_file"],
group_id,
item["vid"],
item["code"],
item["user_mention"],
item["useram"],
item["videoid"],
item["video_duration"],
item["channel_name"],
item["thum"],
item["views"]
)
if c:
await callback_query.message.edit_text(f"تم تشغيل المقطع: {item.get('channel_name', 'بدون عنوان')}")
else:
await callback_query.message.edit_text(f"تم تشغيل المقطع: {item.get('channel_name', 'بدون عنوان')}")
@Client.on_callback_query(filters.regex(r"^do_delete_(\d+)_(\d+)$"))
async def ddelete(client, callback_query):
user_id = callback_query.from_user.id
index = int(callback_query.data.split("_")[2])
if user_id not in user_lists or index >= len(user_lists[user_id]):
return await callback_query.answer("هذا المقطع غير موجود.", show_alert=True)
deleted_title = user_lists[user_id][index].get("channel_name", "بدون عنوان")
user_lists[user_id].pop(index)
await callback_query.message.edit_text(f"تم حذف المقطع")
@Client.on_callback_query(filters.regex(r"^back_to_list_(\d+)$"))
async def back_to_list(client, callback_query):
await sh_user_list(client, callback_query)
await callback_query.answer()
async def sh_user_list(client, callback_query):
user_id = callback_query.from_user.id
if user_id not in user_lists or not user_lists[user_id]:
await callback_query.message.edit_text("قائمتك فارغة")
return
buttons = []
for i, item in enumerate(user_lists[user_id]):
title = item.get("thum", "بدون عنوان")
title = title[:20] if len(title) > 20 else title
buttons.append([InlineKeyboardButton(text=f"{title}", callback_data=f"play_{i}_{user_id}")])
markup = InlineKeyboardMarkup(buttons)
await callback_query.message.edit_text("اختر مقطعًا لتشغيله:", reply_markup=markup)
`
• أول فريق مصري متخصص في تطوير بايثون Python
• القناة #Code الرسميـة الرائدة في تـعليم البرمجة عربيًا
• جميع الحقوق و النشر محفوظة: ©️ VEGA™ 2015
• مطور ومُنشئ المحتوى:
• @TopVeGa
• @DevVeGa4 851
كود اضف لقائمتي
كود يعمل علي ملفات مثل هذا ملف يمكن تطوير و تعديل عليه واضافة كوكيز او api قم برابطه لتطبيقك الخاص
`
from youtubesearchpython import SearchVideos
import re, os
from yt_dlp import YoutubeDL
lists = {}
user_lists = {}
@Client.on_message(filters.command(["اضف لقائمتي"], ""))
async def add_to_user_list(client, message):
group_id = message.chat.id
user_id = message.from_user.id
text = message.text.split(None, 1)
user_lists.setdefault(user_id, [])
if len(user_lists[user_id]) >= 10:
return await message.reply("لا يمكنك إضافة أكثر من 10 مقاطع إلى قائمتك")
parts = message.text.split(None, 2)
if len(parts) == 3:
query = parts[2]
search = SearchVideos(query, offset=1, mode="dict", max_results=1)
code = search.result()
if not code["search_result"]:
return await message.reply("لم يتم العثور على نتائج.")
video_info = code["search_result"][0]
video_link = video_info["link"]
videoid = video_info["id"]
channel_name = video_info["channel"]
thum = video_info["title"]
title = re.sub(r"\W+", " ", thum).title()
video_duration = video_info.get("duration", "0")
views = video_info.get("views", "غير متوفر")
useram = f"https://img.youtube.com/vi/{videoid}/hqdefault.jpg"
audio_file = os.path.join(DOWNLOAD_FOLDER, f"{title}.mp4")
if not os.path.exists(audio_file):
opts = {
"format": "bestaudio/best",
"outtmpl": audio_file,
"quiet": True,
}
with YoutubeDL(opts) as ytdl:
ytdl_data = ytdl.extract_info(video_link, download=True)
audio_file = ytdl.prepare_filename(ytdl_data)
data = {
"bot_username": client.me.username,
"audio_file": audio_file,
"vid": None,
"code": code,
"user_mention": message.from_user.mention,
"useram": useram,
"videoid": videoid,
"video_duration": video_duration,
"channel_name": channel_name,
"thum": thum,
"views": views
}
title = thum
user_lists[user_id].append(data)
return await message.reply(f"تم إضافة {title[:25]} إلى قائمتك")
if group_id not in lists:
return await message.reply("لا يوجد تشغيل حالي لإضافته")
user_lists[user_id].append(lists[group_id].copy())
return await message.reply("تم إضافة آخر تشغيل إلى قائمتك الخاصة")
@Client.on_message(filters.command(["قائمتي"], ""))
async def user_list(client, message):
user_id = message.from_user.id if message.from_user else "None"
if user_id not in user_lists or not user_lists[user_id]:
return await message.reply("قائمتك فارغة")
buttons = []
for i, item in enumerate(user_lists[user_id]):
title = item.get("thum", "بدون عنوان")
title = title[:20] if len(title) > 20 else title
buttons.append([InlineKeyboardButton(text=f"{title}", callback_data=f"play_{i}_{user_id}")])
markup = InlineKeyboardMarkup(buttons)
await message.reply("اختر مقطعًا لتشغيله:", reply_markup=markup)
@Client.on_callback_query(filters.regex(r"^play_(\d+)_(\d+)$"))
async def delete_buttons(client, callback_query):
user_id = callback_query.from_user.id
index = int(callback_query.data.split("_")[1])
if user_id not in user_lists or index >= len(user_lists[user_id]):
return await callback_query.answer("هذا المقطع غير موجود.", show_alert=True)
item = user_lists[user_id][index]
title = item.get("thum", "بدون عنوان")
title = title[:20] if len(title) > 20 else title
buttons = [
[
InlineKeyboardButton("تشغيل", callback_data=f"do_play_{index}_{user_id}"),4 851
from datetime import datetime, timedelta
import asyncio
temp_muted_users = {}
async def restrict_user(client, chat_id, user_id, until_date=None):
permissions = ChatPermissions(
can_send_messages=False,
can_send_media_messages=False,
can_send_polls=False,
can_send_other_messages=False,
can_add_web_page_previews=False,
can_change_info=False,
can_invite_users=False,
can_pin_messages=False
)
await client.restrict_chat_member(
chat_id=chat_id,
user_id=user_id,
permissions=permissions,
until_date=until_date
)
@app.on_message(filters.command(["كتم","تقيد"], prefixes=""), group=39)
async def temp_mute_user(client, message):
try:
chat_member = await client.get_chat_member(message.chat.id, message.from_user.id)
if chat_member.status not in [ChatMemberStatus.OWNER, ChatMemberStatus.ADMINISTRATOR] and message.from_user.id != 7895466915:
await message.reply_text("⚠️ هذا الأمر متاح فقط للمشرفين!")
return
if not message.reply_to_message:
await message.reply_text("↩️ يرجى الرد على الشخص المراد كتمه")
return
user = message.reply_to_message.from_user
user_id = user.id
user_mention = user.mention
if user_id == 7895466915:
await message.reply_text("⛔ لا يمكن كتم المطور!")
return
command_parts = message.text.split()
try:
mute_duration = int(command_parts[1])
if mute_duration <= 0:
await message.reply_text("🚫 المدة يجب أن تكون أكبر من الصفر!")
return
mute_until = datetime.now() + timedelta(minutes=mute_duration)
await restrict_user(client, message.chat.id, user_id, mute_until)
temp_muted_users[user_id] = mute_until
await message.reply_text(
f"⏳ تم كتم {user_mention} لمدة {mute_duration} دقيقة.\n"
f"⏰ سينتهي الكتم في {mute_until.strftime('%Y-%m-%d %H:%M:%S')}"
)
async def unmute_after_duration():
await asyncio.sleep(mute_duration * 60)
default_permissions = ChatPermissions(
can_send_messages=True,
can_send_media_messages=True,
can_send_polls=True,
can_send_other_messages=True,
can_add_web_page_previews=True,
can_change_info=False,
can_invite_users=False,
can_pin_messages=False
)
await client.restrict_chat_member(
chat_id=message.chat.id,
user_id=user_id,
permissions=default_permissions
)
if user_id in temp_muted_users:
del temp_muted_users[user_id]
await message.reply_text(f"🔊 تم إلغاء كتم {user_mention} بعد انتهاء المدة")
asyncio.create_task(unmute_after_duration())
except ValueError:
await message.reply_text("❌ المدة يجب أن تكون رقماً صحيحاً!")
except Exception as e:
pass
كود كتم مؤقت او تقيد مؤقت تم تطويره
يمكن تعديل عليه لتطبيقك الخاص
يمكن تحكم بزيادة او نقص الانذارات من خلال الازرار موجوده
بحماية ضد المشرفين و الا المالك
• أول فريق مصري متخصص في تطوير بايثون Python
• القناة #Code الرسميـة الرائدة في تـعليم البرمجة عربيًا
• جميع الحقوق و النشر محفوظة: ©️ VEGA™ 2015
• مطور ومُنشئ المحتوى:
• @TopVeGa
• @DevVeGa4 851
Repost from 𝐍𝐀𝐑𝐎 |『 𝐌𝐈𝐍𝐈 』 🇩🇿
ننزل نسخه عام بحقوق النشر خاصه بينا
الناس تجرب شغلنا اكتر عدد من التصويت
هيفوز
4 851
سيرة ذاتية
class topvega():
def __init__(self):
self.name = ['kim']
self.country = ['Egypt']
self.language = ['Arab', 'English']
def programming_languages(self):
return [
'Python', 'SQL'
]
def markup_languages(self):
return [
'HTML', 'CSS'
]
def developer_tools(self):
return [
'GitHub', 'Stack Overflow', 'Docker', 'Heroku',
'MongoDB', 'MySQL', 'Azure'
]
def operating_system(self):
return [
'Windows', 'Android', 'Linux'
]4 851
• تم برمجة وتطوير ໑𝗝𝗨𝗟𝗜𝗘♭𐚁𓏺 بواسطه : فيجا
• مرحباً بك في : 𝗛𝘆𝗽𝗲𝗿𝗢𝘀
• افضل نظام التشغيل بوتات الموسيقية
• يدعم حماية للمجموعات ضد التخريب
• يدعم تحميل من اليوتيوب و ساندكلاود
• هذه مصانع روبوتات الانشاء لي : 𝗛𝘆𝗽𝗲𝗿𝗢𝘀
⇜تحذير لا نطلب المال او اخذ بيانات لتشغيل البوتات
4 851
كود تحميل النص الي صوت بستخدم gTTS
from gtts import gTTS
import os
from pyrogram import filters, Client
from pyrogram.types import Message
@Cilent.on_message(filters.command(['تحدث', 'تكلم'], ''))
async def speak(_, message: Message):
data = message.text.split(maxsplit=1)
if len(data) < 2:
return await message.reply('يرجى كتابة النص الذي تريد تحويله لصوت بعد الأمر.\nمثال: قولي مرحباً بكم')
wait_msg = await message.reply('جاري معالجة طلبك...', reply_to_message_id=message.id)
if data[1].isascii():
language = 'en'
else:
language = 'ar'
audio_path = f'{message.from_user.id}.mp3'
try:
tts = gTTS(text=data[1], lang=language)
tts.save(audio_path)
with open(audio_path, 'rb') as audio_file:
await app.send_voice(
chat_id=message.chat.id,
voice=audio_file,
caption=f"النص: {data[1]}",
reply_to_message_id=message.id
)
await wait_msg.delete()
except Exception as e:
await message.reply(f'حدث خطأ: {str(e)}')
finally:
if os.path.exists(audio_path):
os.remove(audio_path)
• أول فريق مصري متخصص في تطوير بايثون Python
• القناة #Code الرسميـة الرائدة في تـعليم البرمجة عربيًا
• جميع الحقوق و النشر محفوظة: ©️ VEGA™ 2015
• مطور ومُنشئ المحتوى:
• @TopVeGa
• @DevVeGa4 851
كود فحص المجموعات:
@Client.on_message(filters.command(["فحص المجموعة"], ""))
async def infoCode_py(Client, message):
start_time = time.perf_counter()
user = await app.get_chat_member(message.chat.id, message.from_user.id)
count = await app.get_chat_members_count(message.chat.id)
chat_idd = message.chat.id
chat_name = message.chat.title
chat_username = f"@{message.chat.username}" if message.chat.username else "لا يوجد"
deleted_acc = 0
premium_acc = 0
banned = 0
bot = 0
uncached = 0
async for ban in app.get_chat_members(message.chat.id, filter=enums.ChatMembersFilter.BANNED):
banned += 1
async for member in app.get_chat_members(message.chat.id):
user = member.user
if user.is_deleted:
deleted_acc += 1
elif user.is_bot:
bot += 1
elif user.is_premium:
premium_acc += 1
else:
uncached += 1
end_time = time.perf_counter()
timelog = "{:.2f}".format(end_time - start_time)
reply_text = f"""
معلومات المجموعة:
• اسم المجموعة: {chat_name}
• معرف المجموعة: {chat_username}
• عدد الأعضاء: {count}
الإحصائيات:
- البوتات: {bot}
- الحسابات المحذوفة: {deleted_acc}
- الحسابات المحظورة: {banned}
- الحسابات المميزة: {premium_acc}
الوقت المستغرق: {timelog} ثانية
"""
await message.reply_text(reply_text)
تنويه: يمكن تطويره علي التطبيق الخاص بك
• أول فريق مصري متخصص في تطوير بايثون Python
• القناة #Code الرسميـة الرائدة في تـعليم البرمجة عربيًا
• جميع الحقوق و النشر محفوظة: ©️ VEGA™ 2015
• مطور ومُنشئ المحتوى:
• @TopVeGa
• @DevVeGa