( text: string, channel: string, files: any[] )
| 179 | * Creates a message object for file uploads |
| 180 | */ |
| 181 | export function createFileMessageObject( |
| 182 | text: string, |
| 183 | channel: string, |
| 184 | files: any[] |
| 185 | ): Record<string, any> { |
| 186 | const fileTs = files?.[0]?.created?.toString() || (Date.now() / 1000).toString() |
| 187 | return { |
| 188 | type: 'message', |
| 189 | ts: fileTs, |
| 190 | text, |
| 191 | channel, |
| 192 | files: files?.map((file: any) => ({ |
| 193 | id: file?.id, |
| 194 | name: file?.name, |
| 195 | mimetype: file?.mimetype, |
| 196 | size: file?.size, |
| 197 | url_private: file?.url_private, |
| 198 | permalink: file?.permalink, |
| 199 | })), |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Opens a DM channel with a user and returns the channel ID |
no test coverage detected