mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 09:59:10 +00:00
feat: add pick, remove, and update the general /roleypoly command
This commit is contained in:
parent
a4207d5713
commit
1f55d0370a
10 changed files with 251 additions and 34 deletions
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue