diff --git a/.gitignore b/.gitignore index 6704566..e67a88c 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,6 @@ dist # TernJS port file .tern-port + +# Local Netlify folder +.netlify \ No newline at end of file diff --git a/func/helpers/discord-helpers.js b/func/helpers/discord-helpers.js index 4e6395c..d73b165 100644 --- a/func/helpers/discord-helpers.js +++ b/func/helpers/discord-helpers.js @@ -1,4 +1,4 @@ -const API_ENDPOINT = "https://discord.com/api/v6"; +const API_ENDPOINT = "https://discord.com/api/v9"; const MAX_EMBED_FIELD_CHARS = 1024; const MAX_EMBED_FOOTER_CHARS = 2048; diff --git a/func/submission-created.js b/func/submission-created.js index c19007f..8c547f9 100644 --- a/func/submission-created.js +++ b/func/submission-created.js @@ -83,10 +83,17 @@ exports.handler = async function (event, context) { userId: userInfo.id }; - message.embed.description = `[Approve appeal and unban user](${unbanUrl.toString()}?token=${encodeURIComponent(createJwt(unbanInfo))})`; + message.components = [{ + type: 1, + components: [{ + type: 2, + style: 5, + label: "Approve appeal and unban user", + url: `${unbanUrl.toString()}?token=${encodeURIComponent(createJwt(unbanInfo))}` + }] + }]; } } - const result = await fetch(`${API_ENDPOINT}/channels/${encodeURIComponent(process.env.APPEALS_CHANNEL)}/messages`, { method: "POST", headers: { @@ -95,7 +102,6 @@ exports.handler = async function (event, context) { }, body: JSON.stringify(message) }); - if (result.ok) { if (process.env.USE_NETLIFY_FORMS) { return { @@ -110,7 +116,7 @@ exports.handler = async function (event, context) { }; } } else { - console.log(await result.json()); + console.log(JSON.stringify(await result.json())); throw new Error("Failed to submit message"); } }