Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Discord Embede SDK入門…… してみたかった話
Search
godan
March 22, 2024
Programming
560
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Discord Embede SDK入門…… してみたかった話
2024-03-22
【エンジニアLTイベント】春のアウトプットLT会登壇資料です
godan
March 22, 2024
More Decks by godan
See All by godan
献立を支える技術
godan
1
98
僕の イベントスタッフ 装備の最適解
godan
2
170
YAPC::Hakodateの映像記録を支える技術
godan
5
670
ミシンと刺繍とOSS
godan
3
190
Nest Hubがある生活
godan
2
120
オンライン配信の始め方
godan
3
210
SOFT SKILLSは定期的に読み返したくな良書
godan
2
110
今年どれだけ本読んだ?
godan
0
140
本とスプシと同人誌
godan
0
370
Other Decks in Programming
See All in Programming
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
280
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.5k
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.3k
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
360
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
170
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
210
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
160
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
120
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
350k
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
300
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
260
Featured
See All Featured
Are puppies a ranking factor?
jonoalderson
1
3.6k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
240
Ruling the World: When Life Gets Gamed
codingconduct
0
260
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
170
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
620
GraphQLとの向き合い方2022年版
quramy
50
15k
Between Models and Reality
mayunak
4
350
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
210
Transcript
虎の穴ラボ エンジニア
⾃⼰紹介 最近は⿓が如く3とラスティッド‧モスがマイブーム 倫理が退廃した世界と ⼈類が退廃した世界が好き
Discord Embedded SDKについて - Discordの通話にアクティビティとしてアプリを起動できる - watch together, gartic phoneなど⼀部に公開されてい
た - 18⽇に⼀般でもSDKを通して実装できるように!
Discord Embedded SDKについて https://discord.com/build/embedded-app-sdk
Discord Embedded SDKについて - Discordの通話にアクティビティとしてアプリを起動できる - watch together, gartic phoneなど⼀部に公開されていた
- 18⽇に⼀般でもSDKを通して実装できるように! - 将来的には収益化などもできそう - > 「デベロッパーが⾃らのアプリを構築、共有、配信し、ユーザーの⽬に触れ、そして収益化する。私たちはDiscordを、その全てができる最⾼の場所にした いと考えています」 https://gigazine.net/news/20240313-discord-sdk-third-party/
とりあえず⼊⾨する - ⾊々遊べそうな気配を感じる - 会社でもDiscordは使っているのでなにか仕込みたい → とりあえず触ってみよう!
とりあえず⼊⾨する - Discord内のiFrameで動作するページ - やりとりは⼤雑把に2種類 - Discordのイベントに対して関数を⽤意して引っ掛ける - Discordに対してコマンドを発⾏する
とりあえず⼊⾨する Client App Discord (iFrame) Discord API App Server ソケット開通
初期化 アプリ情報取得 アプリ情報 認証リクエスト OAuth code 送付 認証 アクセストークン アクセストークン SD K が い い 感 じ に や っ て く れ る
とりあえず⼊⾨する とりあえず公式の「Building Your First Activity in Discord」を試す https://discord.com/developers/docs/activities/building-an-activity
とりあえず⼊⾨する Discord Developer Portalからアプリを作る
とりあえず入門する // Import the SDK import { DiscordSDK } from
"@discord/embedded-app-sdk"; import "./style.css"; import rocketLogo from '/rocket.png'; // Instantiate the SDK const discordSdk = new DiscordSDK(import.meta.env.VITE_DISCORD_CLIENT_ID); setupDiscordSdk().then(() => { console.log("Discord SDK is ready"); }); async function setupDiscordSdk() { await discordSdk.ready(); } document.querySelector('#app').innerHTML = ` <div> <img src="${rocketLogo}" class="logo" alt="Discord" /> <h1>Hello, World!</h1> </div> `;
とりあえず⼊⾨する サーバーを実⾏したら合わせてCloudflared tunnelを実⾏する $ npm run dev client terminal output
VITE v5.0.12 ready in 100 ms ➜ Local: http://localhost:5173/ ➜ Network: use --host to expose ➜ press h + enter to show help $ cloudflared tunnel --url http://localhost:5173
Cloudflare tunnelとは - Cloudflareを通して外部からlocalへトンネリングしてくれ る - 今回はローカルの開発サーバーへアクセスするためのURL を取得するために使っている
URLを登録する
URLを登録する - 悪意あるエンドポイントにリクエストしない対策 - パスごとにアクセス先のエンドポイントを指定する
Hello, world!
ここで⼒尽きました React導⼊までは頑張った
ここで⼒尽きました - ⾊々遊べそう - 参加サーバーや名前、発⾔中?なども取れそう - 基本はSPAなのでwebでできることは基本全部できる - 普段使ってるサービス内で⾃分のアプリが動いてる
ここで⼒尽きました - 複数ユーザーの同期を取る必要 - ポーリングか、WebSocketか何かしらがいる - WebSocketの知識がなさすぎて間に合わなかったです… 今年中になかしら⼀つアプリを出したい……!
おわり ⾃宅ネットワークはまたどこかで……