Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix release-done of discord bot

Brendan Allan2c253aa823f4
diff --git a/apps/discord-bot/src/index.ts b/apps/discord-bot/src/index.ts
index 71407c45e..2cba5e9a9 100644
--- a/apps/discord-bot/src/index.ts
+++ b/apps/discord-bot/src/index.ts
@@ -131,7 +131,7 @@ app.post(
return new Response('Successfully updated message', { status: 200 });
}
case 'release-done': {
- await fetch(`https://discord.com/api/v10/channels/${interaction.channel_id}`, {
+ await fetch(`https://discord.com/api/v10/channels/${interaction.channel_id}/messages`, {
method: 'POST',
body: JSON.stringify(
releaseWorkflowDoneMessageData({
@@ -140,7 +140,10 @@ app.post(
workflowRunId: c.get('githubToken').run_id,
})
),
- headers: { 'Content-Type': 'application/json' },
+ headers: {
+ 'Content-Type': 'application/json',
+ Authorization: `Bot ${c.env.DISCORD_BOT_TOKEN}`,
+ },
});
return new Response('Successfully sent message', { status: 200 });
diff --git a/apps/discord-bot/worker-configuration.d.ts b/apps/discord-bot/worker-configuration.d.ts
index 45ec127f5..f3dc950e8 100644
--- a/apps/discord-bot/worker-configuration.d.ts
+++ b/apps/discord-bot/worker-configuration.d.ts
@@ -2,5 +2,6 @@
interface Env {
release_discord_interactions: KVNamespace;
- GITHUB_TOKEN: "SECRET";
+ GITHUB_TOKEN: string;
+ DISCORD_BOT_TOKEN: string;
}
diff --git a/apps/discord-bot/wrangler.jsonc b/apps/discord-bot/wrangler.jsonc
index 4c4a4c8eb..d593de38b 100644
--- a/apps/discord-bot/wrangler.jsonc
+++ b/apps/discord-bot/wrangler.jsonc
@@ -9,7 +9,7 @@
"compatibility_date": "2025-02-14",
"observability": {
"enabled": true
- },
+ }
/**
* Smart Placement
* Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
@@ -22,13 +22,13 @@
* databases, object storage, AI inference, real-time communication and more.
* https://developers.cloudflare.com/workers/runtime-apis/bindings/
*/
- "kv_namespaces": [{ "binding": "release_discord_interactions", "id": "846b080b86914e2ba666d35acee35c9a" }]
+ // "kv_namespaces": [{ "binding": "release_discord_interactions", "id": "846b080b86914e2ba666d35acee35c9a" }]
/**
* Environment Variables
* https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
*/
- // "vars": { "MY_VARIABLE": "production_value" },
+ // "vars": { "GITHUB_TOKEN": "SECRET", "DISCORD_BOT_TOKEN": "SECRET" }
/**
* Note: Use secrets to store sensitive data.
* https://developers.cloudflare.com/workers/configuration/secrets/