mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
feat(api): update-roles will report x-audit-log-reason to discord
Signed-off-by: Katalina Okano <git@kat.cafe>
This commit is contained in:
parent
824fee0703
commit
d52508a046
1 changed files with 4 additions and 2 deletions
|
@ -21,10 +21,11 @@ import {
|
|||
const notFound = () => respond({ error: 'guild not found' }, { status: 404 });
|
||||
|
||||
export const UpdateRoles = withSession(
|
||||
({ guilds, user: { id: userID } }: SessionData) =>
|
||||
({ guilds, user: { id: userID, username, discriminator } }: SessionData) =>
|
||||
async (request: Request) => {
|
||||
const updateRequest = (await request.json()) as RoleUpdate;
|
||||
const [, , guildID] = new URL(request.url).pathname.split('/');
|
||||
const url = new URL(request.url);
|
||||
const [, , guildID] = url.pathname.split('/');
|
||||
|
||||
if (!guildID) {
|
||||
return respond({ error: 'guild ID missing from URL' }, { status: 400 });
|
||||
|
@ -67,6 +68,7 @@ export const UpdateRoles = withSession(
|
|||
method: 'PATCH',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'x-audit-log-reason': `${username}#${discriminator} changes their roles via ${url.hostname}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
roles: newRoles,
|
||||
|
|
Loading…
Add table
Reference in a new issue