| 606 | new Api.messages.ForwardMessages({ |
| 607 | fromPeer: fromEntity, |
| 608 | id: messageIds, |
| 609 | toPeer: toEntity, |
| 610 | silent: options?.silent, |
| 611 | ...(options?.replyTo ? { topMsgId: options.replyTo } : {}), |
| 612 | }) |
| 613 | ); |
| 614 | console.log( |
| 615 | `[SHIFT] 组转发成功: ${fromChatId} -> ${toChatId}, msgs=${messageIds.join( |
| 616 | "," |
| 617 | )}` |
| 618 | ); |
| 619 | } catch (error) { |
| 620 | console.error( |
| 621 | `[SHIFT] 组转发失败: ${fromChatId} -> ${toChatId}, msgs=${messageIds.join( |
| 622 | "," |
| 623 | )}`, |
| 624 | error |
| 625 | ); |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | function enqueueGroupMessage( |
| 630 | message: any, |
| 631 | sourceId: number, |
| 632 | targetId: number, |
| 633 | options?: { silent?: boolean; replyTo?: number }, |
| 634 | shouldForward?: boolean |
| 635 | ): void { |
| 636 | const key = getGroupKey(message); |
| 637 | if (!key) return; |
| 638 | const existed = groupBuffers.get(key) || { |
| 639 | messages: [], |
| 640 | timer: null, |
| 641 | sourceId, |
| 642 | targetId, |
| 643 | options, |