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
1
220
Discord Embede SDK入門…… してみたかった話
2024-03-22
【エンジニアLTイベント】春のアウトプットLT会登壇資料です
godan
March 22, 2024
Tweet
Share
More Decks by godan
See All by godan
ミシンと刺繍とOSS
godan
0
6
Nest Hubがある生活
godan
2
22
オンライン配信の始め方
godan
3
76
SOFT SKILLSは定期的に読み返したくな良書
godan
2
35
今年どれだけ本読んだ?
godan
0
52
本とスプシと同人誌
godan
0
180
Tesseract.jsで始めるゲームライフ改善
godan
0
69
プレゼンテーションで表紙を作る技術
godan
1
65
Re:Re:GASで始めるゲーム開発
godan
0
170
Other Decks in Programming
See All in Programming
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Berlin
prof18
0
110
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
1.9k
Temporalを取り巻く仕様を整理する
sajikix
0
120
Activities at Cairo Library
cairolibrary720
0
1.2k
CSC307 Lecture 06
javiergs
PRO
0
360
Xcode 16のPreviewModifierと@Previewableを活用した効率的なプレビュー方法の考察
ojun9
2
160
CSC307 Lecture 07
javiergs
PRO
0
220
Android開発者のための Kotlin Multiplatform入門
ntaro
0
190
しくじり先生 Image Matching Challenge 2024 編
goosehaaan
0
810
DynamoDB コスト最適化っぽいことの基本 with Terraform
kuro_kurorrr
2
250
Rust.Nagoya #1
codemountains
0
170
Javaの現状2024夏 / Java current status 2024 summer
kishida
4
1.4k
Featured
See All Featured
Music & Morning Musume
bryan
43
5.9k
Stop Working from a Prison Cell
hatefulcrawdad
266
20k
What's in a price? How to price your products and services
michaelherold
239
11k
Thoughts on Productivity
jonyablonski
64
4.1k
Creatively Recalculating Your Daily Design Routine
revolveconf
214
11k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
13
430
Agile that works and the tools we love
rasmusluckow
325
20k
How To Stay Up To Date on Web Technology
chriscoyier
784
250k
Art, The Web, and Tiny UX
lynnandtonic
291
20k
The Language of Interfaces
destraynor
151
23k
Large-scale JavaScript Application Architecture
addyosmani
506
110k
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の知識がなさすぎて間に合わなかったです… 今年中になかしら⼀つアプリを出したい……!
おわり ⾃宅ネットワークはまたどこかで……