()
| 233 | let idIncrementer = 0 |
| 234 | // Provides automatic id generation for attachments, avoiding collisions with user provided ids |
| 235 | const nextAutoId = () => { |
| 236 | while (true) { |
| 237 | idIncrementer++ |
| 238 | |
| 239 | let next = idIncrementer |
| 240 | if (userProvidedIds.includes(next)) { |
| 241 | continue |
| 242 | } |
| 243 | |
| 244 | return next |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | const attachments: Internal.OpCreateMessageFields["attachments"] = (fields.attachments ?? []).map(a => ({ |
| 249 | dataB64: typeof a.data === "string" |