|
@@ -57,11 +57,11 @@ async function sendMessage(chatId, text, options = {}) {
|
|
|
const keyboard = generateInlineKeyboard(chatId);
|
|
|
if (!keyboard) {
|
|
|
// 如果键盘无效,发送不带键盘的消息
|
|
|
- return await bot.sendMessage(chatId, text);
|
|
|
+ return await bot.sendMessage(chatId, text, { parse_mode: 'HTML' });
|
|
|
}
|
|
|
options.reply_markup = keyboard;
|
|
|
}
|
|
|
- return await bot.sendMessage(chatId, text, options);
|
|
|
+ return await bot.sendMessage(chatId, text, { ...options, parse_mode: 'HTML' });
|
|
|
} catch (error) {
|
|
|
console.error('发送消息失败:', error);
|
|
|
if (error.message.includes('bot was kicked from the group chat')) {
|
|
@@ -410,22 +410,29 @@ bot.onText(/\/bill/, async (msg) => {
|
|
|
// 更新帮助命令
|
|
|
bot.onText(/\/help/, (msg) => {
|
|
|
const helpMessage = `
|
|
|
-可用命令:
|
|
|
-/deposit <金额> - 记录入款
|
|
|
-/withdraw <金额> - 记录下发
|
|
|
-/bill - 查看当前账单
|
|
|
-/help - 显示此帮助信息
|
|
|
-
|
|
|
-快捷命令:
|
|
|
-+<金额> - 快速记录入款(例如:+2000)
|
|
|
--<金额> - 快速记录下发(例如:-2000)
|
|
|
-
|
|
|
-管理员命令:
|
|
|
-/addgroup <群组ID> - 添加允许的群组
|
|
|
-/removegroup <群组ID> - 移除允许的群组
|
|
|
-/listgroups - 列出所有允许的群组
|
|
|
+🤖 *机器人使用指南*
|
|
|
+
|
|
|
+📝 *基础命令*
|
|
|
+• /deposit <金额> - 记录入款
|
|
|
+• /withdraw <金额> - 记录下发
|
|
|
+• /bill - 查看当前账单
|
|
|
+• /help - 显示此帮助信息
|
|
|
+
|
|
|
+⚡️ *快捷命令*
|
|
|
+• +<金额> - 快速记录入款(例如:+2000)
|
|
|
+• -<金额> - 快速记录下发(例如:-2000)
|
|
|
+
|
|
|
+👨💼 *管理员命令*
|
|
|
+• /addgroup <群组ID> - 添加允许的群组
|
|
|
+• /removegroup <群组ID> - 移除允许的群组
|
|
|
+• /listgroups - 列出所有允许的群组
|
|
|
+
|
|
|
+💡 *使用提示*
|
|
|
+• 所有金额输入请使用数字
|
|
|
+• 账单信息实时更新
|
|
|
+• 如需帮助请联系管理员
|
|
|
`;
|
|
|
- sendMessage(msg.chat.id, helpMessage);
|
|
|
+ sendMessage(msg.chat.id, helpMessage, { parse_mode: 'Markdown' });
|
|
|
});
|
|
|
|
|
|
// 生成账单消息
|
|
@@ -465,28 +472,36 @@ async function generateBillMessage(chatId) {
|
|
|
const withdrawalFee = totalWithdrawal * (process.env.WITHDRAWAL_FEE_RATE || 0);
|
|
|
const remaining = totalDeposit - depositFee - totalWithdrawal - withdrawalFee;
|
|
|
|
|
|
- let message = `入款(${deposits.length})笔:\n`;
|
|
|
-
|
|
|
+ let message = `📊 *账单明细*\n\n`;
|
|
|
+
|
|
|
// 添加入款记录
|
|
|
- deposits.forEach(deposit => {
|
|
|
- message += `${moment(deposit.time).format('HH:mm:ss')} ${parseFloat(deposit.amount).toFixed(2)}\n`;
|
|
|
- });
|
|
|
+ if (deposits.length > 0) {
|
|
|
+ message += `💰 *入款记录* (${deposits.length}笔)\n`;
|
|
|
+ deposits.forEach(deposit => {
|
|
|
+ message += `• <code>${moment(deposit.time).format('HH:mm:ss')}</code> | ${parseFloat(deposit.amount).toFixed(2)}\n`;
|
|
|
+ });
|
|
|
+ message += '\n';
|
|
|
+ }
|
|
|
|
|
|
- message += `\n下发(${withdrawals.length})笔:\n`;
|
|
|
-
|
|
|
// 添加下发记录
|
|
|
- withdrawals.forEach(withdrawal => {
|
|
|
- message += `${moment(withdrawal.time).format('HH:mm:ss')} ${parseFloat(withdrawal.amount).toFixed(2)}\n`;
|
|
|
- });
|
|
|
+ if (withdrawals.length > 0) {
|
|
|
+ message += `💸 *下发记录* (${withdrawals.length}笔)\n`;
|
|
|
+ withdrawals.forEach(withdrawal => {
|
|
|
+ message += `• <code>${moment(withdrawal.time).format('HH:mm:ss')}</code> | ${parseFloat(withdrawal.amount).toFixed(2)}\n`;
|
|
|
+ });
|
|
|
+ message += '\n';
|
|
|
+ }
|
|
|
|
|
|
- message += `\n总入款:${totalDeposit.toFixed(2)}\n`;
|
|
|
- message += `入款费率:${((process.env.DEPOSIT_FEE_RATE || 0) * 100).toFixed(1)}%\n`;
|
|
|
- message += `下发费率:${((process.env.WITHDRAWAL_FEE_RATE || 0) * 100).toFixed(1)}%\n`;
|
|
|
- message += `应下发:${(totalDeposit - depositFee).toFixed(2)}\n`;
|
|
|
- message += `总下发:${totalWithdrawal.toFixed(2)}\n`;
|
|
|
- message += `下发单笔附加费:0.0\n`;
|
|
|
- message += `单笔附费加总计:0.0\n`;
|
|
|
- message += `余:${remaining.toFixed(2)}`;
|
|
|
+ // 添加统计信息
|
|
|
+ message += `📈 *统计信息*\n`;
|
|
|
+ message += `• 总入款:${totalDeposit.toFixed(2)}\n`;
|
|
|
+ message += `• 入款费率:${((process.env.DEPOSIT_FEE_RATE || 0) * 100).toFixed(1)}%\n`;
|
|
|
+ message += `• 下发费率:${((process.env.WITHDRAWAL_FEE_RATE || 0) * 100).toFixed(1)}%\n`;
|
|
|
+ message += `• 应下发:${(totalDeposit - depositFee).toFixed(2)}\n`;
|
|
|
+ message += `• 总下发:${totalWithdrawal.toFixed(2)}\n`;
|
|
|
+ message += `• 下发单笔附加费:0.0\n`;
|
|
|
+ message += `• 单笔附费加总计:0.0\n\n`;
|
|
|
+ message += `💵 *余额:${remaining.toFixed(2)}*`;
|
|
|
|
|
|
return message;
|
|
|
} catch (error) {
|