| 1 | import type { WebhookFormat } from './index.js'; |
| 2 | |
| 3 | /** Google Chat incoming webhooks: https://developers.google.com/workspace/chat/quickstart/webhooks */ |
| 4 | export const googleChat: |
| 5 | matches: (url) |
| 6 | url.hostname === |
| 7 | url.pathname.startsWith |
| 8 | render: ({ context |
| 9 | text: [ |
| 10 | `*${plain(context |
| 11 | url ? `<${ |
| 12 | ...(excerpt ? |
| 13 | ].join('\n' |
| 14 | }), |
| 15 | }; |
| 16 | |
| 17 | // Chat has no escape for `<`: user text with `<users/all>` would page the space, so angle brackets become look-alikes. |
| 18 | function plain(text: |
| 19 | return text.replaceAll |
| 20 | } |