Skip to content

Commit

Permalink
fix: get presence before profile logic to avoid unnecessary logic
Browse files Browse the repository at this point in the history
  • Loading branch information
JackCuthbert committed Nov 18, 2019
1 parent 639d96d commit 706b6e1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ async function main () {
}

// Status restrictions
console.log(`${LOG_SLK} Getting Slack profile`)
const currentProfile = await getSlackProfile()
if (!shouldSetStatus(currentProfile)) {
console.log(`${LOG_BOT} Custom status detected, skipping`)
return
}

console.log(`${LOG_SLK} Getting Slack presence`)
const currentPresence = await getSlackPresence()
if (currentPresence === 'away') {
Expand All @@ -146,6 +139,13 @@ async function main () {
return
}

console.log(`${LOG_SLK} Getting Slack profile`)
const currentProfile = await getSlackProfile()
if (!shouldSetStatus(currentProfile)) {
console.log(`${LOG_BOT} Custom status detected, skipping`)
return
}

// Now playing restrictions
console.log(`${LOG_LFM} Getting track info`)
const track = await getLastFmTrack(config.lastFM.username)
Expand Down

0 comments on commit 706b6e1

Please sign in to comment.