Skip to content

Commit

Permalink
feat(slack): allow receiving file/audio/video/image
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvitora committed Apr 3, 2023
1 parent a3b16c2 commit 16c2d31
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 260 deletions.
24 changes: 12 additions & 12 deletions packages/channels/src/slack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

### Receiving

| Channels | Slack | Details |
| ------------- | :---: | :------ |
| Text || |
| Quick Reply || |
| Postback || |
| Say Something || |
| Voice | | |
| Image | | |
| File | | |
| Audio | | |
| Video | | |
| Location || |
| Channels | Slack | Details |
| ------------- | :---: | :---------- |
| Text || |
| Quick Reply || |
| Postback || |
| Say Something || |
| Voice | | Private URL |
| Image | | Private URL |
| File | | Private URL |
| Audio | | Private URL |
| Video | | Private URL |
| Location || |
8 changes: 4 additions & 4 deletions packages/channels/src/slack/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class SlackApi extends ChannelApi<SlackService> {
}

if ('user' in message) {
if (message.files && message.files.length > 0) {
if ('files' in message && message.files?.length) {
for (const file of message.files) {
await this.service.receive(
scope,
Expand Down Expand Up @@ -177,11 +177,11 @@ export class SlackApi extends ChannelApi<SlackService> {
}

private mapMimeTypeToStandardType(mimeType: string) {
if (mimeType.startsWith('image/')) {
if (mimeType?.startsWith('image/')) {
return 'image'
} else if (mimeType.startsWith('video/')) {
} else if (mimeType?.startsWith('video/')) {
return 'video'
} else if (mimeType.startsWith('audio/')) {
} else if (mimeType?.startsWith('audio/')) {
return 'audio'
} else {
return 'file'
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"pg": "^8.7.1",
"redlock": "^4.2.0",
"semver": "^7.3.5",
"sqlite3": "^5.0.2",
"sqlite3": "^5.0.8",
"uuid": "^8.3.2",
"yn": "^4.0.0"
}
Expand Down
Loading

0 comments on commit 16c2d31

Please sign in to comment.