(text: string, token: string)
| 685 | return Math.max(1, best); |
| 686 | } |
| 687 | |
| 688 | private findBestSlackSplitBefore(text: string, token: string): number { |
| 689 | let fromIndex = Math.min(text.length, MAX_MESSAGE_LENGTH); |
| 690 | |
| 691 | while (fromIndex > 0) { |
| 692 | const index = text.lastIndexOf(token, fromIndex); |
| 693 | if (index < 0) { |
| 694 | return -1; |
| 695 | } |
| 696 | |
| 697 | const splitAt = index + token.length; |
| 698 | if (this.isSlackMessageWithinLimit(text.slice(0, splitAt))) { |
| 699 | return splitAt; |
| 700 | } |
| 701 | |
| 702 | fromIndex = index - 1; |
| 703 | } |
| 704 | |
| 705 | return -1; |
| 706 | } |
| 707 | |
| 708 | private async tryAckReaction(client: any, event: any): Promise<void> { |
no test coverage detected