{"_rev":"60-566ffdeb42a4918cfac4c15758732c76","time":{"created":"2024-01-12T14:08:09.587Z","1.0.0":"2024-01-11T13:34:17.512Z","modified":"2024-01-12T14:08:10.151Z","1.0.1":"2024-01-11T14:01:58.604Z","1.0.2":"2024-01-11T14:54:45.769Z","1.0.3":"2024-01-11T15:23:34.776Z","1.0.4":"2024-01-11T15:26:59.328Z","1.0.5":"2024-01-11T15:29:56.095Z","1.0.51":"2024-01-11T15:34:33.966Z","1.0.6":"2024-01-11T15:39:18.175Z","1.0.7":"2024-01-11T15:58:10.549Z","1.0.8":"2024-01-11T16:01:32.873Z","1.0.9":"2024-01-11T16:16:24.553Z","1.0.10":"2024-01-11T16:22:22.464Z","1.0.11":"2024-01-11T16:26:44.121Z","1.0.12":"2024-01-11T16:32:08.486Z","1.0.13":"2024-01-11T16:40:28.256Z","1.0.14":"2024-01-11T17:25:36.064Z","1.0.15":"2024-01-11T17:28:25.218Z","1.0.16":"2024-01-11T17:34:09.164Z","1.0.17":"2024-01-11T17:38:08.931Z","1.0.18":"2024-01-11T17:49:22.030Z","1.0.19":"2024-01-11T17:55:48.187Z","1.0.20":"2024-01-11T18:01:51.922Z","1.0.21":"2024-01-11T18:21:22.155Z","1.0.22":"2024-01-11T18:25:05.070Z","1.0.23":"2024-01-11T18:28:44.040Z","1.0.24":"2024-01-11T18:42:50.064Z","1.0.25":"2024-01-11T18:54:43.771Z","1.0.26":"2024-01-11T19:03:14.828Z","1.0.27":"2024-01-11T19:05:53.742Z","1.0.28":"2024-01-11T19:13:24.495Z","1.0.29":"2024-01-11T19:17:40.954Z","1.0.30":"2024-01-11T19:21:34.709Z","1.0.31":"2024-01-11T19:36:00.602Z","1.0.32":"2024-01-11T19:40:52.143Z","1.0.33":"2024-01-11T19:46:41.798Z","1.0.34":"2024-01-11T19:53:46.643Z","1.0.35":"2024-01-11T20:08:34.196Z","1.0.36":"2024-01-11T20:10:26.683Z","1.0.37":"2024-01-11T20:21:55.709Z","1.0.38":"2024-01-12T12:51:14.918Z","1.0.39":"2024-01-12T12:57:13.190Z","1.0.40":"2024-01-12T13:00:22.702Z","1.0.41":"2024-01-12T13:09:12.622Z","1.0.42":"2024-01-12T13:15:31.517Z","1.0.43":"2024-01-12T13:21:58.632Z","1.0.44":"2024-01-12T13:28:25.586Z","1.0.45":"2024-01-12T13:45:04.669Z","1.0.46":"2024-01-12T13:47:28.887Z","1.0.47":"2024-01-12T13:56:40.795Z","1.0.48":"2024-01-12T14:02:12.449Z","1.0.49":"2024-01-12T14:08:09.854Z"},"_id":"@thenekros/discord-xp","name":"@thenekros/discord-xp","dist-tags":{"latest":"1.0.49"},"versions":{"1.0.49":{"name":"@thenekros/discord-xp","version":"1.0.49","description":"A lightweight and easy to use economy framework for discord bots, uses MongoDB.","main":"index.js","dependencies":{"mongoose":"^6.5.1"},"repository":{"type":"git","url":"git+https://github.com/TheNeKroS/discord-xp-system.git"},"keywords":["discord","economy","discord.js","bot","bots","leveling","levels","discord-levels","discord-xp","xp","mongo","mongoose","mongodb","discord-economy","discord-eco","framework"],"author":{"name":"TheNeKroS"},"license":"MIT","bugs":{"url":"https://github.com/TheNeKroS/discord-xp-system/issues"},"homepage":"https://github.com/TheNeKros/discord-xp-system#readme","devDependencies":{"eslint":"^8.21.0","eslint-config-standard":"^17.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-n":"^15.2.4","eslint-plugin-promise":"^6.0.0"},"_id":"@thenekros/discord-xp@1.0.49","gitHead":"987c352a9555467825ddd6e44e3e95f75b784b0d","types":"./index.d.ts","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-0F0UIgTossBLQO1NDsRgbClrhzPoESpsIr3EGwMJ/k6RGtm0oVCVOXI8yI2e43UlaILUBooIj9wrOt3b7Poz3w==","shasum":"14deb4c73d13f5567732dcc67f73d45dd172ea3e","tarball":"https://registry.npmjs.org/@thenekros/discord-xp/-/discord-xp-1.0.49.tgz","fileCount":10,"unpackedSize":33060,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB8/dlU4UVCTtxpAnuvD1YtFVWiRS7NQBOo4sfjPrjgPAiBnfWFthkxLVv1FAWKYoZJ9EQKYCSVZhlyROHCXDLAWPw=="}]},"_npmUser":{"name":"thenekros","email":"nicolas95.jaramillo@gmail.com"},"directories":{},"maintainers":[{"name":"thenekros","email":"nicolas95.jaramillo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/discord-xp_1.0.49_1705068489670_0.05338913139088275"},"_hasShrinkwrap":false}},"maintainers":[{"name":"thenekros","email":"nicolas95.jaramillo@gmail.com"}],"description":"A lightweight and easy to use economy framework for discord bots, uses MongoDB.","homepage":"https://github.com/TheNeKros/discord-xp-system#readme","keywords":["discord","economy","discord.js","bot","bots","leveling","levels","discord-levels","discord-xp","xp","mongo","mongoose","mongodb","discord-economy","discord-eco","framework"],"repository":{"type":"git","url":"git+https://github.com/TheNeKroS/discord-xp-system.git"},"author":{"name":"TheNeKroS"},"bugs":{"url":"https://github.com/TheNeKroS/discord-xp-system/issues"},"license":"MIT","readme":"<p align=\"center\"><a href=\"https://nodei.co/npm/@TheNeKroS/discord-xp-system/\"><img src=\"https://nodei.co/npm/discord-xp.png\"></a></p>\n<p align=\"center\"><img src=\"https://img.shields.io/npm/v/discord-xp\"> <img src=\"https://img.shields.io/github/repo-size/MrAugu/discord-xp\"> <img src=\"https://img.shields.io/npm/l/discord-xp\"> <img src=\"https://img.shields.io/github/contributors/MrAugu/discord-xp\"> <img src=\"https://img.shields.io/github/package-json/dependency-version/MrAugu/discord-xp/mongoose\"> <a href=\"https://discord.gg/rk7cVyk\"><img src=\"https://discordapp.com/api/guilds/630058179547627592/widget.png\" alt=\"Discord server\"/></a></p>\n\n# @thenekros/discord-xp V1.0.2\n- A lightweight and easy to use xp framework for discord bots, uses MongoDB.\n- If you need help feel free to join our <a href=\"https://discord.gg/aP9UYfaFa4\">discord server</a> to talk and help you with your code.\n- If you encounter any of those fell free to open an issue in our <a href=\"https://github.com/MrAugu/discord-xp/issues\">github repository</a>.\n\n# Download & Update\nYou can download it from npm:\n```cli\nnpm i @thenekros/discord-xp\n```\nYou can update to a newer version to receive updates using npm.\n```cli\nnpm update @thenekros/discord-xp\n```\n\n# Changelog\n- **25 August 2022** (v1.1.18): `WARNING: This version contains breaking changes in the way the package parses number input!`\n  * The following methods now throw a TypeError if an invalid amount of xp was provided (xp is 0 or lower): `appendXp(), substractXp(), setXp()`\n\n- **07 August 2022** (v1.1.17):\n  * Adding cleanDatabase() method.\n  * Adding role rewards with the following methods: `createRoleReward(), deleteRoleReward(), fetchRoleReward()`\n\n- **27 May 2021** (v1.1.11):\n  * Adding deleteGuild() method.\n\n- **3 April 2021** (v1.1.10):\n  * Adding TS typings.\n\n- **25 February 2021** (v1.1.8):\n  * Preventing further deprection warnings to be displayed, if you encounter any of these deprecation issues, update the module.\n\n- **22 November 2020** (v1.1.7):\n\n`WARNING: This semi-major version contains breaking changes in the way leaderboard computing function works.`\n  * Added an optional `fetchPosition` argument to the `Levels.fetch` which will add the leaderboard rank as the `position` property. Caution: Will be slower on larger servers.\n  * `Levels.computeLeaderboard` is now asynchronous and can take in a third parameter called `fetchUsers` which will fetch all users on the leaderboard. This parameter **does not** require additional Gateway Intents. Caution: Will be substantially slower if you do not have `Guild_Members` intent and catch some users beforehand. \n\n- **16 July 2020**:\n  * Added `xpFor` method to calculate xp required for a specific level.\n```js\n/* xpFor Example */\nconst Levels = require(\"@TheNeKroS/discord-xp\");\n// Returns the xp required to reach level 30.\nvar xpRequired = Levels.xpFor(30);\n\nconsole.log(xpRequired); // Output: 90000\n```\n\n# Setting Up\nFirst things first, we include the module into the project.\n```js\nconst Levels = require(\"@TheNeKroS/discord-xp\");\n```\nAfter that, you need to provide a valid mongo database url, and set it. You can do so by:\n```js\nLevels.setURL(\"mongodb://...\"); // You only need to do this ONCE per process.\n```\n\n# Examples\n*Examples can be found in /test*\n\n# Methods\n\n**createRoleReward**\n\nCreates a role reward entry in database for the guild if it doesnt exist.\n```js\nLevels.createRoleReward(<GuildID - String>, <level - Number>, <roleId - String>);\n```\n- Output:\n```\nPromise<Object>\n```\n**deleteRoleReward**\n\nDeletes a role reward entry in database for the guild.\n```js\nLevels.deleteRoleReward(<GuildID - String>, <level - Number>);\n```\n- Output:\n```\nPromise<Object>\n```\n**fetchRoleReward**\n\nFetches a role reward entry in database for the guild.\n```js\nLevels.fetchRoleReward(<GuildID - String>, <level - Number>);\n```\n- Output:\n```\nPromise<Object>\n```\n**cleanDataBase**\n\nCleans the database from unknown users for a guild.\n```js\nLevels.CleanDatabase(<Client - Discord.js Client>, <GuildID - String>);\n```\n- Output:\n```\nPromise<Object>\n```\n----------------------------\n**createUser**\n\nCreates an entry in database for that user if it doesnt exist.\n```js\nLevels.createUser(<UserID - String>, <GuildID - String>);\n```\n- Output:\n```\nPromise<Object>\n```\n**deleteUser**\n\nIf the entry exists, it deletes it from database.\n```js\nLevels.deleteUser(<UserID - String>, <GuildID - String>);\n```\n- Output:\n```\nPromise<Object>\n```\n**deleteGuild**\n\nIf the entry exists, it deletes it from database.\n```js\nLevels.deleteGuild(<GuildID - String>);\n```\n- Output:\n```\nPromise<Object>\n```\n**appendXp**\n\nIt adds a specified amount of xp to the current amount of xp for that user, in that guild. It re-calculates the level. It creates a new user with that amount of xp, if there is no entry for that user. \n```js\nLevels.appendXp(<UserID - String>, <GuildID - String>, <Amount - Integer>);\n```\n- Output:\n```\nPromise<Boolean>\n```\n**appendLevel**\n\nIt adds a specified amount of levels to current amount, re-calculates and sets the xp reqired to reach the new amount of levels. \n```js\nLevels.appendLevel(<UserID - String>, <GuildID - String>, <Amount - Integer>);\n```\n- Output:\n```\nPromise<Boolean/Object>\n```\n**setXp**\n\nIt sets the xp to a specified amount and re-calculates the level.\n```js\nLevels.setXp(<UserID - String>, <GuildID - String>, <Amount - Integer>);\n```\n- Output:\n```\nPromise<Boolean/Object>\n```\n**setLevel**\n\nCalculates the xp required to reach a specified level and updates it.\n```js\nLevels.setLevel(<UserID - String>, <GuildID - String>, <Amount - Integer>);\n```\n- Output:\n```\nPromise<Boolean/Object>\n```\n**fetch** (**Updated recently!**)\n\nRetrives selected entry from the database, if it exists.\n```js\nLevels.fetch(<UserID - String>, <GuildID - String>, <FetchPosition - Boolean>);\n```\n- Output:\n```\nPromise<Object>\n```\n**subtractXp**\n\nIt removes a specified amount of xp to the current amount of xp for that user, in that guild. It re-calculates the level.\n```js\nLevels.subtractXp(<UserID - String>, <GuildID - String>, <Amount - Integer>);\n```\n- Output:\n```\nPromise<Boolean/Object>\n```\n**subtractLevel**\n\nIt removes a specified amount of levels to current amount, re-calculates and sets the xp reqired to reach the new amount of levels. \n```js\nLevels.subtractLevel(<UserID - String>, <GuildID - String>, <Amount - Number>);\n```\n- Output:\n```\nPromise<Boolean/Object>\n```\n**fetchLeaderboard**\n\nIt gets a specified amount of entries from the database, ordered from higgest to lowest within the specified limit of entries.\n```js\nLevels.fetchLeaderboard(<GuildID - String>, <Limit - Integer>);\n```\n- Output:\n```\nPromise<Array [Objects]>\n```\n**computeLeaderboard** (**Updated recently!**)\n\nIt returns a new array of object that include level, xp, guild id, user id, leaderboard position, username and discriminator.\n```js\nLevels.computeLeaderboard(<Client - Discord.js Client>, <Leaderboard - fetchLeaderboard output>, <fetchUsers - boolean, disabled by default>);\n```\n- Output:\n```\nPromise<Array [Objects]>\n```\n**xpFor**\n\nIt returns a number that indicates amount of xp required to reach a level based on the input.\n```js\nLevels.xpFor(<TargetLevel - Integer>);\n```\n- Output:\n```\nInteger\n```\n","readmeFilename":"README.md"}