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

はじめてのDiscordBot

 はじめてのDiscordBot

More Decks by 株式会社ビットキー / Bitkey Inc.

Other Decks in Technology

Transcript

  1. 1. ࣗݾ঺հ • ໊લ ◦ ͼ΍͖͋ (BYAK) • ձࣾ ◦

    גࣜձࣾϏοτΩʔ • ࢓ࣄ ◦ Go ͰόοΫΤϯυͷ։ൃ ◦ React+Firebase Ͱϑϩϯτͷ։ൃ ◦ C++ ͰϑΝʔϜ΢ΣΞͷςετ΍σόοά • झຯ ◦ ϘʔυήʔϜ ◦ VϥΠόʔͷਪ͠׆ 3
  2. 2. DiscordͱίϛϡχςΟ ίϛϡχςΟαʔόʔͱͯ͠ͷ Discord • ίϛϡχςΟʹ͸ɺίϛϡχςΟಛ༗ͷϧʔϧͱͦΕʹ൐͏ӡ༻࡞ۀ ͕ੜ·Ε͕ͪ ◦ ྫ: αʔόʔʹࢀՃͨ͠ਓ΁ͷΦϯϘʔσΟϯά

    ▪ ࣗݾ঺հɺϩʔϧͷద༻ ◦ ྫ: ϒϩʔυΩϟετ഑৴ͷࡍͷςΩετͷಡΈ্͛ 6 ࣗಈԽ͠Α͏ɹˠɹDiscord ͷ BotػೳΛ࢖͑͹Ͱ͖ͦ͏
  3. 3. Discord Bot Λಈ͔ͯ͠ΈΔ • Πϕϯτͱϋϯυϥ ◦ discord ͸͍͔ͭ͘Πϕϯτ͕ఆٛ͞Ε͍ͯͯɺదٓൃՐ͢Δͷ ͰɺΠϕϯτʹԠͨ͡ϋϯυϥΛొ࿥͢Δ͜ͱͰɺͦͷΠϕϯτ͕

    ൃੜͨ͠λΠϛϯάͰ bot ʹॲཧΛ࣮ߦͤ͞Δ͜ͱ͕Ͱ͖·͢ɻ ▪ ྫ: Ready: Bot͕αʔόʔʹ઀ଓ͠·ͨ͠ ▪ ྫ: Message Create: ϝοηʔδ͕ૹΒΕ·ͨ͠ ◦ discordgo Ͱ͸ discord ͷΠϕϯτ໊ʹରԠͨ͠ struct ͕ఆٛ͞Ε ͍ͯͯɺϋϯυϥͷୈ̎Ҿ਺ʹ౉͖ͬͯ·͢ɻ 13
  4. 28 5. ·ͱΊ • ·ͱΊ ◦ discordgo, dgvoice Λ࢖͏͜ͱͰ؆୯ʹBotΛ࣮૷Ͱ͖Δ ◦

    Discord্Ͱਓ͕ߦ͏ૢ࡞͸BotʹҠৡͰ͖Δ ◦ ͜͜Ͱઆ໌͠ͳ͔ͬͨΠϕϯτ΍ૢ࡞ʹ͍ͭͯ͸ެࣜυΩϡϝϯτΛࢀ র͠ɺରԠͨ͠ discordgo ͷAPIΛௐ΂Δͱྑ͍ɻ ▪ discordgo ͸ Discord API ͷ௿ϨϕϧϚοϐϯάΛ໨తͱͨ͠ϥΠϒ ϥϦͷͳͷͰɺެࣜυΩϡϝϯτ͕ͦͷ··౰ͯ͸·Δ͜ͱ͕ଟ͍ ▪ discordgo/examples ΋ࢀߟʹͳΔ ▪ Ͳ͏ͯ͠΋Θ͔Βͳ͚Ε͹ Discord Gophers ΁