Skip to content

Commit ebeaeac

Browse files
authored
Use join channel differently from channel to send DM (#1305)
Signed-off-by: Marcos Candeia <marrcooos@gmail.com>
1 parent 03e356f commit ebeaeac

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

slack/actions/deco-chat/channels/invoke.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ export default async function invoke(
1414
if (challenge) {
1515
return { challenge };
1616
}
17-
const [channel, thread] = props.event.channel_type === "im"
18-
? [ctx.botUserId ?? props.event.channel, props.event.user]
19-
: [props.event.channel, props.event.channel];
17+
const [joinChannel, channel, thread] = props.event.channel_type === "im"
18+
? [ctx.botUserId ?? props.event.channel, props.event.channel, props.event.user]
19+
: [props.event.channel, props.event.channel, props.event.channel];
2020
const linkProps =
2121
await ctx.appStorage.getItem<JoinChannelProps & { installId: string }>(
22-
ctx.cb.forTeam(props.event.team, channel),
22+
ctx.cb.forTeam(props.event.team, joinChannel),
2323
) ??
24-
undefined;
24+
undefined;
2525
if (!linkProps) {
2626
return;
2727
}
@@ -31,7 +31,7 @@ export default async function invoke(
3131
// avoid loops
3232
if (
3333
botId &&
34-
props.type === "app_mention" &&
34+
(props.type === "app_mention" || props.event.channel_type === "im") &&
3535
props.user === botId
3636
) {
3737
return;

0 commit comments

Comments
 (0)