-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial leaderList slash command
- Loading branch information
1 parent
13c9a46
commit 7cd873c
Showing
4 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { getInfoForUser, airGet } from '../utils' | ||
|
||
const interactionLeaderList = (bot, message) => { | ||
getInfoForUser(message.user) | ||
.then(({ leader, club }) => { | ||
if (!leader) { | ||
console.log( | ||
`${user} isn't a leader, so I told them this was restricted` | ||
) | ||
bot.whisper(message, transcript('leaderList.invalidUser')) | ||
return | ||
} | ||
|
||
if (!club) { | ||
console.log(`${user} doesn't have a club`) | ||
bot.whisper(message, transcript('leaderList.invalidClub')) | ||
return | ||
} | ||
|
||
if (club.fields['Slack Channel ID'] != channel) { | ||
console.log(`${user} doesn't own channel ${channel}`) | ||
bot.whisper(message, transcript('leaderList.invalidChannel')) | ||
return | ||
} | ||
|
||
console.log(club.fields) | ||
// airGet('Leaders', '') | ||
// .then(leaders => { | ||
// bot.whisper(message, transcript('leaderList.leaders', { leaders })) | ||
// }) | ||
// .catch(err => { | ||
// throw err | ||
// }) | ||
}) | ||
.catch(err => { | ||
bot.whisper(err) | ||
console.error(err) | ||
}) | ||
} | ||
|
||
export default interactionLeaderList |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters