Skip to content

Commit

Permalink
feat: improve telegram setup workflow (#6734)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Jul 2, 2023
1 parent f191eda commit 9ee07fb
Show file tree
Hide file tree
Showing 30 changed files with 193 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ public function store(Request $request)
// check if the message matches the expected pattern.
// if the message does not match the pattern, then we return a 202 response
// so telegram will stop trying to send the message.
if (! Str::of($messageText)->test('/^\/start\s[A-Za-z0-9-]{36}$/')) {
$message = Str::of($messageText);
if (! $message->test('/^\/start\s[A-Za-z0-9-]{36}$/')) {
return response('Accepted', 202);
}

// Cleanup the string
$verificationKey = Str::of($messageText)->remove('/start ')->rtrim();
$verificationKey = $message->remove('/start ')->rtrim();

// Get Telegram ID from the request.
$chatId = $request->message['chat']['id'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function data(User $user): array
'emails' => $emailsCollection,
'telegram' => [
'data' => $telegram ? self::dtoTelegram($telegram) : null,
'telegram_env_variable_set' => config('services.telegram-bot-api.token'),
'telegram_env_variable_set' => config('services.telegram-bot-api.token') !== null,
],
'url' => [
'settings' => route('settings.index'),
Expand Down
1 change: 1 addition & 0 deletions lang/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "প্রিয় হিসাবে সেট করুন",
"Settings": "সেটিংস",
"Settle": "মীমাংসা",
"Setup": "সেটআপ",
"Setup Key": "সেটআপ কী",
"Setup Key:": "সেটআপ কী:",
"Setup Telegram": "টেলিগ্রাম সেটআপ করুন",
Expand Down
1 change: 1 addition & 0 deletions lang/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Estableix com a favorit",
"Settings": "Configuració",
"Settle": "Resoldre",
"Setup": "Configuració",
"Setup Key": "Clau de configuració",
"Setup Key:": "Clau de configuració:",
"Setup Telegram": "Configura Telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Indstil som favorit",
"Settings": "Indstillinger",
"Settle": "Afregne",
"Setup": "Opsætning",
"Setup Key": "Opsætningsnøgle",
"Setup Key:": "Opsætningsnøgle:",
"Setup Telegram": "Opsætning af telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Als Favorit festlegen",
"Settings": "Einstellungen",
"Settle": "Abwickeln",
"Setup": "Aufstellen",
"Setup Key": "Einrichtungsschlüssel",
"Setup Key:": "Setup-Schlüssel:",
"Setup Telegram": "Telegram einrichten",
Expand Down
1 change: 1 addition & 0 deletions lang/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Ορίστε ως αγαπημένο",
"Settings": "Ρυθμίσεις",
"Settle": "Εγκαθίσταμαι",
"Setup": "Ρύθμιση",
"Setup Key": "Κλειδί ρύθμισης",
"Setup Key:": "Κλειδί ρύθμισης:",
"Setup Telegram": "Ρύθμιση Telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Establecer como favorito",
"Settings": "Configuraciones",
"Settle": "Pagar",
"Setup": "Configuración",
"Setup Key": "Clave de configuración",
"Setup Key:": "Clave de configuración:",
"Setup Telegram": "Configurar Telegram",
Expand Down
3 changes: 2 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Définir comme favori",
"Settings": "Paramètres",
"Settle": "Régler",
"Setup": "Configurer",
"Setup Key": "Clé de configuration",
"Setup Key:": "Clé de configuration :",
"Setup Telegram": "Configurer Telegram",
Expand Down Expand Up @@ -1277,4 +1278,4 @@
"😩 Awful": "😩 Horrible",
"😶‍🌫️ Neutral": "😶‍🌫️ Neutre",
"🥳 Awesome": "🥳 Génial"
}
}
1 change: 1 addition & 0 deletions lang/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "הגדר כמועדף",
"Settings": "הגדרות",
"Settle": "לִשְׁקוֹעַ",
"Setup": "להכין",
"Setup Key": "מפתח הגדרה",
"Setup Key:": "מפתח הגדרה:",
"Setup Telegram": "הגדרת טלגרם",
Expand Down
1 change: 1 addition & 0 deletions lang/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "पसंदीदा के रूप में सेट करें",
"Settings": "समायोजन",
"Settle": "निपटारा करना",
"Setup": "स्थापित करना",
"Setup Key": "सेटअप कुंजी",
"Setup Key:": "सेटअप कुंजी:",
"Setup Telegram": "सेटअप टेलीग्राम",
Expand Down
1 change: 1 addition & 0 deletions lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Imposta come preferito",
"Settings": "Impostazioni",
"Settle": "Salda",
"Setup": "Impostare",
"Setup Key": "Chiave di configurazione",
"Setup Key:": "Chiave di configurazione:",
"Setup Telegram": "Imposta Telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "お気に入りに設定",
"Settings": "設定",
"Settle": "解決",
"Setup": "設定",
"Setup Key": "セットアップキー",
"Setup Key:": "セットアップ キー:",
"Setup Telegram": "テレグラムの設定",
Expand Down
1 change: 1 addition & 0 deletions lang/ml.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "പ്രിയപ്പെട്ടതായി സജ്ജമാക്കുക",
"Settings": "ക്രമീകരണങ്ങൾ",
"Settle": "സെറ്റിൽ ചെയ്യുക",
"Setup": "സജ്ജമാക്കുക",
"Setup Key": "സജ്ജീകരണ കീ",
"Setup Key:": "സജ്ജീകരണ കീ:",
"Setup Telegram": "ടെലിഗ്രാം സജ്ജീകരിക്കുക",
Expand Down
1 change: 1 addition & 0 deletions lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Instellen als favoriet",
"Settings": "Instellingen",
"Settle": "Schikken",
"Setup": "Opgericht",
"Setup Key": "Instelsleutel",
"Setup Key:": "Instelsleutel:",
"Setup Telegram": "Telegram instellen",
Expand Down
1 change: 1 addition & 0 deletions lang/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Sett som favoritt",
"Settings": "Innstillinger",
"Settle": "Avgjøre",
"Setup": "Oppsett",
"Setup Key": "Oppsettnøkkel",
"Setup Key:": "Oppsettnøkkel:",
"Setup Telegram": "Sett opp telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/pa.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "ਮਨਪਸੰਦ ਵਜੋਂ ਸੈੱਟ ਕਰੋ",
"Settings": "ਸੈਟਿੰਗਾਂ",
"Settle": "ਸੈਟਲ",
"Setup": "ਸਥਾਪਨਾ ਕਰਨਾ",
"Setup Key": "ਸੈੱਟਅੱਪ ਕੁੰਜੀ",
"Setup Key:": "ਸੈੱਟਅੱਪ ਕੁੰਜੀ:",
"Setup Telegram": "ਟੈਲੀਗ੍ਰਾਮ ਸੈੱਟਅੱਪ ਕਰੋ",
Expand Down
1 change: 1 addition & 0 deletions lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Ustaw jako ulubione",
"Settings": "Ustawienia",
"Settle": "Rozstrzygnąć",
"Setup": "Organizować coś",
"Setup Key": "Klucz konfiguracji",
"Setup Key:": "Klucz konfiguracji:",
"Setup Telegram": "Ustaw telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Definir como favorito",
"Settings": "Configurações",
"Settle": "Quitar",
"Setup": "Configurar",
"Setup Key": "Chave de configuração",
"Setup Key:": "Chave de configuração:",
"Setup Telegram": "Configurar Telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Setați ca favorit",
"Settings": "Setări",
"Settle": "Așează-te",
"Setup": "Înființat",
"Setup Key": "Cheie de configurare",
"Setup Key:": "Cheie de configurare:",
"Setup Telegram": "Configurați Telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Установить в избранное",
"Settings": "Настройки",
"Settle": "Расселиться",
"Setup": "Настраивать",
"Setup Key": "Ключ настройки",
"Setup Key:": "Установка ключа:",
"Setup Telegram": "Настройка Telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Ställ in som favorit",
"Settings": "inställningar",
"Settle": "Bosätta sig",
"Setup": "Uppstart",
"Setup Key": "Inställningsnyckel",
"Setup Key:": "Inställningsnyckel:",
"Setup Telegram": "Ställ in telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/te.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "ఇష్టమైనదిగా సెట్ చేయండి",
"Settings": "సెట్టింగ్‌లు",
"Settle": "తేల్చుకో",
"Setup": "సెటప్",
"Setup Key": "సెటప్ కీ",
"Setup Key:": "సెటప్ కీ:",
"Setup Telegram": "టెలిగ్రామ్‌ని సెటప్ చేయండి",
Expand Down
1 change: 1 addition & 0 deletions lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Favori olarak ayarla",
"Settings": "Ayarlar",
"Settle": "Yerleşmek",
"Setup": "Kurmak",
"Setup Key": "Kurulum Anahtarı",
"Setup Key:": "Kurulum Anahtarı:",
"Setup Telegram": "Telgrafı Kur",
Expand Down
1 change: 1 addition & 0 deletions lang/ur.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "پسندیدہ کے طور پر سیٹ کریں۔",
"Settings": "ترتیبات",
"Settle": "آباد کرنا",
"Setup": "سیٹ اپ",
"Setup Key": "سیٹ اپ کلید",
"Setup Key:": "سیٹ اپ کلید:",
"Setup Telegram": "ٹیلیگرام سیٹ اپ کریں۔",
Expand Down
1 change: 1 addition & 0 deletions lang/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@
"Set as favorite": "Đặt làm mục yêu thích",
"Settings": "Cài đặt",
"Settle": "Ổn định",
"Setup": "Cài đặt",
"Setup Key": "Khóa cài đặt",
"Setup Key:": "Khóa cài đặt:",
"Setup Telegram": "Thiết lập Telegram",
Expand Down
1 change: 1 addition & 0 deletions lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@
"Set as favorite": "设为收藏夹",
"Settings": "设置",
"Settle": "定居",
"Setup": "设置",
"Setup Key": "设置键",
"Setup Key:": "设置键:",
"Setup Telegram": "设置电报",
Expand Down
Loading

0 comments on commit 9ee07fb

Please sign in to comment.