Mohammed Foud commited on
Commit ·
5e7eb36
1
Parent(s): 37eb434
allh
Browse files- src/bots/botManager.ts +1 -1
- src/bots/handlers/mainMenuHandlers.ts +4 -1
- src/bots/utils/handlerUtils.ts +8 -2
- src/index.ts +1 -1
src/bots/botManager.ts
CHANGED
|
@@ -75,7 +75,7 @@ export const initializeBot = async (botToken: string, botData?: BotData) => {
|
|
| 75 |
setupCallbackHandlers(bot);
|
| 76 |
|
| 77 |
// Set bot commands
|
| 78 |
-
await bot.telegram.setMyCommands(BotCommands);
|
| 79 |
|
| 80 |
return {
|
| 81 |
success: true,
|
|
|
|
| 75 |
setupCallbackHandlers(bot);
|
| 76 |
|
| 77 |
// Set bot commands
|
| 78 |
+
// await bot.telegram.setMyCommands(BotCommands);
|
| 79 |
|
| 80 |
return {
|
| 81 |
success: true,
|
src/bots/handlers/mainMenuHandlers.ts
CHANGED
|
@@ -64,7 +64,10 @@ export const handleLoginAction = async (ctx: BotContext) => {
|
|
| 64 |
.replace('{firstName}', user.firstName)
|
| 65 |
.replace('{email}', user.email)
|
| 66 |
.replace('{balance}', user.balance?.toString() || '0'),
|
| 67 |
-
options:
|
|
|
|
|
|
|
|
|
|
| 68 |
};
|
| 69 |
} else {
|
| 70 |
try {
|
|
|
|
| 64 |
.replace('{firstName}', user.firstName)
|
| 65 |
.replace('{email}', user.email)
|
| 66 |
.replace('{balance}', user.balance?.toString() || '0'),
|
| 67 |
+
options: {
|
| 68 |
+
...getLoggedInMenuKeyboard(),
|
| 69 |
+
parse_mode: 'HTML'
|
| 70 |
+
}
|
| 71 |
};
|
| 72 |
} else {
|
| 73 |
try {
|
src/bots/utils/handlerUtils.ts
CHANGED
|
@@ -20,14 +20,20 @@ export const messageReplyHandler = (
|
|
| 20 |
// Get the message ID to reply to
|
| 21 |
const replyToMessageId = ctx.message?.message_id;
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
// Add reply_to_message_id to options if not already set
|
| 24 |
-
const
|
|
|
|
| 25 |
...result.options,
|
| 26 |
reply_to_message_id: replyToMessageId
|
| 27 |
};
|
| 28 |
|
| 29 |
// Send the reply with the message and options
|
| 30 |
-
return await ctx.reply(result.message,
|
| 31 |
} catch (error: any) {
|
| 32 |
// Log the error
|
| 33 |
logger.error(`Error in message reply handler: ${error.message}`);
|
|
|
|
| 20 |
// Get the message ID to reply to
|
| 21 |
const replyToMessageId = ctx.message?.message_id;
|
| 22 |
|
| 23 |
+
// Define default options including parse_mode
|
| 24 |
+
const defaultOptions = {
|
| 25 |
+
parse_mode: 'HTML'
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
// Add reply_to_message_id to options if not already set
|
| 29 |
+
const finalOptions = {
|
| 30 |
+
...defaultOptions,
|
| 31 |
...result.options,
|
| 32 |
reply_to_message_id: replyToMessageId
|
| 33 |
};
|
| 34 |
|
| 35 |
// Send the reply with the message and options
|
| 36 |
+
return await ctx.reply(result.message, finalOptions);
|
| 37 |
} catch (error: any) {
|
| 38 |
// Log the error
|
| 39 |
logger.error(`Error in message reply handler: ${error.message}`);
|
src/index.ts
CHANGED
|
@@ -31,4 +31,4 @@ async function startServer() {
|
|
| 31 |
}
|
| 32 |
|
| 33 |
startServer();
|
| 34 |
-
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
startServer();
|
| 34 |
+
handleAddTelegrafBot("049a92c4-7654-43f6-8e6f-7ff5cce78995")
|