Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Commit

Permalink
working in public channels
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebrown201 committed Mar 2, 2020
1 parent 410dc0d commit 3b0da33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions post.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ async function postUpdate({ text, channel }) {

async function getMembers({ channel }) {
try {
const result = await web.groups.info({
const channelType = { G: "group", C: "channel" };
const result = await web[channelType[`${channel[0]}`] + "s"].info({
channel
});

const members = result.group.members;
const members = result[channelType[`${channel[0]}`]].members;

const memberSelection = await getStatuses(members);
const awayMessage = prepMessage(memberSelection);
Expand All @@ -40,6 +40,7 @@ async function getMembers({ channel }) {
});
}
} catch (error) {
console.log("getting into error");
if (error.code === ErrorCode.PlatformError) {
console.log(error.data);
} else {
Expand Down
8 changes: 4 additions & 4 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ provider:
profile: csn
stage: ${opt:stage, 'dev'}
region: eu-west-1
stackTags:
teamDL: [email protected]
environment: p
systemCode: channel-status-notifier
environment:
NODE_ENV: "${file(./serverless.env.yml):NODE_ENV}"
SLACK_TOKEN: "${file(./serverless.env.yml):SLACK_TOKEN}"
Expand All @@ -50,10 +54,6 @@ plugins:
- serverless-step-functions
- serverless-offline-sns

stackTags:
teamDL: [email protected]
environment: p
systemCode: channel-status-notifier
tags:
teamDL: [email protected]
environment: p
Expand Down

0 comments on commit 3b0da33

Please sign in to comment.