Skip to content

Commit

Permalink
Total user command added
Browse files Browse the repository at this point in the history
  • Loading branch information
chisa-dev committed Jan 25, 2025
1 parent 52108b7 commit 05861f1
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,19 @@ bot.onText(/\/settings/, async (msg) => {


// Handle the /total_users command
// bot.onText(/\/total_users/, async (msg) => {
// try {
// const totalUsers = await db.getTotalUsers();
// await bot.sendMessage(chatId, `👥 Total users: *${totalUsers}*`, {
// parse_mode: 'Markdown',
// });
// } catch (error) {
// console.error('Error fetching total users:', error);
// await bot.sendMessage(chatId, '❌ Unable to fetch total users at the moment.');
// }

// });
bot.onText(/\/total_users/, async (msg) => {
const chatId = msg.chat.id;
try {
const totalUsers = await db.getTotalUsers();
await bot.sendMessage(chatId, `👥 Total users: *${totalUsers}*`, {
parse_mode: 'Markdown',
});
} catch (error) {
console.error('Error fetching total users:', error);
await bot.sendMessage(chatId, '❌ Unable to fetch total users at the moment.');
}

});

// Inline Query for Translation
bot.on('inline_query', (query) => handleInlineContent(bot, query));
Expand Down

0 comments on commit 05861f1

Please sign in to comment.