Save 37% off PRO during our Black Friday Sale! »

Slack の困りごとを何とかしてみた①

Slack の困りごとを何とかしてみた①

2020.10.3
第8回 富士もくもく会 オンライン LT

1ac022a81a17900b312d8f7b03d2b4db?s=128

Yuuki Shimizu

October 03, 2020
Tweet

Transcript

  1. ʲୈճ ෋࢜΋͘΋͘ձ ΦϯϥΠϯ -5ʳ slackͷࠔΓ͝ͱΛ Կͱ͔ͯ͠Έͨᶃ 2020. 10. 3 しみず

    ゆうき 1
  2. ͓·͑୭Αʁ ͠Έͣ Ώ͏͖ • ࢁསݝߕ෎ࢢ ग़਎ɺ౦ژʹग़Ք͗த • ϞόΠϧΞϓϦ ΤϯδχΞ(Android/iOS) •

    ࠷ۙɺϦϯάϑΟοτ Ξυϕϯνϟʔʹ ͸·ͬͯ·͢ (3 kg མͪ·ͨ͠) 2
  3. ં֯ͷ LT ͳͷͰɺ ࠔΓ͝ͱΛղܾ͍ͨ͠ʂ 3

  4. ۀ຿Ͱͷ࠷ۙͷࠔΓ͝ͱ 4 ձࣾ Slack ͷνϟϯωϧ͕૿͑͗ͯ͢୳͢ͷ͕େมʂ શࣾ࿈བྷ ܽ੮࿈བྷ ߪೖਃ੥ ࡶஊ ։ൃؔ࿈৘ใڞ༗

    ֤छϩάग़ྗ ֤Ҋ݅ͷνʔϜ࿈བྷ χϡʔεڞ༗ πʔϧ༡ͼ৔ ֤ϝϯόʔͷ෼ใ ΠϕϯτࢀՃใࠂ FUD ׆ಈͷແ͍νϟϯωϧ͸Ϧετ͔ΒӅ͍ͨ͠
  5. աڈͷ LT Ͱ΋ Slack API Λ͞Θ͍ͬͯΔͷͰɺ 5

  6. ٱ͠ৼΓʹ Python ίʔυॻͧ͘ ʙ !! 6

  7. ͱࢥ͚ͬͨͲɺط੡ͷπʔϧΛݟ͚ͭ·ͨ͠ 7

  8. Symantec/slack-autoarchive • Python Ͱॻ͔Εͨ Slack ༻ ࣗಈΞʔΧΠϒ εΫϦϓτ • աڈ60೔ؒͰʢbot

    Ҏ֎ͷʣϝοηʔδ͕ͳ͍νϟϯωϧΛ ࣗಈͰΞʔΧΠϒ͢Δ • ΞʔΧΠϒͤͨ͘͞ͳ͍νϟϯωϧΛࢦఆՄೳ ʢϗϫΠτϦετʣ 8
  9. αΫοͱಋೖͯ͠Έͨ 9

  10. ᶃ ϦϙδτϦΛ Fork 10

  11. ᶄ Slack API Token Λऔಘɾઃఆ 11 API Token

  12. ᶅ GitHub Actions ϫʔΫϑϩʔ࡞੒ • ຖ݄1೔ 9:00AM(JST) ʹ࣮ߦ • 180೔Ҏ্ϝοηʔδ͕ແ͍

    νϟϯωϧ͕ର৅ͱͳΔΑ͏ ઃఆ • ϗϫΠτϦετΛ؀ڥม਺Ͱ ઃఆ 12 name: CI on: schedule: - cron: "0 0 1 * *" jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python 3.8 uses: actions/setup-python@v1 with: python-version: 3.8 - name: Install dependencies run: | pip install -r requirements.txt - name: Run auto-archive run: | SLACK_TOKEN=$SLACK_TOKEN ¥ DRY_RUN=$DRY_RUN ¥ python slack_autoarchive.py env: SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} DRY_RUN: false DAYS_INACTIVE: 180 WHITELIST_KEYWORDS: 'general,times_' ADMIN_CHANNEL: activity .github/workflows/main.yml
  13. ݁ՌɺࣗಈͰΞʔΧΠϒ͞Εͨ 13

  14. ·ͱΊ ʮSlack ͷࠔΓ͝ͱΛԿͱ͔ͯ͠Έͨʯ • Python ͩͱ΍Γ͍ͨ͜ͱΛ୹͍ίʔυͰαΫοͱ࣮ݱ Ͱ͖ͯྑ͍ʂ • GitHub Actions

    ศརʂ • ࣍͸ Slack ʹΞοϓϩʔυͨ͠ϑΝΠϧΛ؅ཧ͢Δπʔϧ Λ࡞Γ͍ͨʂ 14