diff --git a/README.md b/README.md
index 34bf70a..a5c6296 100644
--- a/README.md
+++ b/README.md
@@ -31,9 +31,15 @@ Create a folder within your projects directory and run the following inside it:
Once finished:
- In the folder from where you ran the git command, run `npm install`, which will install the required packages.
-- Rename `config.js.example` to `config.js`, and give it the required intents and any partials you may require.
-- Rename `.env-example` to `.env` and put in your bot token in it and save.
-
+- Make sure you're using node.js `v16.14.2`
+- Rename `.env-example` to `.env` and put each key inside as follows
+ - DISCORD_TOKEN - Your bot token
+ - OWNER - Your discord ID
+ - API_URL - The URL of your API instance (for example: http://localhost:3000/v1, must include /v1/ at the end)
+ - API_KEY - The API key (Can be anything, shared between bot and API)
+ - GOOGLE_API_KEY - Google maps API key
+- Set up the [API](https://github.com/Project-Skill-Tree/Skill-Tree-API)
+- Set up the [editor](https://github.com/Project-Skill-Tree/Skill-Tree-Editor)
## Starting the bot
To start the bot, in the command prompt, run the following command:
@@ -46,4 +52,4 @@ Read the [documentation wiki](https://www.projectskilltree.com)
Read [Installation](#installation) to get started.
This project uses Eslint for code formatting. Install it [here](https://eslint.org/) and run it before making a pull request with your changes.
-You can run Eslint via `npx eslint --fix .`.
+You can run Eslint via `npx eslint --fix .`.
\ No newline at end of file
diff --git a/modules/XPHelper.js b/modules/XPHelper.js
index d40d882..be87720 100644
--- a/modules/XPHelper.js
+++ b/modules/XPHelper.js
@@ -60,4 +60,14 @@ exports.calcXPFromLevel = level => Math.floor(-2550*(1 - Math.pow(1.02, level)))
* @param {number} xp - total XP
* @returns {number} - XP required to level up
*/
-exports.calcLevelFromXP = xp => Math.floor(Math.log(1/2550*xp + 1) / Math.log(1.02));
\ No newline at end of file
+exports.calcLevelFromXP = xp => {
+ let currentXP = 0;
+ let lastXP = 0;
+ let i = 0;
+ for (; currentXP < xp; i++) {
+ const levelXP = exports.calcXPFromLevel(i);
+ currentXP += levelXP - lastXP;
+ lastXP = levelXP;
+ }
+ return i - 2;
+}
\ No newline at end of file
diff --git a/modules/menuHelper.js b/modules/menuHelper.js
index 30489ee..7dacb99 100644
--- a/modules/menuHelper.js
+++ b/modules/menuHelper.js
@@ -285,7 +285,7 @@ const createRow = (currentPage, length) => {
}
const createDropDownBox = actions => {
- const actionList = actions.map(a => a.name).join("/");
+ const actionList = actions.map(a => a.name).join("/").slice(0,100);
return new MessageActionRow().addComponents(
new MessageSelectMenu().setCustomId("actions").setPlaceholder(actionList).addOptions(
actions.map(
diff --git a/modules/skillAPIHelper.js b/modules/skillAPIHelper.js
index ca4a878..7595d78 100644
--- a/modules/skillAPIHelper.js
+++ b/modules/skillAPIHelper.js
@@ -190,16 +190,16 @@ exports.cancel = (userID, toCancel) => {
* Sets the completed state of a user's skill task for a given date
* @param userid - userID
* @param task
- * @param day
+ * @param date - javascript date object
* @param checked - T/F if checked/unchecked
*/
-exports.updateTask = async (userid, task, day, checked) => {
+exports.updateTask = async (userid, task, date, checked) => {
const res = await axios
.post(process.env.API_URL + "tasks/updateTask", {
userid: userid,
taskid: task.id,
checked: checked,
- day: day
+ date: date.getTime()
}, {
headers: {
api_key: getAPIKey()
diff --git a/modules/weeklyReviewRenderer.js b/modules/weeklyReviewRenderer.js
index fe8a3dd..5e3128d 100644
--- a/modules/weeklyReviewRenderer.js
+++ b/modules/weeklyReviewRenderer.js
@@ -58,7 +58,7 @@ const getWeeklyReview = async (user, tasks) => {
* @param canvas
* @return {Promise}
*/
-const drawHeaderFooter = async(canvas, user) => {
+const drawHeaderFooter = async (canvas, user) => {
const context = canvas.getContext("2d");
context.font = "30px \"Akira\"";
diff --git a/slash/skilltree/taskList.js b/slash/skilltree/taskList.js
index 14daf03..79ed656 100644
--- a/slash/skilltree/taskList.js
+++ b/slash/skilltree/taskList.js
@@ -113,7 +113,7 @@ const createTaskList = async (client, interaction, tasks, userID, timezoneOffset
//Toggle checked
task.setChecked(!task.isChecked(date, timezoneOffset), date, timezoneOffset);
//Get levelup and unlocks
- const [levelUp, unlocked] = await updateTask(userID, task, day, task.isChecked(date, timezoneOffset));
+ const [levelUp, unlocked] = await updateTask(userID, task, date, task.isChecked(date, timezoneOffset));
if (levelUp !== 0) {
const user = await getUser(userID, interaction.user.username);