Skip to content

Commit

Permalink
extract description message into constant
Browse files Browse the repository at this point in the history
  • Loading branch information
michelle0927 committed Sep 23, 2024
1 parent 1e555f3 commit bdf75d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/slack_bot/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import app from "../slack_bot.app.mjs";

const CONVERSATION_PERMISSION_MESSAGE = "In order to list a Slack channel, **your bot must be a member of that channel**, and in order to list private channels, your bot must have the `groups:read` scope in the `OAuth & Permissions` settings in Slack for this bot.";

async function streamIterator(stream) {
let resources = [];
for await (const resource of stream) {
Expand All @@ -24,10 +26,9 @@ function buildPropDefinitions({
}

if (key === "conversation") {
const message = "In order to list a Slack channel, **your bot must be a member of that channel**, and in order to list private channels, your bot must have the `groups:read` scope in the `OAuth & Permissions` settings in Slack for this bot.";
prop.description = prop.description
? `${prop.description} ${message}`
: `Select a public or private channel, or a user or group. ${message}`;
? `${prop.description} ${CONVERSATION_PERMISSION_MESSAGE}`
: `Select a public or private channel, or a user or group. ${CONVERSATION_PERMISSION_MESSAGE}`;
}

const [
Expand Down

0 comments on commit bdf75d6

Please sign in to comment.