feat: add pick, remove, and update the general /roleypoly command

This commit is contained in:
41666 2021-08-01 20:18:07 -04:00
parent a4207d5713
commit 1f55d0370a
10 changed files with 251 additions and 34 deletions

View file

@ -23,3 +23,19 @@ export const getPickableRoles = async (
return (await response.json()) as Record<Category['name'], CategorySlug>;
};
export const selectRole = async (
mode: 'add' | 'remove',
guildID: string,
userID: string,
roleID: string
): Promise<number> => {
const response = await apiFetch(
`/interactions-pick-role/${guildID}/${userID}/${roleID}`,
{
method: mode === 'add' ? 'PUT' : 'DELETE',
}
);
return response.status;
};

View file

@ -12,6 +12,14 @@ export const mustBeInGuild = (): InteractionResponse => ({
},
});
export const invalid = (): InteractionResponse => ({
type: InteractionCallbackType.CHANNEL_MESSAGE_WITH_SOURCE,
data: {
content: ':x: You filled that command out wrong...',
flags: InteractionFlags.EPHEMERAL,
},
});
export const somethingWentWrong = (): InteractionResponse => ({
type: InteractionCallbackType.CHANNEL_MESSAGE_WITH_SOURCE,
data: {