# Example modules.yaml — copy to ~/.config/streamdeck-go/modules.yaml
#
# Required Slack token scopes: users.profile:write, users:write, dnd:write
# Export your token: export SLACK_TOKEN="xoxp-..."

modules:
  slack:
    set_status:
      params:
        emoji: ":speech_balloon:"
        text: "In a meeting"
        expiry: "1h"
      exec: |
        curl -s -X POST https://slack.com/api/users.profile.set \
          -H "Authorization: Bearer {{env "SLACK_TOKEN"}}" \
          -H "Content-Type: application/json" \
          -d '{"profile":{"status_emoji":"{{.emoji}}","status_text":"{{.text}}","status_expiration":{{expiry .expiry}}}}'

    clear_status:
      exec: |
        curl -s -X POST https://slack.com/api/users.profile.set \
          -H "Authorization: Bearer {{env "SLACK_TOKEN"}}" \
          -H "Content-Type: application/json" \
          -d '{"profile":{"status_emoji":"","status_text":"","status_expiration":0}}'

    set_presence:
      params:
        presence: "away"
      exec: |
        curl -s -X POST https://slack.com/api/users.setPresence \
          -H "Authorization: Bearer {{env "SLACK_TOKEN"}}" \
          -H "Content-Type: application/json" \
          -d '{"presence":"{{.presence}}"}'

    snooze:
      params:
        minutes: "60"
      exec: |
        curl -s -X POST https://slack.com/api/dnd.setSnooze \
          -H "Authorization: Bearer {{env "SLACK_TOKEN"}}" \
          -H "Content-Type: application/json" \
          -d '{"num_minutes":{{.minutes}}}'

    go_offline:
      exec: |
        curl -s -X POST https://slack.com/api/users.setPresence \
          -H "Authorization: Bearer {{env "SLACK_TOKEN"}}" \
          -H "Content-Type: application/json" \
          -d '{"presence":"away"}' && \
        curl -s -X POST https://slack.com/api/users.profile.set \
          -H "Authorization: Bearer {{env "SLACK_TOKEN"}}" \
          -H "Content-Type: application/json" \
          -d '{"profile":{"status_emoji":":dumpsterfire:","status_text":"Offline","status_expiration":0}}'

    end_snooze:
      exec: |
        curl -s -X POST https://slack.com/api/dnd.endSnooze \
          -H "Authorization: Bearer {{env "SLACK_TOKEN"}}"
