Skip to content

Commit

Permalink
Update server.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
shoushou1106 committed Dec 21, 2024
1 parent cdb1fc9 commit 9017eb4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const router = AutoRouter();
/**
* A simple hello page to verify the worker is working.
*/
router.get('/', () => {
return new Response(`Hello World`);
router.get('/', (request, env: Env) => {
return new Response(`Hello World, ${env.DISCORD_APPLICATION_ID}`);
});

router.post('/', async (request, env: Env) => {
Expand Down Expand Up @@ -170,7 +170,7 @@ async function streamFromAI(interaction: APIInteraction, prompt: string, env: En

// Update the message with the current AI response
await fetch(
`https://discord.com/api/v10/webhooks/${interaction.application_id}/${interaction.token}`,
`https://discord.com/api/v10/webhooks/${env.DISCORD_APPLICATION_ID}/${interaction.token}`,
{
method: "POST",
headers: {
Expand All @@ -183,7 +183,7 @@ async function streamFromAI(interaction: APIInteraction, prompt: string, env: En
);
}
await fetch(
`https://discord.com/api/v10/webhooks/${interaction.application_id}/${interaction.token}`,
`https://discord.com/api/v10/webhooks/${env.DISCORD_APPLICATION_ID}/${interaction.token}`,
{
method: "POST",
headers: {
Expand All @@ -199,7 +199,7 @@ async function streamFromAI(interaction: APIInteraction, prompt: string, env: En

// Handle errors by updating the message
await fetch(
`https://discord.com/api/v10/webhooks/${interaction.application_id}/${interaction.token}`,
`https://discord.com/api/v10/webhooks/${env.DISCORD_APPLICATION_ID}/${interaction.token}`,
{
method: "POST",
headers: {
Expand Down

0 comments on commit 9017eb4

Please sign in to comment.