generated from nhcarrigan/template
fix: send webhook milestone notifications silently (#45)
## Summary - Adds `flags: 4096` (`MessageFlags.SUPPRESS_NOTIFICATIONS`) to the Discord webhook payload in `postMilestoneWebhook` - Milestone announcements (prestige, transcendence, apotheosis) will now appear in the channel without triggering desktop or mobile push notifications - Defines the magic number as a documented `suppressNotifications` constant for self-documentation - Updates the webhook test to assert `flags: 4096` is present in the outgoing payload Closes #41 ## Test plan - [ ] Lint passes: `pnpm lint` - [ ] Build passes: `pnpm build` - [ ] Tests pass with 100% coverage: `pnpm test` - [ ] Trigger a prestige/transcendence/apotheosis in-game and verify the Discord webhook message arrives without pinging anyone ✨ This issue was created with help from Hikari~ 🌸 Reviewed-on: #45 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #45.
This commit is contained in:
@@ -97,9 +97,10 @@ describe("webhook service", () => {
|
||||
await postMilestoneWebhook("user123", "prestige", counts);
|
||||
const [url, options] = mockFetch.mock.calls[0] as [string, RequestInit];
|
||||
expect(url).toBe("https://discord.com/webhook/abc");
|
||||
const body = JSON.parse(options.body as string) as { content: string };
|
||||
const body = JSON.parse(options.body as string) as { content: string; flags: number };
|
||||
expect(body.content).toContain("<@user123>");
|
||||
expect(body.content).toContain("prestiged");
|
||||
expect(body.flags).toBe(4096);
|
||||
});
|
||||
|
||||
it("posts transcendence message correctly", async () => {
|
||||
|
||||
Reference in New Issue
Block a user