Skip to content

Commit

Permalink
updates to buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
DasithKuruppu committed Jul 2, 2023
1 parent 83fceea commit 7a652e6
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 4 deletions.
16 changes: 14 additions & 2 deletions bot/embeds/templates/neverwinter/raid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const raidBuilder = ({
},
{
style: 1,
label: `Join Waitlist`,
label: `Wait`,
custom_id: buttons.joinWaitlistButton.id,
disabled: false,
emoji: {
Expand All @@ -163,7 +163,7 @@ export const raidBuilder = ({
},
{
style: 4,
label: `Rage quit`,
label: `Quit`,
custom_id: buttons.wontJoinButton.id,
disabled: false,
emoji: {
Expand All @@ -173,6 +173,18 @@ export const raidBuilder = ({
},
type: 2,
},
{
style: 5,
label: `Class Setup`,
url: `https://uglybot.click/dashboard/classes/`,
disabled: false,
type: 2,
emoji: {
id: `934762913166663710`,
name: `classSetup`,
animated: false,
},
},
],
},
],
Expand Down
1 change: 1 addition & 0 deletions bot/interactions/commands/remove/raidUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const removeRaidUserCommand = async (
const [persistedClassInfo, raidRecord] = await Promise.all([
getLastUsersClass(member, {
documentClient,
considerDefault: true,
}),
getRaid({ raidId }, { documentClient }),
]);
Expand Down
1 change: 1 addition & 0 deletions bot/interactions/commands/request/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const profileCommand = async (
member as APIInteractionGuildMember,
{
documentClient,
considerDefault: true
}
);
if (!lastUserClassActivity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const confirmButtonInteract = async (
const [persistedClassInfo, persistedRaidInfo] = await Promise.all([
getLastUsersClass(member, {
documentClient,
considerDefault: true,
}),
getRaid({ raidId }, { documentClient }),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const waitlistButtonInteract = async (
);
const persistedClassInfo = await getLastUsersClass(member, {
documentClient,
considerDefault: true,
});
const defaultSelectedClassType =
(new Map(NeverwinterClassesMap).get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const raidArtifactSelect = async (
);
const persistedClassInfo = await getLastUsersClass(member, {
documentClient,
considerDefault: true,
});
const defaultClassType =
(new Map(NeverwinterClassesMap).get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const raidMounttSelect = async (
);
const persistedClassInfo = await getLastUsersClass(member, {
documentClient,
considerDefault: true,
});
const defaultClassType =
(new Map(NeverwinterClassesMap).get(
Expand Down
11 changes: 9 additions & 2 deletions bot/interactions/messageComponents/utils/storeOps/fetchData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getUserByClass = async (
};
export const getLastUsersClass = async (
member: APIInteractionGuildMember,
{ documentClient }
{ documentClient, considerDefault = false }
) => {
const dbResult = await documentClient
.query({
Expand All @@ -38,7 +38,14 @@ export const getLastUsersClass = async (
.promise();
const { Items = [] } = dbResult;
const [Item] = Items.sort(fieldSorter(["-updatedAt", "-createdAt"]));
return Item;
const ItemDefaultClass = Items.find((item) => item.default);
if(considerDefault){
return ItemDefaultClass || Item;
}
else {
return Item;
}

};

export const getRaid = async (
Expand Down

0 comments on commit 7a652e6

Please sign in to comment.