Notion-MW
Notion-MW
98行目: 98行目:
[https://zenn.dev/azechi/scraps/a98add131e8410 DiscordのSlash Commandをwebhookで受信する方式で作ってみる]にある[https://github.com/discord/discord-interactions-js https://github.com/discord/discord-interactions-js]を使うとよさそう。これをNetlify(AWS Lambda)向けに書き換えて、以下のようになる(前述サイトの内容に加えて、使用された対象のメッセージリンクを送るようにしている)。これが動作するかどうか、まずはテストしてみよう。
[https://zenn.dev/azechi/scraps/a98add131e8410 DiscordのSlash Commandをwebhookで受信する方式で作ってみる]にある[https://github.com/discord/discord-interactions-js https://github.com/discord/discord-interactions-js]を使うとよさそう。これをNetlify(AWS Lambda)向けに書き換えて、以下のようになる(前述サイトの内容に加えて、使用された対象のメッセージリンクを送るようにしている)。これが動作するかどうか、まずはテストしてみよう。


<syntaxhighlight lang="visual basic">const { InteractionResponseType, InteractionType, verifyKey } = require('discord-interactions')
<syntaxhighlight lang="vb.net">const { InteractionResponseType, InteractionType, verifyKey } = require('discord-interactions')


const CLIENT_PUBLIC_KEY = process.env.CLIENT_PUBLIC_KEY;
const CLIENT_PUBLIC_KEY = process.env.CLIENT_PUBLIC_KEY;
138行目: 138行目:
<li><p>最初試していたとき、Netlify上では応答を返すところまで上手くいっているのに「インタラクションに失敗しました」interaction failed(一旦画面移動してから見ると「アプリケーションが応答しませんでした」application did not respondに変わっている)と出続けていたが、応答に</p>
<li><p>最初試していたとき、Netlify上では応答を返すところまで上手くいっているのに「インタラクションに失敗しました」interaction failed(一旦画面移動してから見ると「アプリケーションが応答しませんでした」application did not respondに変わっている)と出続けていたが、応答に</p>
<syntaxhighlight lang="</syntaxhighlight></li></ul>">
<syntaxhighlight lang="</syntaxhighlight></li></ul>">
visual basic 'headers': { 'Content-Type': 'application/json', }, ```
vb.net 'headers': { 'Content-Type': 'application/json', }, ```


<pre>を付けたら通った…</pre>
<pre>を付けたら通った…</pre>