Deploy Bot commited on
Commit
aff1ffd
Β·
1 Parent(s): 5b32161

Standardize_Cancel_To_MainMenu_Logic

Browse files
src/scenes/admin/addProduct.js CHANGED
@@ -1,66 +1,98 @@
1
  const { Scenes, Markup } = require('telegraf');
2
  const Product = require('../../models/Product');
3
  const Category = require('../../models/Category');
 
4
 
5
  const addProductScene = new Scenes.WizardScene(
6
  'ADD_PRODUCT_SCENE',
7
  // Step 1: Ask Name
8
  (ctx) => {
 
 
 
 
 
9
  ctx.wizard.state.product = { media: [] };
10
- ctx.reply("πŸ†• Yangi mahsulot qo'shish.\n\nIltimos, mahsulot nomini kiriting:", Markup.removeKeyboard());
11
  return ctx.wizard.next();
12
  },
13
  // Step 2: Ask Price
14
  (ctx) => {
 
 
 
 
 
15
  if (!ctx.message || !ctx.message.text) return ctx.reply("Iltimos, tekst ko'rinishida yozing");
16
  ctx.wizard.state.product.name = ctx.message.text;
17
 
18
- ctx.reply("πŸ’° Mahsulot narxini kiriting (faqat raqam, masalan: 120000):");
19
  return ctx.wizard.next();
20
  },
21
  // Step 3: Ask Quantity
22
  (ctx) => {
 
 
 
 
 
23
  if (!ctx.message || !ctx.message.text || isNaN(ctx.message.text)) return ctx.reply("Iltimos, narxni raqamda kiriting");
24
  ctx.wizard.state.product.price = parseInt(ctx.message.text);
25
 
26
- ctx.reply("πŸ”’ Mahsulot sonini kiriting (Omborda nechta bor?):");
27
  return ctx.wizard.next();
28
  },
29
  // Step 4: Ask Description
30
  (ctx) => {
 
 
 
 
 
31
  if (!ctx.message || !ctx.message.text || isNaN(ctx.message.text)) return ctx.reply("Iltimos, sonini raqamda kiriting");
32
  ctx.wizard.state.product.quantity = parseInt(ctx.message.text);
33
 
34
- ctx.reply("πŸ“ Mahsulot haqida ma'lumot (tavsif) yozing:");
35
  return ctx.wizard.next();
36
  },
37
- // Step 4: Ask Category
38
  async (ctx) => {
 
 
 
 
 
39
  if (!ctx.message || !ctx.message.text) return ctx.reply("Iltimos, tavsifni yozing");
40
  ctx.wizard.state.product.description = ctx.message.text;
41
 
42
  const categories = await Category.find();
43
  const buttons = categories.map(c => c.name);
44
  buttons.push("βž• Yangi kategoriya");
 
45
 
46
  ctx.reply("πŸ“‚ Kategoriyani tanlang yoki yangisini yarating:", Markup.keyboard(buttons).oneTime().resize());
47
  return ctx.wizard.next();
48
  },
49
- // Step 5: Handle Category Selection
50
  (ctx) => {
51
  const text = ctx.message?.text;
 
 
 
 
 
52
  if (!text) return ctx.reply("Kategoriyani tanlang");
53
 
54
  if (text === "βž• Yangi kategoriya") {
55
  ctx.wizard.state.isNewCategory = true;
56
- ctx.reply("Yangi kategoriya nomini yozing:");
57
  return ctx.wizard.next();
58
  } else {
59
  ctx.wizard.state.isNewCategory = false;
60
  ctx.wizard.state.product.category = text;
61
 
62
  ctx.reply("πŸ“Έ Endi mahsulot rasmlari yoki videolarini yuklang.\n\nBir nechta rasm/video tashlashingiz mumkin. Barchasini yuklab bo'lgach, 'βœ… Tayyor' tugmasini bosing.",
63
- Markup.keyboard(['βœ… Tayyor']).resize()
64
  );
65
  return ctx.wizard.selectStep(7);
66
  }
@@ -68,6 +100,11 @@ const addProductScene = new Scenes.WizardScene(
68
  // Step 7: Handle New Category Name
69
  async (ctx) => {
70
  const text = ctx.message?.text;
 
 
 
 
 
71
  if (!text) return ctx.reply("Kategoriya nomini matn sifatida yozing");
72
 
73
  const newCat = text;
@@ -79,7 +116,7 @@ const addProductScene = new Scenes.WizardScene(
79
  ctx.reply(`Yangi kategoriya yaratildi: ${newCat}`);
80
 
81
  ctx.reply("πŸ“Έ Endi mahsulot rasmlari yoki videolarini yuklang.\n\nBir nechta rasm/video tashlashingiz mumkin. Barchasini yuklab bo'lgach, 'βœ… Tayyor' tugmasini bosing.",
82
- Markup.keyboard(['βœ… Tayyor']).resize()
83
  );
84
  return ctx.wizard.next();
85
  } catch (err) {
@@ -91,6 +128,12 @@ const addProductScene = new Scenes.WizardScene(
91
  async (ctx) => {
92
  const msg = ctx.message;
93
 
 
 
 
 
 
 
94
  if (msg.text === 'βœ… Tayyor') {
95
  if (ctx.wizard.state.product.media.length === 0) {
96
  return ctx.reply("Kamida bitta rasm yoki video yuklashingiz kerak!");
@@ -107,7 +150,6 @@ const addProductScene = new Scenes.WizardScene(
107
  ctx.reply(`βœ… Mahsulot qo'shildi!\n\nNom: ${productData.name}\nNarx: ${productData.price}\nSoni: ${productData.quantity} ta\nKategoriya: ${productData.category}\nMedia: ${productData.media.length} ta fayl.`);
108
 
109
  // Redirect to Main Menu
110
- const userController = require('../../controllers/userController');
111
  userController.start(ctx);
112
  return ctx.scene.leave();
113
  } catch (err) {
@@ -129,9 +171,9 @@ const addProductScene = new Scenes.WizardScene(
129
 
130
  const count = ctx.wizard.state.product.media.length;
131
  if (count >= 4) {
132
- ctx.reply("πŸ“Έ Maksimal 4 ta rasm/video yuklandi. Iltimos, 'βœ… Tayyor' tugmasini bosing.", Markup.keyboard(['βœ… Tayyor']).resize());
133
  } else {
134
- ctx.reply(`Media qo'shildi (${count}/4)! Yana bormi?`, Markup.keyboard(['βœ… Tayyor']).resize());
135
  }
136
  }
137
  );
 
1
  const { Scenes, Markup } = require('telegraf');
2
  const Product = require('../../models/Product');
3
  const Category = require('../../models/Category');
4
+ const userController = require('../../controllers/userController');
5
 
6
  const addProductScene = new Scenes.WizardScene(
7
  'ADD_PRODUCT_SCENE',
8
  // Step 1: Ask Name
9
  (ctx) => {
10
+ if (ctx.message && ctx.message.text === '❌ Bekor qilish') {
11
+ ctx.scene.leave();
12
+ userController.start(ctx, "Bekor qilindi.");
13
+ return;
14
+ }
15
  ctx.wizard.state.product = { media: [] };
16
+ ctx.reply("πŸ†• Yangi mahsulot qo'shish.\n\nIltimos, mahsulot nomini kiriting:", Markup.keyboard([['❌ Bekor qilish']]).resize());
17
  return ctx.wizard.next();
18
  },
19
  // Step 2: Ask Price
20
  (ctx) => {
21
+ if (ctx.message && ctx.message.text === '❌ Bekor qilish') {
22
+ ctx.scene.leave();
23
+ userController.start(ctx, "Bekor qilindi.");
24
+ return;
25
+ }
26
  if (!ctx.message || !ctx.message.text) return ctx.reply("Iltimos, tekst ko'rinishida yozing");
27
  ctx.wizard.state.product.name = ctx.message.text;
28
 
29
+ ctx.reply("πŸ’° Mahsulot narxini kiriting (faqat raqam, masalan: 120000):", Markup.keyboard([['❌ Bekor qilish']]).resize());
30
  return ctx.wizard.next();
31
  },
32
  // Step 3: Ask Quantity
33
  (ctx) => {
34
+ if (ctx.message && ctx.message.text === '❌ Bekor qilish') {
35
+ ctx.scene.leave();
36
+ userController.start(ctx, "Bekor qilindi.");
37
+ return;
38
+ }
39
  if (!ctx.message || !ctx.message.text || isNaN(ctx.message.text)) return ctx.reply("Iltimos, narxni raqamda kiriting");
40
  ctx.wizard.state.product.price = parseInt(ctx.message.text);
41
 
42
+ ctx.reply("πŸ”’ Mahsulot sonini kiriting (Omborda nechta bor?):", Markup.keyboard([['❌ Bekor qilish']]).resize());
43
  return ctx.wizard.next();
44
  },
45
  // Step 4: Ask Description
46
  (ctx) => {
47
+ if (ctx.message && ctx.message.text === '❌ Bekor qilish') {
48
+ ctx.scene.leave();
49
+ userController.start(ctx, "Bekor qilindi.");
50
+ return;
51
+ }
52
  if (!ctx.message || !ctx.message.text || isNaN(ctx.message.text)) return ctx.reply("Iltimos, sonini raqamda kiriting");
53
  ctx.wizard.state.product.quantity = parseInt(ctx.message.text);
54
 
55
+ ctx.reply("πŸ“ Mahsulot haqida ma'lumot (tavsif) yozing:", Markup.keyboard([['❌ Bekor qilish']]).resize());
56
  return ctx.wizard.next();
57
  },
58
+ // Step 4: Ask Category (Actually Step 5)
59
  async (ctx) => {
60
+ if (ctx.message && ctx.message.text === '❌ Bekor qilish') {
61
+ ctx.scene.leave();
62
+ userController.start(ctx, "Bekor qilindi.");
63
+ return;
64
+ }
65
  if (!ctx.message || !ctx.message.text) return ctx.reply("Iltimos, tavsifni yozing");
66
  ctx.wizard.state.product.description = ctx.message.text;
67
 
68
  const categories = await Category.find();
69
  const buttons = categories.map(c => c.name);
70
  buttons.push("βž• Yangi kategoriya");
71
+ buttons.push("❌ Bekor qilish");
72
 
73
  ctx.reply("πŸ“‚ Kategoriyani tanlang yoki yangisini yarating:", Markup.keyboard(buttons).oneTime().resize());
74
  return ctx.wizard.next();
75
  },
76
+ // Step 5: Handle Category Selection (Step 6)
77
  (ctx) => {
78
  const text = ctx.message?.text;
79
+ if (text === '❌ Bekor qilish') {
80
+ ctx.scene.leave();
81
+ userController.start(ctx, "Bekor qilindi.");
82
+ return;
83
+ }
84
  if (!text) return ctx.reply("Kategoriyani tanlang");
85
 
86
  if (text === "βž• Yangi kategoriya") {
87
  ctx.wizard.state.isNewCategory = true;
88
+ ctx.reply("Yangi kategoriya nomini yozing:", Markup.keyboard([['❌ Bekor qilish']]).resize());
89
  return ctx.wizard.next();
90
  } else {
91
  ctx.wizard.state.isNewCategory = false;
92
  ctx.wizard.state.product.category = text;
93
 
94
  ctx.reply("πŸ“Έ Endi mahsulot rasmlari yoki videolarini yuklang.\n\nBir nechta rasm/video tashlashingiz mumkin. Barchasini yuklab bo'lgach, 'βœ… Tayyor' tugmasini bosing.",
95
+ Markup.keyboard(['βœ… Tayyor', '❌ Bekor qilish']).resize()
96
  );
97
  return ctx.wizard.selectStep(7);
98
  }
 
100
  // Step 7: Handle New Category Name
101
  async (ctx) => {
102
  const text = ctx.message?.text;
103
+ if (text === '❌ Bekor qilish') {
104
+ ctx.scene.leave();
105
+ userController.start(ctx, "Bekor qilindi.");
106
+ return;
107
+ }
108
  if (!text) return ctx.reply("Kategoriya nomini matn sifatida yozing");
109
 
110
  const newCat = text;
 
116
  ctx.reply(`Yangi kategoriya yaratildi: ${newCat}`);
117
 
118
  ctx.reply("πŸ“Έ Endi mahsulot rasmlari yoki videolarini yuklang.\n\nBir nechta rasm/video tashlashingiz mumkin. Barchasini yuklab bo'lgach, 'βœ… Tayyor' tugmasini bosing.",
119
+ Markup.keyboard(['βœ… Tayyor', '❌ Bekor qilish']).resize()
120
  );
121
  return ctx.wizard.next();
122
  } catch (err) {
 
128
  async (ctx) => {
129
  const msg = ctx.message;
130
 
131
+ if (msg.text === '❌ Bekor qilish') {
132
+ ctx.scene.leave();
133
+ userController.start(ctx, "Bekor qilindi.");
134
+ return;
135
+ }
136
+
137
  if (msg.text === 'βœ… Tayyor') {
138
  if (ctx.wizard.state.product.media.length === 0) {
139
  return ctx.reply("Kamida bitta rasm yoki video yuklashingiz kerak!");
 
150
  ctx.reply(`βœ… Mahsulot qo'shildi!\n\nNom: ${productData.name}\nNarx: ${productData.price}\nSoni: ${productData.quantity} ta\nKategoriya: ${productData.category}\nMedia: ${productData.media.length} ta fayl.`);
151
 
152
  // Redirect to Main Menu
 
153
  userController.start(ctx);
154
  return ctx.scene.leave();
155
  } catch (err) {
 
171
 
172
  const count = ctx.wizard.state.product.media.length;
173
  if (count >= 4) {
174
+ ctx.reply("πŸ“Έ Maksimal 4 ta rasm/video yuklandi. Iltimos, 'βœ… Tayyor' tugmasini bosing.", Markup.keyboard(['βœ… Tayyor', '❌ Bekor qilish']).resize());
175
  } else {
176
+ ctx.reply(`Media qo'shildi (${count}/4)! Yana bormi?`, Markup.keyboard(['βœ… Tayyor', '❌ Bekor qilish']).resize());
177
  }
178
  }
179
  );
src/scenes/admin/broadcast.js CHANGED
@@ -1,18 +1,20 @@
1
  const { Scenes, Markup } = require('telegraf');
2
  const User = require('../../models/User');
 
3
 
4
  const broadcastScene = new Scenes.WizardScene(
5
  'BROADCAST_SCENE',
6
  // Step 1: Ask for content
7
  (ctx) => {
8
- ctx.reply("πŸ“’ Reklama xabarini yuboring (Matn, Rasm yoki Video):\n\nBekor qilish uchun: /cancel", Markup.removeKeyboard());
9
  return ctx.wizard.next();
10
  },
11
  // Step 2: Confirm
12
  (ctx) => {
13
- if (ctx.message.text === '/cancel') {
14
- ctx.reply("Bekor qilindi.");
15
- return ctx.scene.leave();
 
16
  }
17
 
18
  ctx.wizard.state.message = ctx.message; // Save the message object
@@ -33,8 +35,9 @@ const broadcastScene = new Scenes.WizardScene(
33
  const action = ctx.callbackQuery.data;
34
  if (action === 'cancel_send') {
35
  ctx.deleteMessage();
36
- ctx.reply("Reklama bekor qilindi.");
37
- return ctx.scene.leave();
 
38
  } else if (action === 'confirm_send') {
39
  await ctx.deleteMessage();
40
  ctx.reply("πŸš€ Xabar yuborilmoqda...");
@@ -63,10 +66,16 @@ const broadcastScene = new Scenes.WizardScene(
63
  }
64
 
65
  ctx.reply(`🏁 Tugadi!\n\nβœ… Yetib bordi: ${success}\n🚫 Bloklagan/Xato: ${blocked}`);
 
66
  return ctx.scene.leave();
67
  }
68
  } else {
69
- ctx.reply("Iltimos tugmani bosing.");
 
 
 
 
 
70
  }
71
  }
72
  );
 
1
  const { Scenes, Markup } = require('telegraf');
2
  const User = require('../../models/User');
3
+ const userController = require('../../controllers/userController');
4
 
5
  const broadcastScene = new Scenes.WizardScene(
6
  'BROADCAST_SCENE',
7
  // Step 1: Ask for content
8
  (ctx) => {
9
+ ctx.reply("πŸ“’ Reklama xabarini yuboring (Matn, Rasm yoki Video):", Markup.keyboard([['❌ Bekor qilish']]).resize());
10
  return ctx.wizard.next();
11
  },
12
  // Step 2: Confirm
13
  (ctx) => {
14
+ if (ctx.message && (ctx.message.text === '/cancel' || ctx.message.text === '❌ Bekor qilish')) {
15
+ ctx.scene.leave();
16
+ userController.start(ctx, "Bekor qilindi.");
17
+ return;
18
  }
19
 
20
  ctx.wizard.state.message = ctx.message; // Save the message object
 
35
  const action = ctx.callbackQuery.data;
36
  if (action === 'cancel_send') {
37
  ctx.deleteMessage();
38
+ ctx.scene.leave();
39
+ userController.start(ctx, "Reklama bekor qilindi.");
40
+ return;
41
  } else if (action === 'confirm_send') {
42
  await ctx.deleteMessage();
43
  ctx.reply("πŸš€ Xabar yuborilmoqda...");
 
66
  }
67
 
68
  ctx.reply(`🏁 Tugadi!\n\nβœ… Yetib bordi: ${success}\n🚫 Bloklagan/Xato: ${blocked}`);
69
+ userController.start(ctx); // Return to menu
70
  return ctx.scene.leave();
71
  }
72
  } else {
73
+ // Handle text input during buttonwait?
74
+ if (ctx.message && ctx.message.text === '❌ Bekor qilish') {
75
+ ctx.scene.leave();
76
+ userController.start(ctx, "Bekor qilindi.");
77
+ return;
78
+ }
79
  }
80
  }
81
  );
src/scenes/admin/editProduct.js CHANGED
@@ -1,6 +1,7 @@
1
  const { Scenes, Markup } = require('telegraf');
2
  const Product = require('../../models/Product');
3
  const Category = require('../../models/Category');
 
4
 
5
  // Helper to show confirmation
6
  const askConfirmation = (ctx, field, value, product) => {
@@ -9,7 +10,7 @@ const askConfirmation = (ctx, field, value, product) => {
9
 
10
  ctx.reply(`⚠️ <b>Tasdiqlaysizmi?</b>\n\nMaydon: ${field}\nEski: ${field === 'media' ? 'Media fayllar' : (product[field] || 'Yo\'q')}\nYangi: ${displayValue}`, {
11
  parse_mode: 'HTML',
12
- ...Markup.keyboard([['βœ… Ha', '❌ Yo\'q']]).resize().oneTime()
13
  });
14
  };
15
 
@@ -42,8 +43,9 @@ const editProductScene = new Scenes.WizardScene(
42
  async (ctx) => {
43
  const text = ctx.message.text;
44
  if (text === '❌ Bekor qilish' || text === '/start') {
45
- ctx.reply("Tahrirlash bekor qilindi.", Markup.removeKeyboard());
46
- return ctx.scene.leave();
 
47
  }
48
 
49
  let field = '';
@@ -72,14 +74,23 @@ const editProductScene = new Scenes.WizardScene(
72
  return ctx.wizard.selectStep(4); // Go to Media Handler
73
  }
74
 
75
- ctx.reply(`Yangi ${text.toLowerCase()} kiriting:`, Markup.removeKeyboard());
76
  return ctx.wizard.next();
77
  },
78
  // Step 2: Handle Text/Number Input (Index 2)
79
  async (ctx) => {
80
  const newValue = ctx.message.text;
81
- if (!newValue || newValue === '❌ Bekor qilish') return ctx.scene.leave();
82
- if (newValue.startsWith('/')) return ctx.scene.leave();
 
 
 
 
 
 
 
 
 
83
 
84
  if (ctx.wizard.state.field === 'price' || ctx.wizard.state.field === 'quantity') {
85
  if (isNaN(newValue)) return ctx.reply("Iltimos, raqam kiriting.");
@@ -94,7 +105,11 @@ const editProductScene = new Scenes.WizardScene(
94
  // Step 3: Handle Category Input (Index 3)
95
  async (ctx) => {
96
  const tex = ctx.message.text;
97
- if (!tex || tex === '❌ Bekor qilish' || tex.startsWith('/')) return ctx.scene.leave();
 
 
 
 
98
 
99
  ctx.wizard.state.newValue = tex;
100
 
@@ -104,7 +119,11 @@ const editProductScene = new Scenes.WizardScene(
104
  // Step 4: Handle Media Input (Index 4)
105
  async (ctx) => {
106
  const msg = ctx.message;
107
- if (msg.text === '❌ Bekor qilish' || (msg.text && msg.text.startsWith('/'))) return ctx.scene.leave();
 
 
 
 
108
 
109
  if (msg.text === 'βœ… Tayyor') {
110
  if (ctx.wizard.state.newMedia.length === 0) return ctx.reply("Kamida bitta rasm yuboring.");
@@ -136,17 +155,16 @@ const editProductScene = new Scenes.WizardScene(
136
  const update = {};
137
  update[ctx.wizard.state.field] = ctx.wizard.state.newValue;
138
  await Product.updateOne({ id: ctx.wizard.state.product.id }, update);
139
- ctx.reply("βœ… Muvaffaqiyatli saqlandi!");
140
 
141
  // Redirect to Main Menu
142
- const userController = require('../../controllers/userController');
143
  userController.start(ctx);
144
  } catch (e) {
145
  console.error(e);
146
  ctx.reply("Xatolik bo'ldi.");
147
  }
148
  } else {
149
- ctx.reply("Bekor qilindi.", Markup.removeKeyboard());
150
  }
151
  return ctx.scene.leave();
152
  }
 
1
  const { Scenes, Markup } = require('telegraf');
2
  const Product = require('../../models/Product');
3
  const Category = require('../../models/Category');
4
+ const userController = require('../../controllers/userController');
5
 
6
  // Helper to show confirmation
7
  const askConfirmation = (ctx, field, value, product) => {
 
10
 
11
  ctx.reply(`⚠️ <b>Tasdiqlaysizmi?</b>\n\nMaydon: ${field}\nEski: ${field === 'media' ? 'Media fayllar' : (product[field] || 'Yo\'q')}\nYangi: ${displayValue}`, {
12
  parse_mode: 'HTML',
13
+ ...Markup.keyboard([['βœ… Ha', '❌ Bekor qilish']]).resize().oneTime()
14
  });
15
  };
16
 
 
43
  async (ctx) => {
44
  const text = ctx.message.text;
45
  if (text === '❌ Bekor qilish' || text === '/start') {
46
+ ctx.scene.leave();
47
+ userController.start(ctx, "Tahrirlash bekor qilindi.");
48
+ return;
49
  }
50
 
51
  let field = '';
 
74
  return ctx.wizard.selectStep(4); // Go to Media Handler
75
  }
76
 
77
+ ctx.reply(`Yangi ${text.toLowerCase()} kiriting:`, Markup.keyboard([['❌ Bekor qilish']]).resize());
78
  return ctx.wizard.next();
79
  },
80
  // Step 2: Handle Text/Number Input (Index 2)
81
  async (ctx) => {
82
  const newValue = ctx.message.text;
83
+ if (!newValue || newValue === '❌ Bekor qilish') {
84
+ ctx.scene.leave();
85
+ userController.start(ctx, "Bekor qilindi.");
86
+ return;
87
+ }
88
+
89
+ if (newValue.startsWith('/')) {
90
+ ctx.scene.leave();
91
+ userController.start(ctx);
92
+ return;
93
+ }
94
 
95
  if (ctx.wizard.state.field === 'price' || ctx.wizard.state.field === 'quantity') {
96
  if (isNaN(newValue)) return ctx.reply("Iltimos, raqam kiriting.");
 
105
  // Step 3: Handle Category Input (Index 3)
106
  async (ctx) => {
107
  const tex = ctx.message.text;
108
+ if (!tex || tex === '❌ Bekor qilish' || tex.startsWith('/')) {
109
+ ctx.scene.leave();
110
+ userController.start(ctx, "Bekor qilindi.");
111
+ return;
112
+ }
113
 
114
  ctx.wizard.state.newValue = tex;
115
 
 
119
  // Step 4: Handle Media Input (Index 4)
120
  async (ctx) => {
121
  const msg = ctx.message;
122
+ if (msg.text === '❌ Bekor qilish' || (msg.text && msg.text.startsWith('/'))) {
123
+ ctx.scene.leave();
124
+ userController.start(ctx, "Bekor qilindi.");
125
+ return;
126
+ }
127
 
128
  if (msg.text === 'βœ… Tayyor') {
129
  if (ctx.wizard.state.newMedia.length === 0) return ctx.reply("Kamida bitta rasm yuboring.");
 
155
  const update = {};
156
  update[ctx.wizard.state.field] = ctx.wizard.state.newValue;
157
  await Product.updateOne({ id: ctx.wizard.state.product.id }, update);
158
+ ctx.reply("βœ… Muvaffaqiyatli saqlandi!", Markup.removeKeyboard());
159
 
160
  // Redirect to Main Menu
 
161
  userController.start(ctx);
162
  } catch (e) {
163
  console.error(e);
164
  ctx.reply("Xatolik bo'ldi.");
165
  }
166
  } else {
167
+ userController.start(ctx, "Bekor qilindi.");
168
  }
169
  return ctx.scene.leave();
170
  }