-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(userAvailability #134): user availability and preferences can be…
… specified
- Loading branch information
1 parent
a3022ea
commit 3c73738
Showing
20 changed files
with
1,713 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { convertToDiscordDate } from "../../../interactions/messageComponents/utils/date/dateToDiscordTimeStamp"; | ||
|
||
const availabilityInfo = ({ | ||
userId, | ||
availabilityList, | ||
prefferedRaids, | ||
timestamp = new Date(), | ||
requestedTime = Date.now(), | ||
}) => { | ||
return { | ||
type: "rich", | ||
title: `Raid summary for the upcoming week`, | ||
description: `<@${userId}}> availablility for raids\n | ||
Last updated - ${convertToDiscordDate("now", { | ||
relative: true, | ||
})} | ||
`, | ||
color: 0xffa200, | ||
timestamp, | ||
// thumbnail: { | ||
// url: `https://www.dasithsblog.com/images/Ranger-Hunter-Build.png`, | ||
// height: 0, | ||
// width: 0, | ||
// }, | ||
// author: { | ||
// name: `${userName}`, | ||
// }, | ||
fields: availabilityList.map( | ||
({ | ||
availableDay, | ||
availableStartTime, | ||
availableDuration, | ||
}) => { | ||
return { | ||
name: `Availablility`, | ||
value: `${availableDay} ${availableStartTime} ${availableDuration}`, | ||
inline: false, | ||
}; | ||
} | ||
), | ||
// footer: { | ||
// text: `Footer text`, | ||
// }, | ||
}; | ||
}; | ||
|
||
export const availabilityBuilder = ({ | ||
userName, | ||
userId, | ||
availabilityList, | ||
prefferedRaids = [], | ||
}) => { | ||
const availabilityInfoEmbed = availabilityInfo({ | ||
userId, | ||
availabilityList, | ||
prefferedRaids, | ||
}); | ||
console.log({ prefferedRaids }); | ||
return { | ||
components: [ | ||
{ | ||
type: 1, | ||
components: [ | ||
{ | ||
style: 3, | ||
label: `Refresh`, | ||
emoji: { | ||
id: `1074205923154858014`, | ||
name: `refresh`, | ||
animated: false, | ||
}, | ||
custom_id: `button_raidavailability_refresh`, | ||
disabled: false, | ||
type: 2, | ||
}, | ||
], | ||
}, | ||
], | ||
embeds: [availabilityInfoEmbed], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.