Skip to content

Commit

Permalink
fix: Wrong react
Browse files Browse the repository at this point in the history
  • Loading branch information
shoushou1106 committed Dec 21, 2024
1 parent 654b186 commit 94f0b75
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ router.post('/', async (request, env: Env) => {
"Content-Type": "application/json",
},
body: JSON.stringify({
type: InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
content: "*Waiting...*"
type: InteractionResponseType.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE
}),
}
);
Expand Down Expand Up @@ -153,7 +152,20 @@ async function streamFromAI(interaction: APIInteraction, prompt: string, env: En
// }
// return "No response";

try {
await fetch(
`https://discord.com/api/v10/webhooks/${env.DISCORD_APPLICATION_ID}/${interaction.token}/messages/@original`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
content: 'Hi',
}),
}
);

/*try {
const together = new Together({ apiKey: env.TOGETHER_API_KEY });
const stream = await together.chat.completions.create({
Expand Down Expand Up @@ -209,7 +221,6 @@ async function streamFromAI(interaction: APIInteraction, prompt: string, env: En
}),
}
);
}
return;
}*/
}
export default server;

0 comments on commit 94f0b75

Please sign in to comment.