mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 01:59:08 +00:00
feat: Slash Commands (#337)
* feat: add discord interactions worker * feat(interactions): update CI/CD and terraform to add interactions * chore: fix lint issues * chore: fix build & emulation * fix(interactions): deployment + handler * chore: remove worker-dist via gitignore * feat: add /pickable-roles and /pick-role basis * feat: add pick, remove, and update the general /roleypoly command * fix: lint missing Member import
This commit is contained in:
parent
dde05c402e
commit
066f68ffef
59 changed files with 1219 additions and 248 deletions
|
@ -1,5 +1,3 @@
|
|||
import { memberPassesAccessControl } from '@roleypoly/api/utils/access-control';
|
||||
import { accessControlViolation } from '@roleypoly/api/utils/responses';
|
||||
import {
|
||||
GuildData,
|
||||
Member,
|
||||
|
@ -10,9 +8,10 @@ import {
|
|||
SessionData,
|
||||
TransactionType,
|
||||
} from '@roleypoly/types';
|
||||
import { AuthType, discordFetch, respond } from '@roleypoly/worker-utils';
|
||||
import { difference, groupBy, keyBy, union } from 'lodash';
|
||||
import { AuthType, discordFetch, respond, withSession } from '../utils/api-tools';
|
||||
import { botToken } from '../utils/config';
|
||||
import { withSession } from '../utils/api-tools';
|
||||
import { botToken, uiPublicURI } from '../utils/config';
|
||||
import {
|
||||
getGuild,
|
||||
getGuildData,
|
||||
|
@ -57,10 +56,6 @@ export const UpdateRoles = withSession(
|
|||
|
||||
const guildData = await getGuildData(guildID);
|
||||
|
||||
if (!memberPassesAccessControl(guildCheck, guildMember, guildData.accessControl)) {
|
||||
return accessControlViolation();
|
||||
}
|
||||
|
||||
const newRoles = calculateNewRoles({
|
||||
currentRoles: guildMember.roles,
|
||||
guildRoles: guild.roles,
|
||||
|
@ -76,7 +71,7 @@ export const UpdateRoles = withSession(
|
|||
method: 'PATCH',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'x-audit-log-reason': `${username}#${discriminator} changes their roles via ${url.hostname}`,
|
||||
'x-audit-log-reason': `Picked their roles via ${uiPublicURI}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
roles: newRoles,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue