Skip to content

Commit

Permalink
better discord formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
k2xl committed Jun 19, 2024
1 parent 745e968 commit 69721ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pages/api/report/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default withAuth({
return res.status(400).json({ error: 'You have already reported this. Please wait for it to be reviewed.' });
}

const content = `User ${userReporting.name} reported a ${reportType} by user ${userBeingReported.name} for reason ${reportReason} with message: ${message}. [Link](${url})`;
const content = `User ${userReporting.name} reported a [${reportType}](${url}) by user ${userBeingReported.name} for reason ${reportReason} with message:\n\`${message}\`.`;

await queueDiscordWebhook( DiscordChannel.DevPriv, content);

Expand Down
4 changes: 2 additions & 2 deletions tests/pages/api/report/report.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('pages/api/report/index.ts', () => {
// Assert that queueDiscordWebhook was called with the expected arguments
expect(queueDiscordWebhook).toHaveBeenCalledWith(
expect.any(String),
expect.stringContaining('User test reported a Review by user BBB for reason HARASSMENT with message: This is a test report. [Link](https://pathology'),
expect.stringMatching(/User test reported a \[Review\]\(https.*\) by user BBB for reason HARASSMENT with message:\n`This is a test report`./),
);
},
});
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('pages/api/report/index.ts', () => {
// Assert that queueDiscordWebhook was called with the expected arguments
expect(queueDiscordWebhook).toHaveBeenCalledWith(
expect.any(String),
expect.stringContaining('User Curator reported a Review by user BBB for reason HARASSMENT with message: This is a test report. [Link](https://pathology'),
expect.stringMatching(/User Curator reported a \[Review\]\(https.*\) by user BBB for reason HARASSMENT with message:\n`This is a test report`./),
);
},
});
Expand Down

0 comments on commit 69721ae

Please sign in to comment.