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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Message Manager Pattern Guide
|
| 2 |
+
|
| 3 |
+
This guide explains how to use the `messageManager.getMessage` pattern and the SQL insert statements for WeBook messages in the Telegram bot.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
The `messageManager` is a singleton class that manages localized messages for the Telegram bot. It supports both Arabic and English languages and stores messages in the database for easy management and updates.
|
| 8 |
+
|
| 9 |
+
## Database Schema
|
| 10 |
+
|
| 11 |
+
The messages are stored in the `bot_messages` table with the following structure:
|
| 12 |
+
|
| 13 |
+
```sql
|
| 14 |
+
CREATE TABLE public.bot_messages (
|
| 15 |
+
id uuid DEFAULT extensions.uuid_generate_v4() NOT NULL,
|
| 16 |
+
key character varying(255) NOT NULL,
|
| 17 |
+
ar_value text NOT NULL,
|
| 18 |
+
en_value text NOT NULL,
|
| 19 |
+
description text,
|
| 20 |
+
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
| 21 |
+
updated_at timestamp with time zone DEFAULT now() NOT NULL
|
| 22 |
+
);
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
## SQL Insert Statements
|
| 26 |
+
|
| 27 |
+
The `webook_messages_insert.sql` file contains all the INSERT statements for WeBook-related messages. To use these:
|
| 28 |
+
|
| 29 |
+
1. **Execute the SQL file**:
|
| 30 |
+
```bash
|
| 31 |
+
psql -d your_database -f webook_messages_insert.sql
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
2. **Or run individual inserts**:
|
| 35 |
+
```sql
|
| 36 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 37 |
+
('btn_webook_events',
|
| 38 |
+
'🎭 أحداث WeBook',
|
| 39 |
+
'🎭 WeBook Events',
|
| 40 |
+
'Button text for WeBook events menu');
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
## Message Manager Usage
|
| 44 |
+
|
| 45 |
+
### Basic Usage
|
| 46 |
+
|
| 47 |
+
```typescript
|
| 48 |
+
import { messageManager } from './src/bots/utils/messageManager';
|
| 49 |
+
|
| 50 |
+
// Get a message in the current language
|
| 51 |
+
const message = messageManager.getMessage('btn_webook_events');
|
| 52 |
+
|
| 53 |
+
// Set language
|
| 54 |
+
messageManager.setLanguage('ar'); // Arabic
|
| 55 |
+
messageManager.setLanguage('en'); // English
|
| 56 |
+
|
| 57 |
+
// Get current language
|
| 58 |
+
const currentLang = messageManager.getLanguage();
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
### In Bot Handlers
|
| 62 |
+
|
| 63 |
+
```typescript
|
| 64 |
+
export const handleWeBookEvents = async (ctx: BotContext) => {
|
| 65 |
+
try {
|
| 66 |
+
// Get localized message
|
| 67 |
+
const welcomeMessage = messageManager.getMessage('webook_enter_event_url');
|
| 68 |
+
|
| 69 |
+
await ctx.reply(welcomeMessage, {
|
| 70 |
+
parse_mode: 'HTML'
|
| 71 |
+
});
|
| 72 |
+
} catch (error) {
|
| 73 |
+
const errorMessage = messageManager.getMessage('webook_general_error');
|
| 74 |
+
await ctx.reply(errorMessage);
|
| 75 |
+
}
|
| 76 |
+
};
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
### Message with Placeholders
|
| 80 |
+
|
| 81 |
+
Many messages support placeholders that can be replaced with dynamic values:
|
| 82 |
+
|
| 83 |
+
```typescript
|
| 84 |
+
const summaryMessage = messageManager.getMessage('webook_booking_summary')
|
| 85 |
+
.replace('{event_url}', eventUrl)
|
| 86 |
+
.replace('{tickets_requested}', count.toString())
|
| 87 |
+
.replace('{max_tickets_per_account}', maxTicketsPerAccount.toString());
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Available Message Keys
|
| 91 |
+
|
| 92 |
+
### Button Messages
|
| 93 |
+
- `btn_webook_events` - WeBook Events button
|
| 94 |
+
- `btn_webook_book_by_url` - Book Tickets by Event URL button
|
| 95 |
+
|
| 96 |
+
### Input Messages
|
| 97 |
+
- `webook_enter_event_url` - Ask user to enter event URL
|
| 98 |
+
- `webook_invalid_url` - Invalid URL error
|
| 99 |
+
- `webook_url_accepted` - URL accepted confirmation
|
| 100 |
+
- `webook_invalid_ticket_count` - Invalid ticket count error
|
| 101 |
+
|
| 102 |
+
### Booking Messages
|
| 103 |
+
- `webook_booking_summary` - Booking summary before payment
|
| 104 |
+
- `webook_payment_question` - Ask for payment preference
|
| 105 |
+
- `webook_starting_process` - Starting booking process
|
| 106 |
+
- `webook_booking_completed` - Final completion message
|
| 107 |
+
|
| 108 |
+
### Status Messages
|
| 109 |
+
- `webook_logging_in` - Login attempt status
|
| 110 |
+
- `webook_login_failed` - Login failure
|
| 111 |
+
- `webook_attempting_booking` - Booking attempt status
|
| 112 |
+
- `webook_booking_success_auto` - Automatic booking success
|
| 113 |
+
- `webook_booking_success_manual` - Manual booking success
|
| 114 |
+
- `webook_booking_failed` - Booking failure
|
| 115 |
+
|
| 116 |
+
### Error Messages
|
| 117 |
+
- `webook_general_error` - General error message
|
| 118 |
+
- `webook_network_error` - Network error
|
| 119 |
+
- `webook_request_expired` - Request expired
|
| 120 |
+
- `webook_no_available_accounts` - No accounts available
|
| 121 |
+
|
| 122 |
+
## Updating Messages
|
| 123 |
+
|
| 124 |
+
### Programmatically
|
| 125 |
+
|
| 126 |
+
```typescript
|
| 127 |
+
import { messageManager } from './src/bots/utils/messageManager';
|
| 128 |
+
|
| 129 |
+
// Update a message
|
| 130 |
+
await messageManager.updateMessage(
|
| 131 |
+
'btn_webook_events',
|
| 132 |
+
'🎭 أحداث WeBook الجديدة', // New Arabic text
|
| 133 |
+
'🎭 New WeBook Events', // New English text
|
| 134 |
+
'Updated button text' // Description
|
| 135 |
+
);
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
### Via Database
|
| 139 |
+
|
| 140 |
+
```sql
|
| 141 |
+
UPDATE bot_messages
|
| 142 |
+
SET ar_value = '🎭 أحداث WeBook الجديدة',
|
| 143 |
+
en_value = '🎭 New WeBook Events',
|
| 144 |
+
description = 'Updated button text',
|
| 145 |
+
updated_at = NOW()
|
| 146 |
+
WHERE key = 'btn_webook_events';
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
## Loading Messages
|
| 150 |
+
|
| 151 |
+
The messageManager automatically loads messages from the database when initialized:
|
| 152 |
+
|
| 153 |
+
```typescript
|
| 154 |
+
// Load messages from database
|
| 155 |
+
await messageManager.loadMessages();
|
| 156 |
+
|
| 157 |
+
// Reload messages (useful after updates)
|
| 158 |
+
await messageManager.reloadMessages();
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
## Keyboard Integration
|
| 162 |
+
|
| 163 |
+
The keyboard utilities have been updated to use messageManager:
|
| 164 |
+
|
| 165 |
+
```typescript
|
| 166 |
+
// Before (hardcoded)
|
| 167 |
+
[Markup.button.callback('🎭 WeBook Events', 'webook_events')]
|
| 168 |
+
|
| 169 |
+
// After (using messageManager)
|
| 170 |
+
[Markup.button.callback(messageManager.getMessage('btn_webook_events'), 'webook_events')]
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
## Best Practices
|
| 174 |
+
|
| 175 |
+
1. **Always use messageManager.getMessage()** instead of hardcoded strings
|
| 176 |
+
2. **Use descriptive keys** that clearly indicate the message purpose
|
| 177 |
+
3. **Include placeholders** for dynamic content using `{placeholder_name}` format
|
| 178 |
+
4. **Provide both Arabic and English** versions for all messages
|
| 179 |
+
5. **Add descriptions** to help with message management
|
| 180 |
+
6. **Test both languages** to ensure proper localization
|
| 181 |
+
|
| 182 |
+
## Example Implementation
|
| 183 |
+
|
| 184 |
+
See `webook_message_usage_example.ts` for a complete example of how to implement WeBook booking flow using the messageManager pattern.
|
| 185 |
+
|
| 186 |
+
## Troubleshooting
|
| 187 |
+
|
| 188 |
+
### Message Not Found
|
| 189 |
+
If a message key is not found, the messageManager will:
|
| 190 |
+
1. Log a warning
|
| 191 |
+
2. Return the key as the message text
|
| 192 |
+
3. Continue execution
|
| 193 |
+
|
| 194 |
+
### Database Connection Issues
|
| 195 |
+
If the database is unavailable:
|
| 196 |
+
1. The messageManager will use default messages
|
| 197 |
+
2. Log an error
|
| 198 |
+
3. Continue with fallback behavior
|
| 199 |
+
|
| 200 |
+
### Language Switching
|
| 201 |
+
To switch languages dynamically:
|
| 202 |
+
```typescript
|
| 203 |
+
// Set user's preferred language
|
| 204 |
+
messageManager.setLanguage(userLanguage);
|
| 205 |
+
|
| 206 |
+
// Get message in user's language
|
| 207 |
+
const message = messageManager.getMessage('some_key');
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
## File Structure
|
| 211 |
+
|
| 212 |
+
```
|
| 213 |
+
├── webook_messages_insert.sql # SQL insert statements
|
| 214 |
+
├── webook_message_usage_example.ts # Usage examples
|
| 215 |
+
├── src/bots/utils/
|
| 216 |
+
│ ├── messageManager.ts # Message manager implementation
|
| 217 |
+
│ └── keyboardUtils.ts # Updated keyboard utilities
|
| 218 |
+
└── MESSAGE_MANAGER_GUIDE.md # This guide
|
| 219 |
+
```
|
src/bots/utils/keyboardUtils.ts
CHANGED
|
@@ -13,10 +13,10 @@ export const getMainMenuKeyboard = () => {
|
|
| 13 |
return Markup.inlineKeyboard([
|
| 14 |
// [Markup.button.callback(messageManager.getMessage('btn_login'), 'login')],
|
| 15 |
// [Markup.button.callback(messageManager.getMessage('btn_terms'), 'terms')],
|
| 16 |
-
[Markup.button.callback('
|
| 17 |
// Markup.button.callback('🎟️ Book Tickets by Event URL', 'webook_book_by_url')
|
| 18 |
],
|
| 19 |
-
[Markup.button.callback('
|
| 20 |
// [Markup.button.callback(messageManager.getMessage('btn_new_members'), 'new_members')],
|
| 21 |
// [Markup.button.callback(messageManager.getMessage('btn_stats'), 'stats')],
|
| 22 |
[Markup.button.callback(messageManager.getMessage('btn_change_language'), 'change_language')],
|
|
@@ -26,8 +26,8 @@ export const getMainMenuKeyboard = () => {
|
|
| 26 |
export const getLoggedInMenuKeyboard = () => {
|
| 27 |
return Markup.inlineKeyboard([
|
| 28 |
// [Markup.button.callback('🔍 Browse Services', 'browse_services')],
|
| 29 |
-
[Markup.button.callback('
|
| 30 |
-
[Markup.button.callback('
|
| 31 |
[
|
| 32 |
// Markup.button.callback(messageManager.getMessage('btn_profile'), 'profile'),
|
| 33 |
Markup.button.callback(messageManager.getMessage('btn_change_language'), 'change_language')
|
|
|
|
| 13 |
return Markup.inlineKeyboard([
|
| 14 |
// [Markup.button.callback(messageManager.getMessage('btn_login'), 'login')],
|
| 15 |
// [Markup.button.callback(messageManager.getMessage('btn_terms'), 'terms')],
|
| 16 |
+
[Markup.button.callback(messageManager.getMessage('btn_webook_events'), 'webook_events'),
|
| 17 |
// Markup.button.callback('🎟️ Book Tickets by Event URL', 'webook_book_by_url')
|
| 18 |
],
|
| 19 |
+
[Markup.button.callback(messageManager.getMessage('btn_webook_book_by_url'), 'webook_book_by_url')],
|
| 20 |
// [Markup.button.callback(messageManager.getMessage('btn_new_members'), 'new_members')],
|
| 21 |
// [Markup.button.callback(messageManager.getMessage('btn_stats'), 'stats')],
|
| 22 |
[Markup.button.callback(messageManager.getMessage('btn_change_language'), 'change_language')],
|
|
|
|
| 26 |
export const getLoggedInMenuKeyboard = () => {
|
| 27 |
return Markup.inlineKeyboard([
|
| 28 |
// [Markup.button.callback('🔍 Browse Services', 'browse_services')],
|
| 29 |
+
[Markup.button.callback(messageManager.getMessage('btn_webook_events'), 'webook_events')],
|
| 30 |
+
[Markup.button.callback(messageManager.getMessage('btn_webook_book_by_url'), 'webook_book_by_url')],
|
| 31 |
[
|
| 32 |
// Markup.button.callback(messageManager.getMessage('btn_profile'), 'profile'),
|
| 33 |
Markup.button.callback(messageManager.getMessage('btn_change_language'), 'change_language')
|
webook_messages_insert.sql
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- WeBook Event Messages for Telegram Bot
|
| 2 |
+
-- These messages follow the messageManager.getMessage pattern used in the codebase
|
| 3 |
+
-- Each message has both Arabic (ar_value) and English (en_value) versions
|
| 4 |
+
|
| 5 |
+
-- Main Menu WeBook Buttons
|
| 6 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 7 |
+
('btn_webook_events',
|
| 8 |
+
'🎭 أحداث WeBook',
|
| 9 |
+
'🎭 WeBook Events',
|
| 10 |
+
'Button text for WeBook events menu');
|
| 11 |
+
|
| 12 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 13 |
+
('btn_webook_book_by_url',
|
| 14 |
+
'🎟️ حجز التذاكر برابط الحدث',
|
| 15 |
+
'🎟️ Book Tickets by Event URL',
|
| 16 |
+
'Button text for booking tickets by event URL');
|
| 17 |
+
|
| 18 |
+
-- WeBook Event URL Input
|
| 19 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 20 |
+
('webook_enter_event_url',
|
| 21 |
+
'🔗 يرجى إرسال رابط الحدث الذي تريد حجز التذاكر له (مثال: https://webook.com/en/events/mdlbeast-beast-house-ec/book)',
|
| 22 |
+
'🔗 Please send the event URL you want to book tickets for (e.g. https://webook.com/en/events/mdlbeast-beast-house-ec/book)',
|
| 23 |
+
'Message asking user to enter WeBook event URL');
|
| 24 |
+
|
| 25 |
+
-- Invalid URL
|
| 26 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 27 |
+
('webook_invalid_url',
|
| 28 |
+
'❌ رابط الحدث غير صحيح. يرجى إرسال رابط صحيح لحدث WeBook.',
|
| 29 |
+
'❌ Invalid event URL. Please send a valid WeBook event URL.',
|
| 30 |
+
'Error message for invalid WeBook event URL');
|
| 31 |
+
|
| 32 |
+
-- URL Accepted
|
| 33 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 34 |
+
('webook_url_accepted',
|
| 35 |
+
'✅ تم قبول الرابط!
|
| 36 |
+
|
| 37 |
+
📍 الرابط الأصلي: {original_url}
|
| 38 |
+
🔗 الرابط المصحح: {fixed_url}
|
| 39 |
+
|
| 40 |
+
كم عدد التذاكر التي تريد حجزها؟ (يرجى إدخال رقم)',
|
| 41 |
+
'✅ URL accepted!
|
| 42 |
+
|
| 43 |
+
📍 Original URL: {original_url}
|
| 44 |
+
🔗 Fixed URL: {fixed_url}
|
| 45 |
+
|
| 46 |
+
How many tickets do you want to book? (Please enter a number)',
|
| 47 |
+
'Message confirming URL acceptance and asking for ticket count');
|
| 48 |
+
|
| 49 |
+
-- Invalid Ticket Count
|
| 50 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 51 |
+
('webook_invalid_ticket_count',
|
| 52 |
+
'❌ يرجى إدخال عدد صحيح من التذاكر.',
|
| 53 |
+
'❌ Please enter a valid number of tickets.',
|
| 54 |
+
'Error message for invalid ticket count');
|
| 55 |
+
|
| 56 |
+
-- No Tickets Available
|
| 57 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 58 |
+
('webook_no_tickets_available',
|
| 59 |
+
'❌ لا توجد تذاكر متاحة حالياً لهذا الحدث:
|
| 60 |
+
|
| 61 |
+
📍 رابط الحدث: {event_url}
|
| 62 |
+
🎫 التذاكر المطلوبة: {tickets_requested}
|
| 63 |
+
|
| 64 |
+
يرجى المحاولة مرة أخرى لاحقاً.',
|
| 65 |
+
'❌ No tickets are currently available for this event:
|
| 66 |
+
|
| 67 |
+
📍 Event URL: {event_url}
|
| 68 |
+
🎫 Tickets Requested: {tickets_requested}
|
| 69 |
+
|
| 70 |
+
Please try again later.',
|
| 71 |
+
'Message when no tickets are available for the event');
|
| 72 |
+
|
| 73 |
+
-- Booking Summary
|
| 74 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 75 |
+
('webook_booking_summary',
|
| 76 |
+
'📋 ملخص الحجز:
|
| 77 |
+
|
| 78 |
+
📍 رابط الحدث: {event_url}
|
| 79 |
+
🎫 التذاكر المطلوبة: {tickets_requested}
|
| 80 |
+
📊 الحد الأقصى للتذاكر لكل حساب: {max_tickets_per_account}
|
| 81 |
+
|
| 82 |
+
',
|
| 83 |
+
'📋 Booking Summary:
|
| 84 |
+
|
| 85 |
+
📍 Event URL: {event_url}
|
| 86 |
+
🎫 Tickets Requested: {tickets_requested}
|
| 87 |
+
📊 Max Tickets Per Account: {max_tickets_per_account}
|
| 88 |
+
|
| 89 |
+
',
|
| 90 |
+
'Booking summary message before payment question');
|
| 91 |
+
|
| 92 |
+
-- Payment Question
|
| 93 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 94 |
+
('webook_payment_question',
|
| 95 |
+
'هل تريد إجراء الدفع تلقائياً؟',
|
| 96 |
+
'Do you want to make payment automatically?',
|
| 97 |
+
'Question asking if user wants automatic payment');
|
| 98 |
+
|
| 99 |
+
-- Request Expired
|
| 100 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 101 |
+
('webook_request_expired',
|
| 102 |
+
'انتهت صلاحية طلبك أو أنه غير صحيح. يرجى البدء من جديد.',
|
| 103 |
+
'Your request expired or is invalid. Please start again.',
|
| 104 |
+
'Message when booking request has expired');
|
| 105 |
+
|
| 106 |
+
-- Processing Messages
|
| 107 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 108 |
+
('webook_processing_payment',
|
| 109 |
+
'💳 يرجى الانتظار بينما نعالج حجزك والدفع...',
|
| 110 |
+
'💳 Please wait while we process your booking and payment...',
|
| 111 |
+
'Message when processing booking with automatic payment');
|
| 112 |
+
|
| 113 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 114 |
+
('webook_processing_manual',
|
| 115 |
+
'📝 حجز تذاكرك بدون دفع تلقائي...',
|
| 116 |
+
'📝 Booking your tickets without automatic payment...',
|
| 117 |
+
'Message when processing booking without automatic payment');
|
| 118 |
+
|
| 119 |
+
-- Account Related Messages
|
| 120 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 121 |
+
('webook_error_fetching_accounts',
|
| 122 |
+
'خطأ في جلب الحسابات للحجز.',
|
| 123 |
+
'Error fetching accounts for booking.',
|
| 124 |
+
'Error message when failing to fetch accounts');
|
| 125 |
+
|
| 126 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 127 |
+
('webook_no_available_accounts',
|
| 128 |
+
'لا توجد حسابات نشطة متاحة مع بيانات الاعتماد للحجز.',
|
| 129 |
+
'No active accounts with credentials available for booking.',
|
| 130 |
+
'Message when no accounts are available for booking');
|
| 131 |
+
|
| 132 |
+
-- Payment Types
|
| 133 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 134 |
+
('webook_automatic_payment',
|
| 135 |
+
'💳 الدفع التلقائي',
|
| 136 |
+
'💳 Automatic Payment',
|
| 137 |
+
'Label for automatic payment type');
|
| 138 |
+
|
| 139 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 140 |
+
('webook_manual_payment',
|
| 141 |
+
'📝 الدفع اليدوي',
|
| 142 |
+
'📝 Manual Payment',
|
| 143 |
+
'Label for manual payment type');
|
| 144 |
+
|
| 145 |
+
-- Starting Process
|
| 146 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 147 |
+
('webook_starting_process',
|
| 148 |
+
'🚀 بدء عملية الحجز:
|
| 149 |
+
|
| 150 |
+
📍 رابط الحدث: {event_url}
|
| 151 |
+
🔗 الرابط المصحح: {fixed_url}
|
| 152 |
+
🎫 التذاكر المطلوبة: {tickets_requested}
|
| 153 |
+
💳 نوع الدفع: {payment_type}
|
| 154 |
+
👥 الحسابات المتاحة: {available_accounts}
|
| 155 |
+
⚡ وضع المعالجة: متوازي ({max_concurrent} حسابات في وقت واحد)
|
| 156 |
+
|
| 157 |
+
معالجة الحسابات بالتوازي للحجز الأسرع...',
|
| 158 |
+
'🚀 Starting booking process:
|
| 159 |
+
|
| 160 |
+
📍 Event URL: {event_url}
|
| 161 |
+
🔗 Fixed URL: {fixed_url}
|
| 162 |
+
🎫 Tickets Requested: {tickets_requested}
|
| 163 |
+
💳 Payment Type: {payment_type}
|
| 164 |
+
👥 Available Accounts: {available_accounts}
|
| 165 |
+
⚡ Processing Mode: Parallel ({max_concurrent} accounts at once)
|
| 166 |
+
|
| 167 |
+
Processing accounts in parallel for faster booking...',
|
| 168 |
+
'Message when starting the booking process');
|
| 169 |
+
|
| 170 |
+
-- Booking Status Messages
|
| 171 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 172 |
+
('webook_all_tickets_booked',
|
| 173 |
+
'تم حجز جميع التذاكر المطلوبة.',
|
| 174 |
+
'All required tickets have been booked.',
|
| 175 |
+
'Message when all required tickets are booked');
|
| 176 |
+
|
| 177 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 178 |
+
('webook_logging_in',
|
| 179 |
+
'🔐 تسجيل الدخول بالحساب: {email}',
|
| 180 |
+
'🔐 Logging in with account: {email}',
|
| 181 |
+
'Message when logging in with an account');
|
| 182 |
+
|
| 183 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 184 |
+
('webook_login_failed',
|
| 185 |
+
'❌ فشل تسجيل الدخول بالحساب: {email}. جاري تجربة الحساب التالي...',
|
| 186 |
+
'❌ Login failed for account: {email}. Trying next account...',
|
| 187 |
+
'Message when login fails for an account');
|
| 188 |
+
|
| 189 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 190 |
+
('webook_attempting_booking',
|
| 191 |
+
'🎯 محاولة حجز التذاكر مع: {email}',
|
| 192 |
+
'🎯 Attempting to book tickets with: {email}',
|
| 193 |
+
'Message when attempting to book with an account');
|
| 194 |
+
|
| 195 |
+
-- Booking Success Messages
|
| 196 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 197 |
+
('webook_booking_success_auto',
|
| 198 |
+
'✅ تم حجز {tickets} تذاكر بنجاح مع {email} (الدفع التلقائي)
|
| 199 |
+
📊 إجمالي التذاكر المحجوزة: {total_obtained}/{total_needed}',
|
| 200 |
+
'✅ Successfully booked {tickets} tickets with {email} (Auto Payment)
|
| 201 |
+
📊 Total tickets obtained: {total_obtained}/{total_needed}',
|
| 202 |
+
'Message when automatic booking is successful');
|
| 203 |
+
|
| 204 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 205 |
+
('webook_booking_success_manual',
|
| 206 |
+
'✅ تم حجز {tickets} تذاكر بنجاح مع {email} (الدفع اليدوي)
|
| 207 |
+
📊 إجمالي التذاكر المحجوزة: {total_obtained}/{total_needed}',
|
| 208 |
+
'✅ Successfully booked {tickets} tickets with {email} (Manual Payment)
|
| 209 |
+
📊 Total tickets obtained: {total_obtained}/{total_needed}',
|
| 210 |
+
'Message when manual booking is successful');
|
| 211 |
+
|
| 212 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 213 |
+
('webook_booking_success_manual_with_payment',
|
| 214 |
+
'🎟️ تم حجز {tickets} تذاكر بنجاح مع {email} (الدفع اليدوي)!
|
| 215 |
+
|
| 216 |
+
📊 إجمالي التذاكر المحجوزة: {total_obtained}/{total_needed}
|
| 217 |
+
|
| 218 |
+
لإكمال هذا الحجز، يرجى إنهاء الدفع:',
|
| 219 |
+
'🎟️ Successfully booked {tickets} tickets with {email} (Manual Payment)!
|
| 220 |
+
|
| 221 |
+
📊 Total tickets obtained: {total_obtained}/{total_needed}
|
| 222 |
+
|
| 223 |
+
To complete this booking, please finish the payment:',
|
| 224 |
+
'Message when manual booking is successful with payment URL');
|
| 225 |
+
|
| 226 |
+
-- Booking Failure Messages
|
| 227 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 228 |
+
('webook_booking_failed',
|
| 229 |
+
'❌ لا توجد تذاكر متاحة أو فشل الحجز مع الحساب: {email}. جاري تجربة الحساب التالي...',
|
| 230 |
+
'❌ No tickets available or booking failed with account: {email}. Trying next account...',
|
| 231 |
+
'Message when booking fails with an account');
|
| 232 |
+
|
| 233 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 234 |
+
('webook_tickets_sold_out',
|
| 235 |
+
'❌ نفدت التذاكر للحساب {email}. جاري تجربة الحساب التالي...',
|
| 236 |
+
'❌ Tickets sold out for account {email}. Trying next account...',
|
| 237 |
+
'Message when tickets are sold out for an account');
|
| 238 |
+
|
| 239 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 240 |
+
('webook_booking_error',
|
| 241 |
+
'حدث خطأ أثناء الحجز مع {email}: {error}',
|
| 242 |
+
'An error occurred while booking with {email}: {error}',
|
| 243 |
+
'Message when an error occurs during booking');
|
| 244 |
+
|
| 245 |
+
-- Final Results Messages
|
| 246 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 247 |
+
('webook_booking_completed',
|
| 248 |
+
'🏁 اكتملت عملية الحجز!
|
| 249 |
+
|
| 250 |
+
📍 رابط الحدث: {event_url}
|
| 251 |
+
🔗 الرابط المصحح: {fixed_url}
|
| 252 |
+
🎫 التذاكر المطلوبة: {tickets_requested}
|
| 253 |
+
✅ التذاكر المحجوزة: {tickets_obtained}
|
| 254 |
+
💳 نوع الدفع: {payment_type}
|
| 255 |
+
👥 الحسابات المستخدمة: {accounts_used}
|
| 256 |
+
⚡ وضع المعالجة: متوازي ({max_concurrent} حسابات في وقت واحد)',
|
| 257 |
+
'🏁 Booking process completed!
|
| 258 |
+
|
| 259 |
+
📍 Event URL: {event_url}
|
| 260 |
+
🔗 Fixed URL: {fixed_url}
|
| 261 |
+
🎫 Tickets Requested: {tickets_requested}
|
| 262 |
+
✅ Tickets Obtained: {tickets_obtained}
|
| 263 |
+
💳 Payment Type: {payment_type}
|
| 264 |
+
👥 Accounts Used: {accounts_used}
|
| 265 |
+
⚡ Processing Mode: Parallel ({max_concurrent} accounts at once)',
|
| 266 |
+
'Final completion message with booking summary');
|
| 267 |
+
|
| 268 |
+
-- Error Messages
|
| 269 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 270 |
+
('webook_general_error',
|
| 271 |
+
'❌ حدث خطأ أثناء معالجة طلبك. يرجى المحاولة مرة أخرى.',
|
| 272 |
+
'❌ An error occurred while processing your request. Please try again.',
|
| 273 |
+
'General error message for WeBook operations');
|
| 274 |
+
|
| 275 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 276 |
+
('webook_network_error',
|
| 277 |
+
'❌ خطأ في الشبكة. يرجى التحقق من اتصالك بالإنترنت والمحاولة مرة أخرى.',
|
| 278 |
+
'❌ Network error. Please check your internet connection and try again.',
|
| 279 |
+
'Network error message for WeBook operations');
|
| 280 |
+
|
| 281 |
+
-- Confirmation Messages
|
| 282 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 283 |
+
('webook_confirm_booking',
|
| 284 |
+
'هل أنت متأكد من أنك تريد حجز {tickets} تذاكر لهذا الحدث؟',
|
| 285 |
+
'Are you sure you want to book {tickets} tickets for this event?',
|
| 286 |
+
'Confirmation message before proceeding with booking');
|
| 287 |
+
|
| 288 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 289 |
+
('webook_booking_cancelled',
|
| 290 |
+
'تم إلغاء عملية الحجز.',
|
| 291 |
+
'Booking process cancelled.',
|
| 292 |
+
'Message when user cancels the booking process');
|
| 293 |
+
|
| 294 |
+
-- Status Update Messages
|
| 295 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 296 |
+
('webook_status_update',
|
| 297 |
+
'📊 تحديث الحالة: {current_step}/{total_steps} - {description}',
|
| 298 |
+
'📊 Status Update: {current_step}/{total_steps} - {description}',
|
| 299 |
+
'Status update message during booking process');
|
| 300 |
+
|
| 301 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 302 |
+
('webook_processing_accounts',
|
| 303 |
+
'⚙️ معالجة الحسابات... ({processed}/{total})',
|
| 304 |
+
'⚙️ Processing accounts... ({processed}/{total})',
|
| 305 |
+
'Message showing account processing progress');
|
| 306 |
+
|
| 307 |
+
-- Success Messages
|
| 308 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 309 |
+
('webook_success_message',
|
| 310 |
+
'🎉 تم إكمال العملية بنجاح!',
|
| 311 |
+
'🎉 Operation completed successfully!',
|
| 312 |
+
'General success message for WeBook operations');
|
| 313 |
+
|
| 314 |
+
INSERT INTO bot_messages (key, ar_value, en_value, description) VALUES
|
| 315 |
+
('webook_partial_success',
|
| 316 |
+
'⚠️ تم إكمال العملية جزئياً. {successful}/{total} حسابات نجحت.',
|
| 317 |
+
'⚠️ Operation completed partially. {successful}/{total} accounts succeeded.',
|
| 318 |
+
'Message when some accounts succeed but others fail');
|