grambot 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -169,7 +169,7 @@ export function createConversationHelper(conversation, ctx, translator, navigate
|
|
|
169
169
|
inlineKb.icon(btn._iconCustomEmojiId);
|
|
170
170
|
currentInRow++;
|
|
171
171
|
}
|
|
172
|
-
const cancelText = tr("
|
|
172
|
+
const cancelText = tr("grambot.cancel", "🚫 Cancel");
|
|
173
173
|
inlineKb.row().text(cancelText, "ask:__cancel__");
|
|
174
174
|
await editOrReply(translatedQuestion, inlineKb, opts.parseMode);
|
|
175
175
|
const cbCtx = await conversation.waitForCallbackQuery(/^ask:/, {
|
|
@@ -178,7 +178,7 @@ export function createConversationHelper(conversation, ctx, translator, navigate
|
|
|
178
178
|
await c.deleteMessage();
|
|
179
179
|
}
|
|
180
180
|
catch { }
|
|
181
|
-
await c.answerCallbackQuery(tr("
|
|
181
|
+
await c.answerCallbackQuery(tr("grambot.conversation.use_buttons", "Please use the buttons above."));
|
|
182
182
|
},
|
|
183
183
|
});
|
|
184
184
|
await cbCtx.answerCallbackQuery();
|
|
@@ -191,7 +191,7 @@ export function createConversationHelper(conversation, ctx, translator, navigate
|
|
|
191
191
|
}
|
|
192
192
|
// Branch 2: text / number / photo input
|
|
193
193
|
const fieldType = opts.type ?? "text";
|
|
194
|
-
const cancelText = tr("
|
|
194
|
+
const cancelText = tr("grambot.cancel", "🚫 Cancel");
|
|
195
195
|
const cancelKb = new InlineKeyboard().text(cancelText, "cancel_conversation");
|
|
196
196
|
let currentPrompt = translatedQuestion;
|
|
197
197
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -212,7 +212,7 @@ export function createConversationHelper(conversation, ctx, translator, navigate
|
|
|
212
212
|
await updateCtx.deleteMessage();
|
|
213
213
|
}
|
|
214
214
|
catch { }
|
|
215
|
-
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("
|
|
215
|
+
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("grambot.conversation.photo_error", "Please send a photo.");
|
|
216
216
|
currentPrompt = `${err}\n\n${translatedQuestion}`;
|
|
217
217
|
isError = true;
|
|
218
218
|
continue;
|
|
@@ -225,7 +225,7 @@ export function createConversationHelper(conversation, ctx, translator, navigate
|
|
|
225
225
|
if (photos && photos.length > 0) {
|
|
226
226
|
const val = photos[photos.length - 1].file_id;
|
|
227
227
|
if (opts.validate && !(await opts.validate(val))) {
|
|
228
|
-
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("
|
|
228
|
+
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("grambot.conversation.invalid_error", "Invalid input. Try again.");
|
|
229
229
|
currentPrompt = `${err}\n\n${translatedQuestion}`;
|
|
230
230
|
isError = true;
|
|
231
231
|
continue;
|
|
@@ -245,7 +245,7 @@ export function createConversationHelper(conversation, ctx, translator, navigate
|
|
|
245
245
|
await updateCtx.deleteMessage();
|
|
246
246
|
}
|
|
247
247
|
catch { }
|
|
248
|
-
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("
|
|
248
|
+
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("grambot.conversation.text_error", "Please send a text message.");
|
|
249
249
|
currentPrompt = `${err}\n\n${translatedQuestion}`;
|
|
250
250
|
isError = true;
|
|
251
251
|
continue;
|
|
@@ -258,13 +258,13 @@ export function createConversationHelper(conversation, ctx, translator, navigate
|
|
|
258
258
|
if (fieldType === "number") {
|
|
259
259
|
const n = Number(raw);
|
|
260
260
|
if (Number.isNaN(n)) {
|
|
261
|
-
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("
|
|
261
|
+
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("grambot.conversation.number_error", "Please send a valid number.");
|
|
262
262
|
currentPrompt = `${err}\n\n${translatedQuestion}`;
|
|
263
263
|
isError = true;
|
|
264
264
|
continue;
|
|
265
265
|
}
|
|
266
266
|
if (opts.validate && !(await opts.validate(n))) {
|
|
267
|
-
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("
|
|
267
|
+
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("grambot.conversation.invalid_error", "Invalid input. Try again.");
|
|
268
268
|
currentPrompt = `${err}\n\n${translatedQuestion}`;
|
|
269
269
|
isError = true;
|
|
270
270
|
continue;
|
|
@@ -272,7 +272,7 @@ export function createConversationHelper(conversation, ctx, translator, navigate
|
|
|
272
272
|
return n;
|
|
273
273
|
}
|
|
274
274
|
if (opts.validate && !(await opts.validate(raw))) {
|
|
275
|
-
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("
|
|
275
|
+
const err = opts.errorMessage ? tr(opts.errorMessage, opts.errorMessage, opts.replace) : tr("grambot.conversation.invalid_error", "Invalid input. Try again.");
|
|
276
276
|
currentPrompt = `${err}\n\n${translatedQuestion}`;
|
|
277
277
|
isError = true;
|
|
278
278
|
continue;
|