Skip to content

Commit

Permalink
Merge pull request #80 from yoggys/master
Browse files Browse the repository at this point in the history
fix: missing pomelo coverage
  • Loading branch information
sylveon authored Jul 19, 2024
2 parents bad6944 + f08081e commit d9d3c0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions func/submission-created.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ export async function handler(event, context) {
},
};
}


const isPomelo = userInfo.discriminator === "0";
const username = isPomelo ? userInfo.username : `${userInfo.username}#${userInfo.discriminator}`;

const message = {
embed: {
title: "New appeal submitted!",
timestamp: new Date().toISOString(),
fields: [
{
name: "Submitter",
value: `<@${userInfo.id}> (${userInfo.username}#${userInfo.discriminator})`
value: `<@${userInfo.id}> (${username})`
},
{
name: "Why were you banned?",
Expand Down
2 changes: 1 addition & 1 deletion public/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2 id="username" class="ml-3 mb-0 align-self-center"></h2>

const avatar = userInfo.avatar
? `avatars/${encodeURIComponent(userInfo.id)}/${encodeURIComponent(userInfo.avatar)}.webp`
: `embed/avatars/${isPomelo ? ((userInfo.id >> 22) % 6) : (userInfo.discriminator % 5)}.png`;
: `embed/avatars/${isPomelo ? (Number(BigInt(userInfo.id) >> 22n) % 6) : (userInfo.discriminator % 5)}.png`;
document.getElementById("avatar").src = `https://cdn.discordapp.com/${avatar}?size=256`;

document.getElementById("username").textContent = isPomelo ? userInfo.username : `${userInfo.username}#${userInfo.discriminator}`;
Expand Down

0 comments on commit d9d3c0f

Please sign in to comment.