Upgrade to Pro — share decks privately, control downloads, hide ads and more …

さわやか待ち時間LINE botを作った話 / Sawayaka LINE bot

muttan
January 25, 2020

さわやか待ち時間LINE botを作った話 / Sawayaka LINE bot

#ふくもく会
#SawayakaMeetup

muttan

January 25, 2020
Tweet

More Decks by muttan

Other Decks in Programming

Transcript

  1. LINE botΛ࡞ͬͨΜ͢Α

    ;͘΋͘ձ ͦͷ60 ʙ৽೥ձʹ͸ंΛग़͢ͳʙ
    Kamiya Keisuke(@bath_poo_)

    View full-size slide

  2. ͓લ୭Αʁ
    • ෱Ҫେֶ޻ֶݚڀՊ M2
    • ΦλΫ
    • aikoͱҏ౻ඒདྷͷ࿩͹͔Γͯ͠Δ
    • TwitterͷΞΧ΢ϯτ໊͕සൟʹ
    มΘΔ͜ͱͰ༗໊
    • Ͱ΋େମʮ͘·͞Μʯͬͯݺ͹
    Εͯ·͢
    Kamiya Keisuke
    a.k.a kuma
    @bath_poo_

    View full-size slide

  3. ͍͖ͳΓͰ͕͢

    View full-size slide

  4. ͜Ε͸ͳΜͷ஍ਤͰ͠ΐ͏

    View full-size slide

  5. ͳΜͷ஍ਤʁ

    View full-size slide

  6. ͳΜͷ஍ਤʁ

    View full-size slide

  7. ͳΜͷ஍ਤʁ

    View full-size slide

  8. • ٠઒ʹຊళ͕͋Δ
    • ੩Ԭݝ੢෦ʹଟ͍
    • ࠷΋౦͕ޚ఼৔
    • ࠷΋੢͕ބ੢

    View full-size slide

  9. ͋ʂʂʂʂʂʂʂʂʂʂʂʂ

    View full-size slide

  10. ͞Θ΍͔͡ΌΜ
    • ୸ম͖Ϩετϥϯ͞Θ΍͔
    • ͛Μͭ͜ϋϯόʔά͕༗໊
    • ϗʔϜϖʔδͷURL͕sawayakaͰ͸ͳͯ͘genkotsu-hb
    ‣ https://www.genkotsu-hb.com
    • #SawayakaMeetup
    ڇ100% 250g 1,100ԁ(੫ࠐΈ)→

    View full-size slide

  11. ͞Θ΍͔ͷ଴ͪ࣌ؒ໰୊
    • ͛Μͭ͜ϋϯόʔά͸༗໊ʹͳΓ͗ͨ͢
    • ͋Δళฮ͸GW͸6h଴ͪʹͳͬͨͱ͔ͳΜͱ͔
    • ʢҰ෦ళฮΛআ͍ͯʣฏ೔Ͱ͋Ε͹͋·Γؾʹͤͣʹߦͬ
    ͯ΋ͬ͢ͱ৯΂ΒΕΔ
    • ౔೔͸ൺֱతࠞΜͰ͍Δ͜ͱ͕ଟ͍
    • ൟ๩ظʢGWɼ೥຤೥࢝ɼۙลͰͷϥΠϒΠϕϯτʣ͸
    ࣌ؒ଴ͪ( )ʹͳΔ͜ͱ΋βϥ
    → ͳΔ΂͘ళฮͰͷ଴ͪ࣌ؒΛݮΒ͍ͨ͠
    → ͔͠͠ళฮʹߦͬͯ଴ͪ࣌ؒΛ֬ೝ͢Δͷ͸໘౗
    N
    N ≥ 1

    View full-size slide

  12. ࠷ۙศརػೳ͕Ͱ͖ͨ

    View full-size slide

  13. AirWAITͷಋೖ
    • ʢళฮʣiPad͚ͩͰड෇γεςϜΛߏஙՄೳ
    • ʢϢʔβʔʣ͓ళͰड෇Λͨ͠ޙ͸Webϖʔδ͔Β଴
    ͪ࣌ؒΛ֬ೝ͢Δ͜ͱ͕Մೳ

    View full-size slide

  14. AirWAITͷಋೖ
    • ʢళฮʣiPad͚ͩͰड෇γεςϜΛߏஙՄೳ
    • ʢϢʔβʔʣ͓ళͰड෇Λͨ͠ޙ͸Webϖʔδ͔Β଴
    ͪ࣌ؒΛ֬ೝ͢Δ͜ͱ͕Մೳ

    View full-size slide

  15. AirWAITͷಋೖ
    • ʢళฮʣiPad͚ͩͰड෇γεςϜΛߏஙՄೳ
    • ʢϢʔβʔʣ͓ళͰड෇Λͨ͠ޙ͸Webϖʔδ͔Β଴
    ͪ࣌ؒΛ֬ೝ͢Δ͜ͱ͕Մೳ
    → Θ͟Θ͟ళฮʹߦ͔ͳͯ͘΋ྑ͘ͳͬͨ

    View full-size slide

  16. ͋Δ೔ͷग़དྷࣄ
    ͞Θ΍͔ͷ଴ͪ࣌ؒ
    ΦϯϥΠϯͰݟΕΔΑ͏ʹͳͬͨΑ
    ϚδʁͲ͏΍ͬͯΈΔͷʁ
    ͜ͷWebϖʔδΛ։͍ͯ…
    ΊΜͲ͆͘͞

    View full-size slide

  17. ͦ͏͔…
    • ͦͷͨΊ͚ͩʹSafari։͘ͷ͸໘౗
    • ͡Ό͋ͳΔ΂͘࢖༻ස౓͕ଟ͍΋ͷͰͳΜͱ͔Ͱ͖ͳ
    ͍͔…
    → LINEͳΒൺֱత࢖͏Μ͡Όͳ͍ʁ

    View full-size slide

  18. ͞Θ΍͔ͷ଴ͪ࣌ؒ
    LINE botΛ࡞ͬͨΜ͢Α

    ;͘΋͘ձ ͦͷ60 ʙ৽೥ձʹ͸ंΛग़͢ͳʙ
    Keisuke Kamiya(@bath_poo_)

    View full-size slide

  19. ΞʔΩςΫνϟ
    ᶃbotʹ޲͔ͬͯ
    ݕࡧΫΤϦΛ౤͛Δ
    ᶄAlgoliaͰݕࡧ
    ᶅݕࡧ݁ՌΛฦ͢
    ᶅݕࡧ݁ՌΛฦ͢
    εΫϨΠϐϯά݁ՌΛ
    ֨ೲ

    View full-size slide

  20. ΞʔΩςΫνϟ
    • Messaging APIͷWebhook༻ͷαʔό͸HerokuͰϗεςΟ
    ϯά
    → Go + Go modules੡
    • Ϋϩʔϥʔ΋HerokuͰϗεςΟϯά(3෼ʹ1ճऔಘ)
    → Python + pipenv੡
    • ݕࡧΛͲ͏͢Δ͔໎͕ͬͨɼ͢΂ͯͷࢥߟΛ์غͯ͠
    Algoliaʹ͢΂ͯ౤͛ͨ
    → ϥΠϒϥϦ΋υΩϡϝϯτ΋ॆ࣮͍ͯͯ͠։ൃ͕εϜʔζ
    ʹਐΜͩ
    https://speakerdeck.com/shinodogg/introducing-algolia-with-demo

    View full-size slide

  21. ͱ͜ΖͰAlgoliaͷ࢖༻ྉۚ͸…
    PQFSBUJPONPOUI
    SFDPSENPOUI

    View full-size slide

  22. ͱ͜ΖͰAlgoliaͷ࢖༻ྉۚ͸…
    • Operationͷఆٛ
    • ΦϒδΣΫτͷ௥Ճ΍ߋ৽΋̍ΦϖϨʔγϣϯ
    • ݄50000ΦϖϨʔγϣϯ͙ͬͯ͢αʔϏε͕ऴΘΓͦ͏
    → ͦΕ͸ͦ͏
    https://www.algolia.com/doc/faq/basics/what-is-an-operation/

    View full-size slide

  23. ͱ͜ΖͰAlgoliaͷ࢖༻ྉۚ͸…

    View full-size slide

  24. ͱ͜ΖͰAlgoliaͷ࢖༻ྉۚ͸…
    Μʁ

    View full-size slide

  25. ͱ͜ΖͰAlgoliaͷ࢖༻ྉۚ͸…
    Μʁ

    View full-size slide

  26. GitHub EducationΛ࢖͏
    • ֶੜͷಛݖGitHub Education
    • ͨ͘͞Μͷιϑτ΢ΣΞ΍SaaSɼPaaSͷ༗ྉϓϥϯ૬
    ౰ΛແྉͰ࢖͏͜ͱ͕Ͱ͖Δ
    • Algolia΋ର৅ʹͳͬͯ·ͨ͠

    View full-size slide

  27. ͱ͍͏Θ͚Ͱ

    View full-size slide

  28. σϞ
    • ݕࡧ͍ͨ͠ళฮΛೖྗ
    → ళฮ໊ͷ෦෼จࣈྻͷ৔߹ώοτ
    • ෳ਺ళฮͷ৔߹
    → CarouselTemplateΛ࢖༻
    • ళฮΛλοϓ
    → ৄࡉϖʔδ΁

    View full-size slide

  29. ·ͱΊ
    • ͞Θ΍͔ͷ଴ͪ࣌ؒΛڭ͑ͯ͘ΕΔLINE botΛॻ͍ͨ
    • GoͱPythonͱHerokuͱAlgoliaͰ࡞੒
    • LINE bot SDKͱAlgolia SDK͕ΊͪΌͪ͘Ό࢖͍΍͢
    ͔ͬͨͷͰγϡοͱ࡞Δ͜ͱ͕Ͱ͖Δ
    • ݱࡏ஍͔Βྑ͛͞ళฮΛαδΣετ͢Δػೳͱ͔͋Δ
    ͱ͍͍Ͷͬͯࢥ͍·ͨ͠
    ‣ Ͱ͖ͦ͏ɼAlgoliaͳΒͶ

    View full-size slide

  30. ʢ͞Θ΍͔ͷʣ·ͱΊ
    Ξϗ΄ͲࠞΉ
    ࠞΉ
    ඿দӺલͱ੩ԬӺલʹ
    ళฮ͕Ͱ͖ͨ
    ҏ౾ʹ͸ͳ͍
    ϥΠϒձ৔࠷دΓ

    View full-size slide