Skip to content

Commit

Permalink
Refactor discord.js to parse DISCORD_MESSAGE_EMBEDS as an array of ob…
Browse files Browse the repository at this point in the history
…jects
  • Loading branch information
Adammatthiesen committed Nov 28, 2024
1 parent c837ee2 commit 24dd165
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ if (!GITHUB_ACTION || !DISCORD_WEBHOOK) {
console.log("DISCORD_MESSAGE", DISCORD_MESSAGE);
console.log("DISCORD_MESSAGE_EMBEDS", DISCORD_MESSAGE_EMBEDS);

// Convert the array of strings to an array of objects
if (DISCORD_MESSAGE_EMBEDS) {
try {
DISCORD_MESSAGE_EMBEDS = JSON.parse(DISCORD_MESSAGE_EMBEDS);
} catch (error) {
console.error("Failed to parse DISCORD_MESSAGE_EMBEDS", error);
}
}

function getBody() {
if (DISCORD_MESSAGE_EMBEDS) {
if (DISCORD_MESSAGE) {
Expand Down

0 comments on commit 24dd165

Please sign in to comment.