Deploy on 2026-06-06 12:04:41

This commit is contained in:
Hamza-Ayed
2026-06-06 12:04:41 +03:00
parent f468227019
commit ed60fa3ce2
5 changed files with 110 additions and 35 deletions

View File

@@ -159,36 +159,52 @@ class TelegramNotifier
public function notifyNewOpportunity(array $opportunity): void
{
$title = $opportunity['title'] ?? 'Untitled';
$type = $opportunity['type'] ?? 'other';
$score = $opportunity['score'] ?? 0;
$fitScore = $opportunity['fit_score'] ?? 0;
$url = $opportunity['url'] ?? '';
$desc = $opportunity['description'] ?? '';
$orgName = $opportunity['org_name'] ?? '';
$whyItMatters = $opportunity['why_it_matters'] ?? [];
$requirements = $opportunity['requirements'] ?? [];
$deadline = $opportunity['deadline'] ?? null;
$effort = $opportunity['effort'] ?? 'متوسط';
$potentialReturn = $opportunity['potential_return'] ?? 'متوسط';
$typeTranslations = [
'vc_funding' => 'تمويل رأس مال جريء (VC)',
'accelerator' => 'مسرعة أعمال (Accelerator)',
'incubator' => 'حاضنة أعمال (Incubator)',
'grant' => 'منحة (Grant)',
'competition' => 'مسابقة (Competition)',
'demo_day' => 'يوم عرض المشاريع (Demo Day)',
'event' => 'فعالية (Event)',
'partnership' => 'شراكة (Partnership)',
'other' => 'أخرى',
];
$translatedType = $typeTranslations[$type] ?? $type;
$effortEmoji = (str_contains($effort, 'عالي') || str_contains(strtolower($effort), 'high')) ? '🔴' : ((str_contains($effort, 'متوسط') || str_contains(strtolower($effort), 'medium')) ? '🟡' : '🟢');
$returnEmoji = (str_contains($potentialReturn, 'عالي') || str_contains(strtolower($potentialReturn), 'high')) ? '🟢' : ((str_contains($potentialReturn, 'متوسط') || str_contains(strtolower($potentialReturn), 'medium')) ? '🟡' : '🔴');
$message = "💡 *فرصة استثمارية جديدة:* {$title}\n\n";
$message .= "▪️ *النوع:* {$translatedType}\n";
$message .= "▪️ *درجة الأهمية:* {$score}/100\n";
$message = "💡 *ScoutIQ*\n\n";
$message .= "*{$title}*";
if ($orgName) {
$message .= "▪️ *الجهة:* {$orgName}\n";
$message .= " {$orgName}";
}
if ($desc) {
$message .= "\n*الملخص ونقاط القوة:*\n_{$desc}_\n";
$message .= "\n\n🔥 *Match Score:* {$fitScore}/100\n";
if (!empty($whyItMatters)) {
$message .= "\n*لماذا تهمك؟*\n";
foreach ((array)$whyItMatters as $why) {
$message .= "{$why}\n";
}
}
if (!empty($requirements)) {
$message .= "\n*المتطلبات:*\n";
foreach ((array)$requirements as $req) {
$message .= "{$req}\n";
}
}
if ($deadline) {
$message .= "\n*الموعد النهائي:*\n{$deadline}\n";
}
$message .= "\n*الجهد المطلوب:*\n{$effortEmoji} {$effort}\n";
$message .= "\n*العائد المحتمل:*\n{$returnEmoji} {$potentialReturn}\n";
$message .= "\n*الإجراء:*\n";
if ($url) {
$message .= "\n🔗 [رابط التقديم والتواصل]({$url})";
$message .= "[قدم الآن]({$url})";
} else {
$message .= "لا يوجد رابط متاح";
}
$this->send($message, 'opportunity');