simply-xp 2.0.0-dev.1 → 2.0.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/lib/src/Fonts/Baloo-Regular.eot +0 -0
- package/lib/src/add.d.ts +10 -2
- package/lib/src/add.js +3 -3
- package/lib/src/cards.js +2 -2
- package/lib/src/functions/database.d.ts +11 -2
- package/lib/src/functions/utilities.d.ts +5 -5
- package/lib/src/functions/utilities.js +6 -6
- package/lib/src/set.d.ts +10 -2
- package/lib/src/set.js +3 -3
- package/lib/xp.d.ts +1 -1
- package/lib/xp.js +2 -2
- package/package.json +70 -70
- package/lib/src/Fonts/Baloo-Regular.ttf +0 -0
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ yarn add simply-xp@dev
|
|
|
44
44
|
- Added `debug`, `auto_create`, `auto_purge` options for `connect()` function
|
|
45
45
|
- Added `db` class for extended database functionality
|
|
46
46
|
- Added `leaderboardCard()` function
|
|
47
|
-
- Added `
|
|
47
|
+
- Added `convertFrom()` function
|
|
48
48
|
- Added `migrate` class
|
|
49
49
|
|
|
50
50
|
# 🎉 V2 Changes 🎉
|
|
@@ -66,4 +66,5 @@ yarn add simply-xp@dev
|
|
|
66
66
|
- `charts()` Requires new arguments.
|
|
67
67
|
- `rank()` is **deprecated**, use `rankCard()` instead.
|
|
68
68
|
- `rankCard()` Requires completely new arguments.
|
|
69
|
-
- `roleSetup()` functions loses `client` argument.
|
|
69
|
+
- `roleSetup()` functions loses `client` argument.
|
|
70
|
+
- `leaderboard()` loses `client` argument, and returns `user` instead of `userID`
|
|
Binary file
|
package/lib/src/add.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ import { UserResult } from "./functions/database";
|
|
|
11
11
|
* @throws {XpFatal} - If parameters are not provided correctly
|
|
12
12
|
*/
|
|
13
13
|
export declare function addLevel(userId: string, guildId: string, level: number, username?: string): Promise<UserResult>;
|
|
14
|
+
/**
|
|
15
|
+
* XP Results
|
|
16
|
+
* @property {boolean} hasLevelledUp - Whether the user has levelled up or not.
|
|
17
|
+
*/
|
|
18
|
+
interface XPResult extends UserResult {
|
|
19
|
+
hasLevelledUp: boolean;
|
|
20
|
+
}
|
|
14
21
|
/**
|
|
15
22
|
* Add XP to a user.
|
|
16
23
|
* @async
|
|
@@ -19,10 +26,11 @@ export declare function addLevel(userId: string, guildId: string, level: number,
|
|
|
19
26
|
* @param {number | {min: number, max: number}} xpData - The XP to add, can be a number or an object with min and max properties.
|
|
20
27
|
* @param {string} username - Username to use if auto_create is enabled.
|
|
21
28
|
* @link `Documentation:` https://simplyxp.js.org/docs/addxp
|
|
22
|
-
* @returns {Promise<
|
|
29
|
+
* @returns {Promise<XPResult>} - Object of user data on success.
|
|
23
30
|
* @throws {XpFatal} - If parameters are not provided correctly.
|
|
24
31
|
*/
|
|
25
32
|
export declare function addXP(userId: string, guildId: string, xpData: number | {
|
|
26
33
|
min: number;
|
|
27
34
|
max: number;
|
|
28
|
-
}, username?: string): Promise<
|
|
35
|
+
}, username?: string): Promise<XPResult>;
|
|
36
|
+
export {};
|
package/lib/src/add.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @link `Documentation:` https://simplyxp.js.org/docs/addlevel
|
|
10
10
|
* @returns {Promise<UserResult>} - Object of user data on success
|
|
11
11
|
* @throws {XpFatal} - If parameters are not provided correctly
|
|
12
|
-
*/async function addLevel(userId,guildId,level,username){if(!userId)throw new xplogs_1.XpFatal({function:"addLevel()",message:"User ID was not provided"});if(!guildId)throw new xplogs_1.XpFatal({function:"addLevel()",message:"Guild ID was not provided"});if(!level)throw new xplogs_1.XpFatal({function:"addLevel()",message:"Level was not provided"});var e=await database_1.db.findOne({collection:"simply-xps",data:{user:userId,guild:guildId}});if(e)return database_1.db.updateOne({collection:"simply-xps",data:{user:userId,guild:guildId}},{collection:"simply-xps",data:{user:userId,guild:guildId,level:e.level+level,xp:(0,utilities_1.
|
|
12
|
+
*/async function addLevel(userId,guildId,level,username){if(!userId)throw new xplogs_1.XpFatal({function:"addLevel()",message:"User ID was not provided"});if(!guildId)throw new xplogs_1.XpFatal({function:"addLevel()",message:"Guild ID was not provided"});if(!level)throw new xplogs_1.XpFatal({function:"addLevel()",message:"Level was not provided"});var e=await database_1.db.findOne({collection:"simply-xps",data:{user:userId,guild:guildId}});if(e)return database_1.db.updateOne({collection:"simply-xps",data:{user:userId,guild:guildId}},{collection:"simply-xps",data:{user:userId,guild:guildId,level:e.level+level,xp:(0,utilities_1.convertFrom)(level+e.level)}});if(xp_1.xp.auto_create&&username)return database_1.db.createOne({collection:"simply-xps",data:{guild:guildId,user:userId,name:username,level:level,xp:(0,utilities_1.convertFrom)(level)}});throw new xplogs_1.XpFatal({function:"addLevel()",message:"User does not exist"})}
|
|
13
13
|
/**
|
|
14
14
|
* Add XP to a user.
|
|
15
15
|
* @async
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
* @param {number | {min: number, max: number}} xpData - The XP to add, can be a number or an object with min and max properties.
|
|
19
19
|
* @param {string} username - Username to use if auto_create is enabled.
|
|
20
20
|
* @link `Documentation:` https://simplyxp.js.org/docs/addxp
|
|
21
|
-
* @returns {Promise<
|
|
21
|
+
* @returns {Promise<XPResult>} - Object of user data on success.
|
|
22
22
|
* @throws {XpFatal} - If parameters are not provided correctly.
|
|
23
|
-
*/async function addXP(userId,guildId,xpData,username){if(!("number"==typeof xpData||"object"==typeof xp_1.xp&&xpData.min&&xpData.max))throw new xplogs_1.XpFatal({function:"addXP()",message:"XP is not a number or object, make sure you are using the correct syntax"});if("object"==typeof xpData&&(xpData=Math.floor(Math.random()*(xpData.max-xpData.min)+xpData.min)),!userId)throw new xplogs_1.XpFatal({function:"addXP()",message:"User ID was not provided"});if(!guildId)throw new xplogs_1.XpFatal({function:"addXP()",message:"Guild ID was not provided"});var e=await database_1.db.findOne({collection:"simply-xps",data:{user:userId,guild:guildId}});if(e)
|
|
23
|
+
*/async function addXP(userId,guildId,xpData,username){if(!("number"==typeof xpData||"object"==typeof xp_1.xp&&xpData.min&&xpData.max))throw new xplogs_1.XpFatal({function:"addXP()",message:"XP is not a number or object, make sure you are using the correct syntax"});if("object"==typeof xpData&&(xpData=Math.floor(Math.random()*(xpData.max-xpData.min)+xpData.min)),!userId)throw new xplogs_1.XpFatal({function:"addXP()",message:"User ID was not provided"});if(!guildId)throw new xplogs_1.XpFatal({function:"addXP()",message:"Guild ID was not provided"});var e=await database_1.db.findOne({collection:"simply-xps",data:{user:userId,guild:guildId}});let a;if(e)a=await database_1.db.updateOne({collection:"simply-xps",data:{user:userId,guild:guildId}},{collection:"simply-xps",data:{user:userId,guild:guildId,level:(0,utilities_1.convertFrom)(e.xp+xpData,"xp"),xp:e.xp+xpData}}).catch(err=>{throw new xplogs_1.XpFatal({function:"addXP()",message:err.stack})});else{if(!xp_1.xp.auto_create||!username)throw new xplogs_1.XpFatal({function:"addXP()",message:"User does not exist"});a=await database_1.db.createOne({collection:"simply-xps",data:{guild:guildId,user:userId,name:username,level:(0,utilities_1.convertFrom)(xpData,"xp"),xp:xpData}}).catch(err=>{throw new xplogs_1.XpFatal({function:"addXP()",message:err.stack})})}return{...a,hasLevelledUp:a.level>e.level}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.addXP=exports.addLevel=void 0;const utilities_1=require("./functions/utilities"),xplogs_1=require("./functions/xplogs"),database_1=require("./functions/database"),xp_1=require("../xp");exports.addLevel=addLevel,exports.addXP=addXP;
|
package/lib/src/cards.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @link [Documentation](https://simplyxp.js.org/docs/rankCard)
|
|
10
10
|
* @returns {Promise<{attachment: Buffer, description: string, name: string}>}
|
|
11
11
|
* @throws {XpFatal} - If parameters are not provided correctly
|
|
12
|
-
*/async function rankCard(guild,user,options={},locales={}){if(!guild)throw new xplogs_1.XpFatal({function:"rankCard()",message:"No Guild Provided"});if(!user)throw new xplogs_1.XpFatal({function:"rankCard()",message:"No User Provided"});options.legacy=!0;let e,a;if(locales?.level||(locales.level="Level"),locales?.next_level||(locales.next_level="Next Level"),locales?.xp||(locales.xp="XP"),xplogs_1.XpLog.debug("rankCard()","LEGACY MODE ENABLED"),xplogs_1.XpLog.info("rankCard()","Modern RankCard is not supported yet, coming soon!"),!user?.avatarURL.endsWith(".png")&&!user.avatarURL.endsWith(".jpg")&&!user.avatarURL.endsWith(".webp"))throw new xplogs_1.XpFatal({function:"rankCard()",message:"Invalid avatar image, avatar image must be a png, jpg, or webp"});if(!user||!user.id||!user.username)throw new xplogs_1.XpFatal({function:"rankCard()",message:"Invalid User Provided, user must contain id, username, and avatarURL."});canvas_1.GlobalFonts.registerFromPath(options?.font||(0,path_1.join)(__dirname,"Fonts","Baloo-Regular.
|
|
12
|
+
*/async function rankCard(guild,user,options={},locales={}){if(!guild)throw new xplogs_1.XpFatal({function:"rankCard()",message:"No Guild Provided"});if(!user)throw new xplogs_1.XpFatal({function:"rankCard()",message:"No User Provided"});options.legacy=!0;let e,a;if(locales?.level||(locales.level="Level"),locales?.next_level||(locales.next_level="Next Level"),locales?.xp||(locales.xp="XP"),xplogs_1.XpLog.debug("rankCard()","LEGACY MODE ENABLED"),xplogs_1.XpLog.info("rankCard()","Modern RankCard is not supported yet, coming soon!"),!user?.avatarURL.endsWith(".png")&&!user.avatarURL.endsWith(".jpg")&&!user.avatarURL.endsWith(".webp"))throw new xplogs_1.XpFatal({function:"rankCard()",message:"Invalid avatar image, avatar image must be a png, jpg, or webp"});if(!user||!user.id||!user.username)throw new xplogs_1.XpFatal({function:"rankCard()",message:"Invalid User Provided, user must contain id, username, and avatarURL."});canvas_1.GlobalFonts.registerFromPath(options?.font||(0,path_1.join)(__dirname,"Fonts","Baloo-Regular.eot"),"Sans Serif"),cachedRankImage=cachedRankImage||await(0,canvas_1.loadImage)(options?.background||"https://i.ibb.co/dck2Tnt/rank-card.webp");let o=await database_1.db.findOne({collection:"simply-xps",data:{guild:guild.id,user:user.id}});if(!o){if(!xp_1.xp.auto_create)throw new xplogs_1.XpFatal({function:"rankCard()",message:"User not found in database"});o=await(0,xp_1.create)(guild.id,user.id,user.username)}var t,r,l,n,d,i,s,c=(await database_1.db.find({collection:"simply-xps",data:{guild:guild.id}})).sort((a,b)=>b.xp-a.xp).findIndex(u=>u.user===user.id)+1;return options?.legacy?(t=user.username.replace(/[\u007f-\uffff]/g,""),r=options?.color||"#9900ff",l=options?.lvlbar||"#ffffff",options=options?.lvlbarBg||"#ffffff",s=shortener(o.xp)+(" "+locales.xp),n=locales.level+(" "+shortener(o.level)),d=(0,utilities_1.convertFrom)(o.level+1),i=(0,utilities_1.convertFrom)(o.level),i=100*(o.xp-i)/(d-i)*660/100,cachedRankContext&&cachedRankCanvas?(e=cachedRankCanvas,a=cachedRankContext):(e=(0,canvas_1.createCanvas)(1080,400),RoundedBox(a=e.getContext("2d"),0,0,e.width,e.height,50),a.clip(),a.fillStyle="#000000",a.fillRect(0,0,1080,400),a.globalAlpha=.7,a.drawImage(cachedRankImage,-5,0,1090,400),a.restore(),a.fillStyle="#000000",a.globalAlpha=.4,a.fillRect(40,0,240,e.height),a.globalAlpha=1),a.save(),RoundedBox(a,70,30,180,180,50),a.strokeStyle=r,a.lineWidth=15,a.stroke(),a.clip(),a.drawImage(await(0,canvas_1.loadImage)(user.avatarURL),70,30,180,180),a.restore(),a.save(),RoundedBox(a,70,320,180,50,20),a.strokeStyle="#BFC85A22",a.stroke(),a.clip(),a.fillStyle=r,a.globalAlpha=1,a.fillRect(70,320,180,50),a.globalAlpha=1,a.fillStyle="#ffffff",a.textAlign="center",dynamicFont(a,s,160,358,160,32),a.restore(),a.save(),RoundedBox(a,70,240,180,50,20),a.strokeStyle="#BFC85A22",a.stroke(),a.clip(),a.fillStyle=r,a.globalAlpha=1,a.fillRect(70,240,180,50),a.globalAlpha=1,a.fillStyle="#ffffff",a.textAlign="center",dynamicFont(a,n,160,278,160,32),a.restore(),a.save(),a.textAlign="left",a.fillStyle="#ffffff",a.shadowColor="#000000",a.shadowBlur=15,a.shadowOffsetX=1,a.shadowOffsetY=1,a.font='39px "Sans Serif"',a.fillText(t,390,80),a.restore(),a.save(),a.textAlign="right",a.fillStyle="#ffffff",a.shadowColor="#000000",a.shadowBlur=15,a.shadowOffsetX=1,a.shadowOffsetY=1,a.font='55px "Sans Serif"',a.fillText("#"+c,e.width-55,80),a.restore(),a.save(),RoundedBox(a,390,305,660,70,Number(20)),a.strokeStyle="#BFC85A22",a.stroke(),a.clip(),a.fillStyle="#ffffff",a.textAlign="center",dynamicFont(a,guild.name,720,355,700,45),a.globalAlpha=.2,a.fillRect(390,305,660,70),a.restore(),a.save(),RoundedBox(a,390,145,660,50,20),a.strokeStyle="#BFC85A22",a.stroke(),a.clip(),a.fillStyle=options,a.globalAlpha=.2,a.fillRect(390,145,660,50),a.restore(),a.save(),RoundedBox(a,390,145,i,50,20),a.strokeStyle="#BFC85A22",a.stroke(),a.clip(),a.fillStyle=l,a.globalAlpha=.5,a.fillRect(390,145,i,50),a.restore(),a.save(),a.textAlign="left",a.fillStyle="#ffffff",a.globalAlpha=.8,a.font='30px "Sans Serif"',a.fillText(locales.next_level+": "+shortener(d)+" "+locales.xp,390,230),a.restore(),s="{current} / {needed}".replace(/{needed}/g,shortener(d)).replace(/{current}/g,shortener(o.xp)),a.textAlign="center",a.fillStyle="#474747",a.globalAlpha=1,a.font='30px "Sans Serif"',a.fillText(s,730,180)):e=(0,canvas_1.createCanvas)(1080,360),{attachment:e.toBuffer("image/png"),description:"Simply-XP Rank Card",name:"rank.png"}}
|
|
13
13
|
/**
|
|
14
14
|
* Generate a simple leaderboard card
|
|
15
15
|
* @async
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
* @link [Documentation](https://simplyxp.js.org/docs/leaderboard)
|
|
21
21
|
* @returns {Promise<{attachment: Buffer, description: string, name: string}>}
|
|
22
22
|
* @throws {XpFatal} - If parameters are not provided correctly
|
|
23
|
-
*/async function leaderboardCard(data,options={},guildInfo,locales={}){var e,a;if(!data||data.length<1)throw new xplogs_1.XpFatal({function:"leaderboardCard()",message:"There must be at least 1 user in the data array"});!cachedLeaderboardArtwork&&options?.artworkImage&&(cachedLeaderboardArtwork=await(0,canvas_1.loadImage)(options.artworkImage)),!cachedLeaderboardImage&&options?.backgroundImage&&(cachedLeaderboardImage=await(0,canvas_1.loadImage)(options.backgroundImage)),locales.level||(locales.level="LEVEL"),locales.members||(locales.members="Members"),data=data.slice(0,8);let o,t,r,l=(r=options?.light?{artworkColors:options?.artworkColors||["#374bff","#5f69ff"],backgroundColor:"#f0f0eb",borderColors:options?.borderColors||["#ffa237","#ffcc6b"],evenColor:"#dcdcdc",oddColor:"#c8c8c8",primaryTextColor:"#000000",secondaryTextColor:"rgba(0,0,0,0.5)"}:{artworkColors:options?.artworkColors||["#374bff","#333793"],backgroundColor:"#141414",borderColors:options?.borderColors||["#ffa237","#b67125"],evenColor:"#1e1e1e",oddColor:"#282828",primaryTextColor:"#ffffff",secondaryTextColor:"rgba(255,255,255,0.5)"},cachedLeaderboardCanvas&&cachedLeaderboardContext?(o=cachedLeaderboardCanvas,t=cachedLeaderboardContext):(o=(0,canvas_1.createCanvas)(1350,1080),RoundedBox(t=o.getContext("2d"),0,0,o.width,o.height,20),t.clip(),(e=t.createLinearGradient(0,0,o.width,0)).addColorStop(0,r.artworkColors[0]),e.addColorStop(1,r.artworkColors[1]),t.fillStyle=e,t.fillRect(0,0,o.width,220),cachedLeaderboardArtwork&&(t.fillStyle="#000000",t.fillRect(0,0,o.width,220),t.globalAlpha=.5,t.drawImage(cachedLeaderboardArtwork,0,0,o.width,220),t.globalAlpha=1),t.fillStyle=options.backgroundColor||r.backgroundColor,t.fillRect(0,220,o.width,1080),cachedLeaderboardImage&&(t.globalAlpha=.9,t.drawImage(cachedLeaderboardImage,0,220,o.width,1080),t.globalAlpha=1)),guildInfo&&guildInfo?.imageURL&&guildInfo?.name&&guildInfo?.memberCount&&(e=await(0,canvas_1.loadImage)(guildInfo.imageURL),t.save(),t.beginPath(),t.arc(150,110,90,0,2*Math.PI,!0),t.closePath(),t.clip(),t.drawImage(e,60,20,180,180),t.restore(),(options=t.createLinearGradient(0,0,0,220)).addColorStop(0,r.borderColors[0]),options.addColorStop(1,r.borderColors[1]),t.strokeStyle=options,t.lineWidth=10,t.beginPath(),t.arc(150,110,90,0,2*Math.PI,!0),t.stroke(),t.fillStyle=r.primaryTextColor,t.font='60px "Sans Serif"',t.fillText(guildInfo.name,270,110),t.fillStyle=r.secondaryTextColor,t.font='40px "Sans Serif"',t.fillText(guildInfo.memberCount+" "+locales.members,270,160)),r.evenColor);for(let e=0;e<data.length;e++)a=300+90*e,1===data.length?RoundedBox(t,30,a,1290,90,20):0===e?RoundedBox(t,30,a,1290,90,20,{top:!0,bottom:!1}):e===data.length-1?RoundedBox(t,30,a,1290,90,20,{top:!1,bottom:!0}):RoundedBox(t,30,a,1290,90,0),t.fillStyle=l,t.globalAlpha=cachedLeaderboardImage?.5:1,t.fill(),t.globalAlpha=1,t.textAlign="left",t.font='30px "Sans Serif"',t.fillStyle=r.secondaryTextColor,t.fillText(e+1+".",60,55+a),t.textAlign="left",t.font='40px "Sans Serif"',t.fillStyle=r.primaryTextColor,t.fillText(data[e]?.name||data[e]?.user||"???",120,60+a),t.textAlign="right",t.font='30px "Sans Serif"',t.fillStyle=r.primaryTextColor,t.fillText(shortener(data[e]?.level)||"???",1270,55+a),t.fillStyle=r.secondaryTextColor,t.fillText(locales.level,1270-t.measureText(shortener(data[e]?.level)||"???").width-15,55+a),l=l===r.evenColor?r.oddColor:r.evenColor;return{attachment:o.toBuffer("image/png"),description:"Simply-XP Leaderboard Card",name:"leaderboard.png"}}function RoundedBox(ctx,x,y,width,height,radius,roundCorners={top:!0,bottom:!0}){ctx.beginPath(),ctx.moveTo(x+(roundCorners.top?radius:0),y),ctx.lineTo(x+width-(roundCorners.top?radius:0),y),roundCorners.top&&ctx.quadraticCurveTo(x+width,y,x+width,y+radius),ctx.lineTo(x+width,y+height-(roundCorners.bottom?radius:0)),roundCorners.bottom&&ctx.quadraticCurveTo(x+width,y+height,x+width-radius,y+height),ctx.lineTo(x+(roundCorners.bottom?radius:0),y+height),roundCorners.bottom&&ctx.quadraticCurveTo(x,y+height,x,y+height-radius),ctx.lineTo(x,y+(roundCorners.top?radius:0)),roundCorners.top&&ctx.quadraticCurveTo(x,y,x+radius,y),ctx.closePath()}function shortener(count){var e,a=["","k","M","B","T","Qa","Qi","Sx","Sp"];return count&&0!==count?count===1/0?"∞":(e=Math.floor(Math.log(count)/Math.log(1e3)),a.length<=e?count.toFixed(0)+a[a.length-1]:(count/Math.pow(1e3,e)).toFixed(0===e?0:2)+a[e]):"0"}function dynamicFont(context,text,x,y,maxWidth,maxSize){let e=maxSize;for(;0<e&&(context.font=e+'px "Sans Serif"',!(context.measureText(text).width<maxWidth));)e--;context.textAlign="center",context.fillText(text,x,y)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.leaderboardCard=exports.rankCard=void 0;const canvas_1=require("@napi-rs/canvas"),xplogs_1=require("./functions/xplogs"),database_1=require("./functions/database"),utilities_1=require("./functions/utilities"),path_1=require("path"),xp_1=require("../xp");let cachedRankImage,cachedRankCanvas,cachedRankContext,cachedLeaderboardArtwork,cachedLeaderboardCanvas,cachedLeaderboardContext,cachedLeaderboardImage;exports.rankCard=rankCard,exports.leaderboardCard=leaderboardCard;
|
|
23
|
+
*/async function leaderboardCard(data,options={},guildInfo,locales={}){var e,a;if(!data||data.length<1)throw new xplogs_1.XpFatal({function:"leaderboardCard()",message:"There must be at least 1 user in the data array"});!cachedLeaderboardArtwork&&options?.artworkImage&&(cachedLeaderboardArtwork=await(0,canvas_1.loadImage)(options.artworkImage)),!cachedLeaderboardImage&&options?.backgroundImage&&(cachedLeaderboardImage=await(0,canvas_1.loadImage)(options.backgroundImage)),canvas_1.GlobalFonts.registerFromPath(options?.font||(0,path_1.join)(__dirname,"Fonts","Baloo-Regular.eot"),"Sans Serif"),locales.level||(locales.level="LEVEL"),locales.members||(locales.members="Members"),data=data.slice(0,8);let o,t,r,l=(r=options?.light?{artworkColors:options?.artworkColors||["#374bff","#5f69ff"],backgroundColor:"#f0f0eb",borderColors:options?.borderColors||["#ffa237","#ffcc6b"],evenColor:"#dcdcdc",oddColor:"#c8c8c8",primaryTextColor:"#000000",secondaryTextColor:"rgba(0,0,0,0.5)"}:{artworkColors:options?.artworkColors||["#374bff","#333793"],backgroundColor:"#141414",borderColors:options?.borderColors||["#ffa237","#b67125"],evenColor:"#1e1e1e",oddColor:"#282828",primaryTextColor:"#ffffff",secondaryTextColor:"rgba(255,255,255,0.5)"},cachedLeaderboardCanvas&&cachedLeaderboardContext?(o=cachedLeaderboardCanvas,t=cachedLeaderboardContext):(o=(0,canvas_1.createCanvas)(1350,1080),RoundedBox(t=o.getContext("2d"),0,0,o.width,o.height,20),t.clip(),(e=t.createLinearGradient(0,0,o.width,0)).addColorStop(0,r.artworkColors[0]),e.addColorStop(1,r.artworkColors[1]),t.fillStyle=e,t.fillRect(0,0,o.width,220),cachedLeaderboardArtwork&&(t.fillStyle="#000000",t.fillRect(0,0,o.width,220),t.globalAlpha=.5,t.drawImage(cachedLeaderboardArtwork,0,0,o.width,220),t.globalAlpha=1),t.fillStyle=options.backgroundColor||r.backgroundColor,t.fillRect(0,220,o.width,1080),cachedLeaderboardImage&&(t.globalAlpha=.9,t.drawImage(cachedLeaderboardImage,0,220,o.width,1080),t.globalAlpha=1)),guildInfo&&guildInfo?.imageURL&&guildInfo?.name&&guildInfo?.memberCount&&(e=await(0,canvas_1.loadImage)(guildInfo.imageURL),t.save(),t.beginPath(),t.arc(150,110,90,0,2*Math.PI,!0),t.closePath(),t.clip(),t.drawImage(e,60,20,180,180),t.restore(),(options=t.createLinearGradient(0,0,0,220)).addColorStop(0,r.borderColors[0]),options.addColorStop(1,r.borderColors[1]),t.strokeStyle=options,t.lineWidth=10,t.beginPath(),t.arc(150,110,90,0,2*Math.PI,!0),t.stroke(),t.fillStyle=r.primaryTextColor,t.font='60px "Sans Serif"',t.fillText(guildInfo.name,270,110),t.fillStyle=r.secondaryTextColor,t.font='40px "Sans Serif"',t.fillText(guildInfo.memberCount+" "+locales.members,270,160)),r.evenColor);for(let e=0;e<data.length;e++)a=300+90*e,1===data.length?RoundedBox(t,30,a,1290,90,20):0===e?RoundedBox(t,30,a,1290,90,20,{top:!0,bottom:!1}):e===data.length-1?RoundedBox(t,30,a,1290,90,20,{top:!1,bottom:!0}):RoundedBox(t,30,a,1290,90,0),t.fillStyle=l,t.globalAlpha=cachedLeaderboardImage?.5:1,t.fill(),t.globalAlpha=1,t.textAlign="left",t.font='30px "Sans Serif"',t.fillStyle=r.secondaryTextColor,t.fillText(e+1+".",60,55+a),t.textAlign="left",t.font='40px "Sans Serif"',t.fillStyle=r.primaryTextColor,t.fillText(data[e]?.name||data[e]?.user||"???",120,60+a),t.textAlign="right",t.font='30px "Sans Serif"',t.fillStyle=r.primaryTextColor,t.fillText(shortener(data[e]?.level)||"???",1270,55+a),t.fillStyle=r.secondaryTextColor,t.fillText(locales.level,1270-t.measureText(shortener(data[e]?.level)||"???").width-15,55+a),l=l===r.evenColor?r.oddColor:r.evenColor;return{attachment:o.toBuffer("image/png"),description:"Simply-XP Leaderboard Card",name:"leaderboard.png"}}function RoundedBox(ctx,x,y,width,height,radius,roundCorners={top:!0,bottom:!0}){ctx.beginPath(),ctx.moveTo(x+(roundCorners.top?radius:0),y),ctx.lineTo(x+width-(roundCorners.top?radius:0),y),roundCorners.top&&ctx.quadraticCurveTo(x+width,y,x+width,y+radius),ctx.lineTo(x+width,y+height-(roundCorners.bottom?radius:0)),roundCorners.bottom&&ctx.quadraticCurveTo(x+width,y+height,x+width-radius,y+height),ctx.lineTo(x+(roundCorners.bottom?radius:0),y+height),roundCorners.bottom&&ctx.quadraticCurveTo(x,y+height,x,y+height-radius),ctx.lineTo(x,y+(roundCorners.top?radius:0)),roundCorners.top&&ctx.quadraticCurveTo(x,y,x+radius,y),ctx.closePath()}function shortener(count){var e,a=["","k","M","B","T","Qa","Qi","Sx","Sp"];return count&&0!==count?count===1/0?"∞":(e=Math.floor(Math.log(count)/Math.log(1e3)),a.length<=e?count.toFixed(0)+a[a.length-1]:(count/Math.pow(1e3,e)).toFixed(0===e?0:2)+a[e]):"0"}function dynamicFont(context,text,x,y,maxWidth,maxSize){let e=maxSize;for(;0<e&&(context.font=e+'px "Sans Serif"',!(context.measureText(text).width<maxWidth));)e--;context.textAlign="center",context.fillText(text,x,y)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.leaderboardCard=exports.rankCard=void 0;const canvas_1=require("@napi-rs/canvas"),xplogs_1=require("./functions/xplogs"),database_1=require("./functions/database"),utilities_1=require("./functions/utilities"),path_1=require("path"),xp_1=require("../xp");let cachedRankImage,cachedRankCanvas,cachedRankContext,cachedLeaderboardArtwork,cachedLeaderboardCanvas,cachedLeaderboardContext,cachedLeaderboardImage;exports.rankCard=rankCard,exports.leaderboardCard=leaderboardCard;
|
|
@@ -18,14 +18,23 @@ export interface UserOptions {
|
|
|
18
18
|
xp?: number;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The result of a user document.
|
|
23
|
+
* @property {string} [_id] - The ID of the document.
|
|
24
|
+
* @property {string} user - The user ID.
|
|
25
|
+
* @property {string} [name] - The username.
|
|
26
|
+
* @property {string} guild - The guild ID.
|
|
27
|
+
* @property {number} level - The level.
|
|
28
|
+
* @property {number} xp - The XP.
|
|
29
|
+
*/
|
|
30
|
+
export interface UserResult {
|
|
22
31
|
_id?: string;
|
|
23
32
|
user: string;
|
|
24
33
|
name?: string;
|
|
25
34
|
guild: string;
|
|
26
35
|
level: number;
|
|
27
36
|
xp: number;
|
|
28
|
-
}
|
|
37
|
+
}
|
|
29
38
|
/**
|
|
30
39
|
* Options for creating a level role document.
|
|
31
40
|
* @property {string} collection - The collection to create the document in.
|
|
@@ -23,17 +23,17 @@ interface NewClientOptions {
|
|
|
23
23
|
/**
|
|
24
24
|
* Convert XP to level and vice versa.
|
|
25
25
|
*
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
28
|
-
* @link `Documentation:` https://simplyxp.js.org/docs/convert
|
|
26
|
+
* @param {number} value.
|
|
27
|
+
* @param {"xp" | "level"} type - Type to convert from (Default: level).
|
|
28
|
+
* @link `Documentation:` https://simplyxp.js.org/docs/utilities/convert
|
|
29
29
|
* @returns {number} - The converted value. (XP to level or level to XP)
|
|
30
30
|
* @throws {XpFatal} If an invalid type is provided or if the value is not provided.
|
|
31
31
|
*/
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function convertFrom(value: number, type?: "xp" | "level"): number;
|
|
33
33
|
/**
|
|
34
34
|
* Updates the options of the XP client.
|
|
35
35
|
* @param {NewClientOptions} clientOptions - The new options to update.
|
|
36
|
-
* @link `Documentation:` https://simplyxp.js.org/docs/updateOptions
|
|
36
|
+
* @link `Documentation:` https://simplyxp.js.org/docs/utilities/updateOptions
|
|
37
37
|
* @returns {void} - Nothing.
|
|
38
38
|
* @throws {XpFatal} If an invalid option is provided.
|
|
39
39
|
*/
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Convert XP to level and vice versa.
|
|
4
4
|
*
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
7
|
-
* @link `Documentation:` https://simplyxp.js.org/docs/convert
|
|
5
|
+
* @param {number} value.
|
|
6
|
+
* @param {"xp" | "level"} type - Type to convert from (Default: level).
|
|
7
|
+
* @link `Documentation:` https://simplyxp.js.org/docs/utilities/convert
|
|
8
8
|
* @returns {number} - The converted value. (XP to level or level to XP)
|
|
9
9
|
* @throws {XpFatal} If an invalid type is provided or if the value is not provided.
|
|
10
|
-
*/function
|
|
10
|
+
*/function convertFrom(value,type="level"){if(!value)throw new xplogs_1.XpFatal({function:"convertFrom()",message:"Value was not provided"});if("xp"!==type&&"level"!==type)throw new xplogs_1.XpFatal({function:"convert()",message:"Invalid type provided"});if("level"===type)return Math.pow(value/.1,2);if("xp"===type)return Math.floor(.1*Math.sqrt(value));throw new xplogs_1.XpFatal({function:"convertFrom()",message:"Invalid type provided"})}
|
|
11
11
|
/**
|
|
12
12
|
* Updates the options of the XP client.
|
|
13
13
|
* @param {NewClientOptions} clientOptions - The new options to update.
|
|
14
|
-
* @link `Documentation:` https://simplyxp.js.org/docs/updateOptions
|
|
14
|
+
* @link `Documentation:` https://simplyxp.js.org/docs/utilities/updateOptions
|
|
15
15
|
* @returns {void} - Nothing.
|
|
16
16
|
* @throws {XpFatal} If an invalid option is provided.
|
|
17
|
-
*/function updateOptions(clientOptions){if(!clientOptions)throw new xplogs_1.XpFatal({function:"updateOptions()",message:"Options were not provided"});if("object"!=typeof clientOptions)throw new xplogs_1.XpFatal({function:"updateOptions()",message:"Options must be an object"});if(xp_1.xp.auto_create=clientOptions.auto_create,xp_1.xp.auto_purge=clientOptions.auto_purge,xp_1.xp.notify=clientOptions.notify,xp_1.xp.debug=clientOptions.debug,clientOptions.dbOptions&&"object"==typeof clientOptions.dbOptions&&clientOptions.dbOptions.type&&clientOptions.dbOptions.database){var{type:clientOptions,database:t}=clientOptions.dbOptions;if(!(clientOptions&&"mongodb"===clientOptions||"sqlite"===clientOptions))throw new xplogs_1.XpFatal({function:"updateOptions()",message:"Invalid database type provided"});xp_1.xp.dbType=clientOptions,t&&(xp_1.xp.database=t,"mongodb"===xp_1.xp.dbType?(0,connect_1.checkPackageVersion)("mongodb").then(result=>{if(!result)throw new xplogs_1.XpFatal({function:"updateOptions()",message:"MongoDB V4 or higher is required"});xp_1.xp.database.db().command({ping:1}).catch(()=>{throw xp_1.xp.database=void 0,new xplogs_1.XpFatal({function:"updateOptions()",message:"Invalid MongoDB connection"})})}):"sqlite"===xp_1.xp.dbType&&(0,connect_1.checkPackageVersion)("sqlite").then(result=>{if(!result)throw new xplogs_1.XpFatal({function:"updateOptions()",message:"SQLite V7 or higher is required"});try{xp_1.xp.database.prepare("SELECT 1").get()}catch(t){throw new xplogs_1.XpFatal({function:"updateOptions()",message:"Invalid SQLite connection"})}}))}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.updateOptions=exports.
|
|
17
|
+
*/function updateOptions(clientOptions){if(!clientOptions)throw new xplogs_1.XpFatal({function:"updateOptions()",message:"Options were not provided"});if("object"!=typeof clientOptions)throw new xplogs_1.XpFatal({function:"updateOptions()",message:"Options must be an object"});if(xp_1.xp.auto_create=clientOptions.auto_create,xp_1.xp.auto_purge=clientOptions.auto_purge,xp_1.xp.notify=clientOptions.notify,xp_1.xp.debug=clientOptions.debug,clientOptions.dbOptions&&"object"==typeof clientOptions.dbOptions&&clientOptions.dbOptions.type&&clientOptions.dbOptions.database){var{type:clientOptions,database:t}=clientOptions.dbOptions;if(!(clientOptions&&"mongodb"===clientOptions||"sqlite"===clientOptions))throw new xplogs_1.XpFatal({function:"updateOptions()",message:"Invalid database type provided"});xp_1.xp.dbType=clientOptions,t&&(xp_1.xp.database=t,"mongodb"===xp_1.xp.dbType?(0,connect_1.checkPackageVersion)("mongodb").then(result=>{if(!result)throw new xplogs_1.XpFatal({function:"updateOptions()",message:"MongoDB V4 or higher is required"});xp_1.xp.database.db().command({ping:1}).catch(()=>{throw xp_1.xp.database=void 0,new xplogs_1.XpFatal({function:"updateOptions()",message:"Invalid MongoDB connection"})})}):"sqlite"===xp_1.xp.dbType&&(0,connect_1.checkPackageVersion)("sqlite").then(result=>{if(!result)throw new xplogs_1.XpFatal({function:"updateOptions()",message:"SQLite V7 or higher is required"});try{xp_1.xp.database.prepare("SELECT 1").get()}catch(t){throw new xplogs_1.XpFatal({function:"updateOptions()",message:"Invalid SQLite connection"})}}))}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.updateOptions=exports.convertFrom=void 0;const xplogs_1=require("./xplogs"),xp_1=require("../../xp"),connect_1=require("../connect");exports.convertFrom=convertFrom,exports.updateOptions=updateOptions;
|
package/lib/src/set.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ import { UserResult } from "./functions/database";
|
|
|
11
11
|
* @throws {XpFatal} - If parameters are not provided correctly
|
|
12
12
|
*/
|
|
13
13
|
export declare function setLevel(userId: string, guildId: string, level: number, username?: string): Promise<UserResult>;
|
|
14
|
+
/**
|
|
15
|
+
* XP Results
|
|
16
|
+
* @property {boolean} hasLevelledUp - Whether the user has levelled up or not.
|
|
17
|
+
*/
|
|
18
|
+
interface XPResult extends UserResult {
|
|
19
|
+
hasLevelledUp: boolean;
|
|
20
|
+
}
|
|
14
21
|
/**
|
|
15
22
|
* Set user XP
|
|
16
23
|
* @async
|
|
@@ -19,7 +26,8 @@ export declare function setLevel(userId: string, guildId: string, level: number,
|
|
|
19
26
|
* @param {number} xpData
|
|
20
27
|
* @param {string} username - Username to use if auto_create is enabled
|
|
21
28
|
* @link `Documentation:` https://simplyxp.js.org/docs/setxp
|
|
22
|
-
* @returns {Promise<
|
|
29
|
+
* @returns {Promise<XPResult>} - Object of user data on success
|
|
23
30
|
* @throws {XpFatal} - If parameters are not provided correctly
|
|
24
31
|
*/
|
|
25
|
-
export declare function setXP(userId: string, guildId: string, xpData: number, username?: string): Promise<
|
|
32
|
+
export declare function setXP(userId: string, guildId: string, xpData: number, username?: string): Promise<XPResult>;
|
|
33
|
+
export {};
|
package/lib/src/set.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @link `Documentation:` https://simplyxp.js.org/docs/setlevel
|
|
10
10
|
* @returns {Promise<UserResult>} - Object of user data on success
|
|
11
11
|
* @throws {XpFatal} - If parameters are not provided correctly
|
|
12
|
-
*/async function setLevel(userId,guildId,level,username){if(!userId)throw new xplogs_1.XpFatal({function:"setLevel()",message:"User ID was not provided"});if(!guildId)throw new xplogs_1.XpFatal({function:"setLevel()",message:"Guild ID was not provided"});if(!level)throw new xplogs_1.XpFatal({function:"setLevel()",message:"Level was not provided"});if(await database_1.db.findOne({collection:"simply-xps",data:{user:userId,guild:guildId}}))return database_1.db.updateOne({collection:"simply-xps",data:{user:userId,guild:guildId}},{collection:"simply-xps",data:{user:userId,guild:guildId,level:level,xp:(0,utilities_1.
|
|
12
|
+
*/async function setLevel(userId,guildId,level,username){if(!userId)throw new xplogs_1.XpFatal({function:"setLevel()",message:"User ID was not provided"});if(!guildId)throw new xplogs_1.XpFatal({function:"setLevel()",message:"Guild ID was not provided"});if(!level)throw new xplogs_1.XpFatal({function:"setLevel()",message:"Level was not provided"});if(await database_1.db.findOne({collection:"simply-xps",data:{user:userId,guild:guildId}}))return database_1.db.updateOne({collection:"simply-xps",data:{user:userId,guild:guildId}},{collection:"simply-xps",data:{user:userId,guild:guildId,level:level,xp:(0,utilities_1.convertFrom)(level)}});if(xp_1.xp.auto_create&&username)return database_1.db.createOne({collection:"simply-xps",data:{guild:guildId,user:userId,name:username,level:level,xp:(0,utilities_1.convertFrom)(level)}});throw new xplogs_1.XpFatal({function:"setLevel()",message:"User does not exist"})}
|
|
13
13
|
/**
|
|
14
14
|
* Set user XP
|
|
15
15
|
* @async
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
* @param {number} xpData
|
|
19
19
|
* @param {string} username - Username to use if auto_create is enabled
|
|
20
20
|
* @link `Documentation:` https://simplyxp.js.org/docs/setxp
|
|
21
|
-
* @returns {Promise<
|
|
21
|
+
* @returns {Promise<XPResult>} - Object of user data on success
|
|
22
22
|
* @throws {XpFatal} - If parameters are not provided correctly
|
|
23
|
-
*/async function setXP(userId,guildId,xpData,username){if(!userId)throw new xplogs_1.XpFatal({function:"setXP()",message:"User ID was not provided"});if(!guildId)throw new xplogs_1.XpFatal({function:"setXP()",message:"Guild ID was not provided"});if(!xpData)throw new xplogs_1.XpFatal({function:"setXP()",message:"XP was not provided"});
|
|
23
|
+
*/async function setXP(userId,guildId,xpData,username){if(!userId)throw new xplogs_1.XpFatal({function:"setXP()",message:"User ID was not provided"});if(!guildId)throw new xplogs_1.XpFatal({function:"setXP()",message:"Guild ID was not provided"});if(!xpData)throw new xplogs_1.XpFatal({function:"setXP()",message:"XP was not provided"});var e=await database_1.db.findOne({collection:"simply-xps",data:{user:userId,guild:guildId}});let s;if(e)s=await database_1.db.updateOne({collection:"simply-xps",data:{user:userId,guild:guildId}},{collection:"simply-xps",data:{user:userId,guild:guildId,level:(0,utilities_1.convertFrom)(xpData),xp:xpData}});else{if(!xp_1.xp.auto_create||!username)throw new xplogs_1.XpFatal({function:"setXP()",message:"User does not exist"});s=await database_1.db.createOne({collection:"simply-xps",data:{guild:guildId,user:userId,name:username,level:(0,utilities_1.convertFrom)(xpData),xp:xpData}})}return{...s,hasLevelledUp:s.level>e.level}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.setXP=exports.setLevel=void 0;const xplogs_1=require("./functions/xplogs"),utilities_1=require("./functions/utilities"),database_1=require("./functions/database"),xp_1=require("../xp");exports.setLevel=setLevel,exports.setXP=setXP;
|
package/lib/xp.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { addLevel, addXP } from "./src/add";
|
|
|
12
12
|
export { db } from "./src/functions/database";
|
|
13
13
|
export { charts } from "./src/charts";
|
|
14
14
|
export { connect } from "./src/connect";
|
|
15
|
-
export {
|
|
15
|
+
export { convertFrom, updateOptions } from "./src/functions/utilities";
|
|
16
16
|
export { create } from "./src/create";
|
|
17
17
|
export { fetch } from "./src/fetch";
|
|
18
18
|
export { leaderboard } from "./src/leaderboard";
|
package/lib/xp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rank = exports.xp = exports.setXP = exports.setLevel = exports.roleSetup = exports.reset = exports.leaderboardCard = exports.rankCard = exports.migrate = exports.leaderboard = exports.fetch = exports.create = exports.updateOptions = exports.
|
|
3
|
+
exports.rank = exports.xp = exports.setXP = exports.setLevel = exports.roleSetup = exports.reset = exports.leaderboardCard = exports.rankCard = exports.migrate = exports.leaderboard = exports.fetch = exports.create = exports.updateOptions = exports.convertFrom = exports.connect = exports.charts = exports.db = exports.addXP = exports.addLevel = void 0;
|
|
4
4
|
// EXPORTS
|
|
5
5
|
var add_1 = require("./src/add");
|
|
6
6
|
Object.defineProperty(exports, "addLevel", { enumerable: true, get: function () { return add_1.addLevel; } });
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "charts", { enumerable: true, get: function () {
|
|
|
12
12
|
var connect_1 = require("./src/connect");
|
|
13
13
|
Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return connect_1.connect; } });
|
|
14
14
|
var utilities_1 = require("./src/functions/utilities");
|
|
15
|
-
Object.defineProperty(exports, "
|
|
15
|
+
Object.defineProperty(exports, "convertFrom", { enumerable: true, get: function () { return utilities_1.convertFrom; } });
|
|
16
16
|
Object.defineProperty(exports, "updateOptions", { enumerable: true, get: function () { return utilities_1.updateOptions; } });
|
|
17
17
|
var create_1 = require("./src/create");
|
|
18
18
|
Object.defineProperty(exports, "create", { enumerable: true, get: function () { return create_1.create; } });
|
package/package.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "simply-xp",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
4
|
-
"description": "The easiest way to implement xp system",
|
|
5
|
-
"main": "lib/xp.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"beta": "node Tests/clean.mjs && pnpm update && npm publish --tag beta",
|
|
8
|
-
"clean": "node Tests/clean.mjs",
|
|
9
|
-
"dev": "node Tests/clean.mjs && pnpm update && npm publish --tag dev",
|
|
10
|
-
"docs": "node Tests/jsdocs.cjs",
|
|
11
|
-
"latest": "node Tests/clean.mjs && pnpm update && npm publish",
|
|
12
|
-
"test": "node Tests/clean.mjs && node Tests/test.cjs"
|
|
13
|
-
},
|
|
14
|
-
"author": "Abadima",
|
|
15
|
-
"keywords": [
|
|
16
|
-
"amaribot",
|
|
17
|
-
"charts",
|
|
18
|
-
"discord",
|
|
19
|
-
"discord.js",
|
|
20
|
-
"discord-xp",
|
|
21
|
-
"easy",
|
|
22
|
-
"fun",
|
|
23
|
-
"guilded",
|
|
24
|
-
"leaderboard",
|
|
25
|
-
"level role",
|
|
26
|
-
"level up",
|
|
27
|
-
"mee6",
|
|
28
|
-
"mongodb",
|
|
29
|
-
"package",
|
|
30
|
-
"simply",
|
|
31
|
-
"simply-djs",
|
|
32
|
-
"simplydjs",
|
|
33
|
-
"sqlite",
|
|
34
|
-
"system",
|
|
35
|
-
"xp"
|
|
36
|
-
],
|
|
37
|
-
"license": "Apache-2.0",
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "git+https://github.com/Rahuletto/simply-xp.git"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@napi-rs/canvas": "^0.1.41"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@types/better-sqlite3": "^7.6.4",
|
|
47
|
-
"@types/node": "^20.4.8",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
|
49
|
-
"@typescript-eslint/parser": "^6.2.1",
|
|
50
|
-
"better-sqlite3": "8.5.0",
|
|
51
|
-
"discord.js": "^14.12.1",
|
|
52
|
-
"eslint": "^8.46.0",
|
|
53
|
-
"guilded.ts": "^0.20.2",
|
|
54
|
-
"jsdoc-to-markdown": "^8.0.0",
|
|
55
|
-
"mongodb": "5.7.0",
|
|
56
|
-
"typescript": "^5.1.6",
|
|
57
|
-
"uglify-js": "^3.17.4"
|
|
58
|
-
},
|
|
59
|
-
"engines": {
|
|
60
|
-
"node": ">=15.5.0"
|
|
61
|
-
},
|
|
62
|
-
"bugs": {
|
|
63
|
-
"url": "https://github.com/Rahuletto/simply-xp/issues"
|
|
64
|
-
},
|
|
65
|
-
"homepage": "https://simplyxp.js.org",
|
|
66
|
-
"directories": {
|
|
67
|
-
"doc": "Mini_Docs",
|
|
68
|
-
"lib": "lib"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "simply-xp",
|
|
3
|
+
"version": "2.0.0-dev.2",
|
|
4
|
+
"description": "The easiest way to implement xp system",
|
|
5
|
+
"main": "lib/xp.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"beta": "node Tests/clean.mjs && pnpm update && npm publish --tag beta",
|
|
8
|
+
"clean": "node Tests/clean.mjs",
|
|
9
|
+
"dev": "node Tests/clean.mjs && pnpm update && npm publish --tag dev",
|
|
10
|
+
"docs": "node Tests/jsdocs.cjs",
|
|
11
|
+
"latest": "node Tests/clean.mjs && pnpm update && npm publish",
|
|
12
|
+
"test": "node Tests/clean.mjs && node Tests/test.cjs"
|
|
13
|
+
},
|
|
14
|
+
"author": "Abadima",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"amaribot",
|
|
17
|
+
"charts",
|
|
18
|
+
"discord",
|
|
19
|
+
"discord.js",
|
|
20
|
+
"discord-xp",
|
|
21
|
+
"easy",
|
|
22
|
+
"fun",
|
|
23
|
+
"guilded",
|
|
24
|
+
"leaderboard",
|
|
25
|
+
"level role",
|
|
26
|
+
"level up",
|
|
27
|
+
"mee6",
|
|
28
|
+
"mongodb",
|
|
29
|
+
"package",
|
|
30
|
+
"simply",
|
|
31
|
+
"simply-djs",
|
|
32
|
+
"simplydjs",
|
|
33
|
+
"sqlite",
|
|
34
|
+
"system",
|
|
35
|
+
"xp"
|
|
36
|
+
],
|
|
37
|
+
"license": "Apache-2.0",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/Rahuletto/simply-xp.git"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@napi-rs/canvas": "^0.1.41"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/better-sqlite3": "^7.6.4",
|
|
47
|
+
"@types/node": "^20.4.8",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
|
49
|
+
"@typescript-eslint/parser": "^6.2.1",
|
|
50
|
+
"better-sqlite3": "8.5.0",
|
|
51
|
+
"discord.js": "^14.12.1",
|
|
52
|
+
"eslint": "^8.46.0",
|
|
53
|
+
"guilded.ts": "^0.20.2",
|
|
54
|
+
"jsdoc-to-markdown": "^8.0.0",
|
|
55
|
+
"mongodb": "5.7.0",
|
|
56
|
+
"typescript": "^5.1.6",
|
|
57
|
+
"uglify-js": "^3.17.4"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=15.5.0"
|
|
61
|
+
},
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/Rahuletto/simply-xp/issues"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://simplyxp.js.org",
|
|
66
|
+
"directories": {
|
|
67
|
+
"doc": "Mini_Docs",
|
|
68
|
+
"lib": "lib"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
Binary file
|