simply-xp 2.0.0-dev.4 → 2.0.0-dev.5-fix.0

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.
@@ -41,24 +41,24 @@ export interface UserResult {
41
41
  * @property {string} collection - The collection to create the document in.
42
42
  * @property {object} data - The data to create the document with.
43
43
  * @property {string} data.guild - The guild ID.
44
- * @property {number} [data.level] - The level to assign the role at.
45
- * @property {string | Array<string>} [data.roles] - The role(s) to assign.
46
- * @property {string} data.timestamp - The timestamp of when the document was created.
44
+ * @property {object} data.lvlrole - The level role data.
45
+ * @property {number} data.lvlrole.lvl - The level.
46
+ * @property {string | Array<string>} [data.lvlrole.role] - The role ID(s).
47
47
  */
48
48
  export interface LevelRoleOptions {
49
49
  collection: "simply-xp-levelroles";
50
50
  data: {
51
51
  guild: string;
52
- level: number;
53
- roles?: string | Array<string>;
54
- timestamp: string;
52
+ lvlrole: {
53
+ lvl: number;
54
+ role?: string | Array<string>;
55
+ };
55
56
  };
56
57
  }
57
58
  export type LevelRoleResult = {
58
59
  _id?: string;
59
60
  guild: string;
60
- level: number;
61
- roles: Array<string>;
61
+ lvlrole: string;
62
62
  timestamp: string;
63
63
  };
64
64
  /**
@@ -69,7 +69,7 @@ export declare class db {
69
69
  /**
70
70
  * Gets a collection from the database.
71
71
  * @param {collection} collection - The collection to get.
72
- * @link https://simplyxp.js.org/docs/handlers/database#getCollection Documentation
72
+ * @link https://simplyxp.js.org/docs/next/handlers/database#getCollection Documentation
73
73
  * @returns {Collection} The collection.
74
74
  * @throws {XpFatal} Throws an error if there is no database connection, or database type is invalid.
75
75
  */
@@ -79,17 +79,26 @@ export declare class db {
79
79
  *
80
80
  * @async
81
81
  * @param {UserOptions | LevelRoleOptions} query - The document to create.
82
- * @link https://simplyxp.js.org/docs/handlers/database#createOne Documentation
82
+ * @link https://simplyxp.js.org/docs/next/handlers/database#createOne Documentation
83
83
  * @returns {Promise<UserResult | LevelRoleResult>} The created document.
84
84
  * @throws {XpFatal} Throws an error if there is no database connection.
85
85
  */
86
86
  static createOne(query: UserOptions | LevelRoleOptions): Promise<UserResult | LevelRoleResult>;
87
+ /**
88
+ * Deletes multiple documents from the database.
89
+ * @async
90
+ * @param {UserOptions | LevelRoleOptions} query - The documents to delete.
91
+ * @link https://simplyxp.js.org/docs/next/handlers/database#deleteMany Documentation
92
+ * @returns {Promise<boolean>} `true` if the documents were successfully deleted, otherwise `false`.
93
+ * @throws {XpFatal} Throws an error if there is no database connection.
94
+ */
95
+ static deleteMany(query: UserOptions | LevelRoleOptions): Promise<boolean>;
87
96
  /**
88
97
  * Deletes one document from the database.
89
98
  *
90
99
  * @async
91
100
  * @param {UserOptions | LevelRoleOptions} query - The document to delete.
92
- * @link https://simplyxp.js.org/docs/handlers/database#deleteOne Documentation
101
+ * @link https://simplyxp.js.org/docs/next/handlers/database#deleteOne Documentation
93
102
  * @returns {Promise<boolean>} `true` if the document was successfully deleted, otherwise `false`.
94
103
  * @throws {XpFatal} Throws an error if there is no database connection.
95
104
  */
@@ -99,7 +108,7 @@ export declare class db {
99
108
  *
100
109
  * @async
101
110
  * @param {UserOptions | LevelRoleOptions} query - The query to search for the document.
102
- * @link https://simplyxp.js.org/docs/handlers/database#findOne Documentation
111
+ * @link https://simplyxp.js.org/docs/next/handlers/database#findOne Documentation
103
112
  * @returns {Promise<UserResult | LevelRoleResult>} The found document.
104
113
  * @throws {XpFatal} Throws an error if there is no database connection.
105
114
  */
@@ -109,7 +118,7 @@ export declare class db {
109
118
  *
110
119
  * @async
111
120
  * @param {UserOptions | LevelRoleOptions} query - The query to search for multiple documents.
112
- * @link https://simplyxp.js.org/docs/handlers/database#find Documentation
121
+ * @link https://simplyxp.js.org/docs/next/handlers/database#find Documentation
113
122
  * @returns {Promise<UserResult[] | LevelRoleResult[]>} An array of found documents.
114
123
  * @throws {XpFatal} Throws an error if there is no database connection.
115
124
  */
@@ -121,7 +130,7 @@ export declare class db {
121
130
  * @param {UserOptions | LevelRoleOptions} filter - The document to update.
122
131
  * @param {UserOptions | LevelRoleOptions} update - The document update data.
123
132
  * @param {object} [options] - MongoDB options for updating the document.
124
- * @link https://simplyxp.js.org/docs/handlers/database#updateOne Documentation
133
+ * @link https://simplyxp.js.org/docs/next/handlers/database#updateOne Documentation
125
134
  * @returns {Promise<UserResult | LevelRoleResult>} The updated document.
126
135
  * @throws {XpFatal} Throws an error if there is no database connection.
127
136
  */
@@ -9,7 +9,7 @@
9
9
  /**
10
10
  * Gets a collection from the database.
11
11
  * @param {collection} collection - The collection to get.
12
- * @link https://simplyxp.js.org/docs/handlers/database#getCollection Documentation
12
+ * @link https://simplyxp.js.org/docs/next/handlers/database#getCollection Documentation
13
13
  * @returns {Collection} The collection.
14
14
  * @throws {XpFatal} Throws an error if there is no database connection, or database type is invalid.
15
15
  */
@@ -19,37 +19,45 @@ static getCollection(collection){if(!xp_1.xp.database)throw new xplogs_1.XpFatal
19
19
  *
20
20
  * @async
21
21
  * @param {UserOptions | LevelRoleOptions} query - The document to create.
22
- * @link https://simplyxp.js.org/docs/handlers/database#createOne Documentation
22
+ * @link https://simplyxp.js.org/docs/next/handlers/database#createOne Documentation
23
23
  * @returns {Promise<UserResult | LevelRoleResult>} The created document.
24
24
  * @throws {XpFatal} Throws an error if there is no database connection.
25
- */static async createOne(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"createOne()",message:"No database connection"});let e;switch(xp_1.xp.dbType){case"mongodb":xp_1.xp.database.db().collection(query.collection).insertOne(query.data).catch(error=>handleError(error,"createOne()")),e=db.findOne(query);break;case"sqlite":e="simply-xps"===query.collection?xp_1.xp.database.prepare('INSERT INTO "simply-xps" (user, guild, name, xp, level) VALUES (?, ?, ?, ?, ?)').run(query.data.user,query.data.guild,query.data?.name,query.data.xp,query.data.level):xp_1.xp.database.prepare('INSERT INTO "simply-xp-levelroles" (guild, level, role) VALUES (?, ?, ?)').run(query.data.guild,query.data.level,query.data.roles)}return e}
25
+ */static async createOne(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"createOne()",message:"No database connection"});switch(xp_1.xp.dbType){case"mongodb":xp_1.xp.database.db().collection(query.collection).insertOne(query.data).catch(error=>handleError(error,"createOne()"));break;case"sqlite":"simply-xps"===query.collection?xp_1.xp.database.prepare('INSERT INTO "simply-xps" (user, guild, name, xp, level) VALUES (?, ?, ?, ?, ?)').run(query.data.user,query.data.guild,query.data?.name,query.data.xp,query.data.level):xp_1.xp.database.prepare('INSERT INTO "simply-xp-levelroles" (gid, lvlrole, timestamp) VALUES (?, ?, ?)').run(query.data.guild,JSON.stringify(query.data.lvlrole),(new Date).toISOString())}return db.findOne(query)}
26
+ /**
27
+ * Deletes multiple documents from the database.
28
+ * @async
29
+ * @param {UserOptions | LevelRoleOptions} query - The documents to delete.
30
+ * @link https://simplyxp.js.org/docs/next/handlers/database#deleteMany Documentation
31
+ * @returns {Promise<boolean>} `true` if the documents were successfully deleted, otherwise `false`.
32
+ * @throws {XpFatal} Throws an error if there is no database connection.
33
+ */static async deleteMany(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"deleteMany()",message:"No database connection"});let e;switch(xp_1.xp.dbType){case"mongodb":e=xp_1.xp.database.db().collection(query.collection).deleteMany(query.data).catch(error=>handleError(error,"deleteMany()"));break;case"sqlite":e=("simply-xps"===query.collection?xp_1.xp.database.prepare('DELETE FROM "simply-xps" WHERE guild = ?'):xp_1.xp.database.prepare('DELETE FROM "simply-xp-levelroles" WHERE gid = ?')).run(query.data.guild)}return!!e}
26
34
  /**
27
35
  * Deletes one document from the database.
28
36
  *
29
37
  * @async
30
38
  * @param {UserOptions | LevelRoleOptions} query - The document to delete.
31
- * @link https://simplyxp.js.org/docs/handlers/database#deleteOne Documentation
39
+ * @link https://simplyxp.js.org/docs/next/handlers/database#deleteOne Documentation
32
40
  * @returns {Promise<boolean>} `true` if the document was successfully deleted, otherwise `false`.
33
41
  * @throws {XpFatal} Throws an error if there is no database connection.
34
- */static async deleteOne(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"deleteOne()",message:"No database connection"});let e;switch(xp_1.xp.dbType){case"mongodb":e=xp_1.xp.database.db().collection(query.collection).deleteOne(query.data).catch(error=>handleError(error,"deleteOne()"));break;case"sqlite":e="simply-xps"===query.collection?xp_1.xp.database.prepare('DELETE FROM "simply-xps" WHERE guild = ? AND user = ?').run(query.data.guild,query.data.user):xp_1.xp.database.prepare('DELETE FROM "simply-xp-levelroles" WHERE guild = ? AND level = ?').run(query.data.guild,query.data.level)}return!!e}
42
+ */static async deleteOne(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"deleteOne()",message:"No database connection"});let e;switch(xp_1.xp.dbType){case"mongodb":e=xp_1.xp.database.db().collection(query.collection).deleteOne(query.data).catch(error=>handleError(error,"deleteOne()"));break;case"sqlite":e="simply-xps"===query.collection?xp_1.xp.database.prepare('DELETE FROM "simply-xps" WHERE guild = ? AND user = ?').run(query.data.guild,query.data.user):(e=(e=await this.find(query)).filter(row=>JSON.parse(row.lvlrole).lvl===query.data.lvlrole.lvl)[0],xp_1.xp.database.prepare('DELETE FROM "simply-xp-levelroles" WHERE gid = ? AND lvlrole = ?').run(query.data.guild,e.lvlrole))}return!!e}
35
43
  /**
36
44
  * Finds one document in the database.
37
45
  *
38
46
  * @async
39
47
  * @param {UserOptions | LevelRoleOptions} query - The query to search for the document.
40
- * @link https://simplyxp.js.org/docs/handlers/database#findOne Documentation
48
+ * @link https://simplyxp.js.org/docs/next/handlers/database#findOne Documentation
41
49
  * @returns {Promise<UserResult | LevelRoleResult>} The found document.
42
50
  * @throws {XpFatal} Throws an error if there is no database connection.
43
- */static async findOne(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"findOne()",message:"No database connection"});let e;switch(xp_1.xp.dbType){case"mongodb":e=xp_1.xp.database.db().collection(query.collection).findOne(query.data).catch(error=>handleError(error,"findOne()"));break;case"sqlite":e="simply-xps"===query.collection?xp_1.xp.database.prepare('SELECT * FROM "simply-xps" WHERE guild = ? AND user = ?').get(query.data.guild,query.data.user):xp_1.xp.database.prepare('SELECT * FROM "simply-xp-levelroles" WHERE guild = ? AND level = ?').get(query.data.guild,query.data.level)}return e}
51
+ */static async findOne(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"findOne()",message:"No database connection"});let e;switch(xp_1.xp.dbType){case"mongodb":e="simply-xps"===query.collection?await xp_1.xp.database.db().collection(query.collection).findOne(query.data).catch(error=>handleError(error,"findOne()")):await xp_1.xp.database.db().collection(query.collection).findOne({guild:query.data.guild,"lvlrole.lvl":query.data.lvlrole.lvl}).catch(error=>handleError(error,"findOne()"));break;case"sqlite":e="simply-xps"===query.collection?xp_1.xp.database.prepare('SELECT * FROM "simply-xps" WHERE guild = ? AND user = ?').get(query.data.guild,query.data.user):(e=await this.find(query)).filter(row=>JSON.parse(row.lvlrole).lvl===query.data.lvlrole.lvl)[0]}return e}
44
52
  /**
45
53
  * Finds multiple documents in the database.
46
54
  *
47
55
  * @async
48
56
  * @param {UserOptions | LevelRoleOptions} query - The query to search for multiple documents.
49
- * @link https://simplyxp.js.org/docs/handlers/database#find Documentation
57
+ * @link https://simplyxp.js.org/docs/next/handlers/database#find Documentation
50
58
  * @returns {Promise<UserResult[] | LevelRoleResult[]>} An array of found documents.
51
59
  * @throws {XpFatal} Throws an error if there is no database connection.
52
- */static async find(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"find()",message:"No database connection"});let e;switch(xp_1.xp.dbType){case"mongodb":e=xp_1.xp.database.db().collection(query.collection).find(query.data).toArray().catch(error=>handleError(error,"find()"));break;case"sqlite":e=("simply-xps"===query.collection?xp_1.xp.database.prepare('SELECT * FROM "simply-xps" WHERE guild = ?'):xp_1.xp.database.prepare('SELECT * FROM "simply-xp-levelroles" WHERE guild = ?')).all(query.data.guild)}return e}
60
+ */static async find(query){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"find()",message:"No database connection"});let e;switch(xp_1.xp.dbType){case"mongodb":e=xp_1.xp.database.db().collection(query.collection).find(query.data).toArray().catch(error=>handleError(error,"find()"));break;case"sqlite":e=("simply-xps"===query.collection?xp_1.xp.database.prepare('SELECT * FROM "simply-xps" WHERE guild = ?'):xp_1.xp.database.prepare('SELECT * FROM "simply-xp-levelroles" WHERE gid = ?')).all(query.data.guild)}return e}
53
61
  /**
54
62
  * Updates one document in the database.
55
63
  *
@@ -57,7 +65,7 @@ static getCollection(collection){if(!xp_1.xp.database)throw new xplogs_1.XpFatal
57
65
  * @param {UserOptions | LevelRoleOptions} filter - The document to update.
58
66
  * @param {UserOptions | LevelRoleOptions} update - The document update data.
59
67
  * @param {object} [options] - MongoDB options for updating the document.
60
- * @link https://simplyxp.js.org/docs/handlers/database#updateOne Documentation
68
+ * @link https://simplyxp.js.org/docs/next/handlers/database#updateOne Documentation
61
69
  * @returns {Promise<UserResult | LevelRoleResult>} The updated document.
62
70
  * @throws {XpFatal} Throws an error if there is no database connection.
63
- */static async updateOne(filter,update,options){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"updateOne()",message:"No database connection"});switch(xp_1.xp.dbType){case"mongodb":await xp_1.xp.database.db().collection(update.collection).updateOne(filter.data,{$set:update.data},options).catch(error=>handleError(error,"updateOne()"));break;case"sqlite":if("simply-xps"===filter.collection&&"simply-xps"===update.collection)xp_1.xp.database.prepare('UPDATE "simply-xps" SET name = ?, xp = ?, level = ? WHERE guild = ? AND user = ?').run(update.data?.name,update.data.xp,update.data.level,filter.data.guild,filter.data.user);else{if("simply-xp-levelroles"!==filter.collection||"simply-xp-levelroles"!==update.collection)throw new xplogs_1.XpFatal({function:"updateOne()",message:"Collection mismatch, expected same collection on both filter and update."});xp_1.xp.database.prepare('UPDATE "simply-xp-levelroles" SET role = ? WHERE guild = ? AND level = ?').run(update.data.roles,filter.data.guild,filter.data.level)}}return db.findOne(update)}}exports.db=db;
71
+ */static async updateOne(filter,update,options){if(!xp_1.xp.database)throw new xplogs_1.XpFatal({function:"updateOne()",message:"No database connection"});switch(xp_1.xp.dbType){case"mongodb":await xp_1.xp.database.db().collection(update.collection).updateOne(filter.data,{$set:update.data},options).catch(error=>handleError(error,"updateOne()"));break;case"sqlite":if("simply-xps"===filter.collection&&"simply-xps"===update.collection)xp_1.xp.database.prepare('UPDATE "simply-xps" SET xp = ?, level = ?'+(update.data?.name?", name = ?":"")+" WHERE guild = ? AND user = ?").run(update.data?.name?[update.data.xp,update.data.level,update.data.name,filter.data.guild,filter.data.user]:[update.data.xp,update.data.level,filter.data.guild,filter.data.user]);else{if("simply-xp-levelroles"!==filter.collection||"simply-xp-levelroles"!==update.collection)throw new xplogs_1.XpFatal({function:"updateOne()",message:"Collection mismatch, expected same collection on both filter and update."});xp_1.xp.database.prepare('UPDATE "simply-xp-levelroles" SET lvlrole = ? WHERE gid = ?').run(JSON.stringify(update.data.lvlrole),filter.data.guild)}}return db.findOne(update)}}exports.db=db;
@@ -25,7 +25,7 @@ interface NewClientOptions {
25
25
  *
26
26
  * @param {number} value.
27
27
  * @param {"xp" | "level"} type - Type to convert from (Default: level).
28
- * @link `Documentation:` https://simplyxp.js.org/docs/utilities/convert
28
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/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
  */
@@ -33,7 +33,7 @@ export declare function convertFrom(value: number, type?: "xp" | "level"): numbe
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/utilities/updateOptions
36
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/utilities/updateOptions
37
37
  * @returns {void} - Nothing.
38
38
  * @throws {XpFatal} If an invalid option is provided.
39
39
  */
@@ -4,14 +4,14 @@
4
4
  *
5
5
  * @param {number} value.
6
6
  * @param {"xp" | "level"} type - Type to convert from (Default: level).
7
- * @link `Documentation:` https://simplyxp.js.org/docs/utilities/convert
7
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/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
10
  */function convertFrom(value,type="level"){if(isNaN(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/utilities/updateOptions
14
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/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.convertFrom=void 0;const xplogs_1=require("./xplogs"),xp_1=require("../../xp"),connect_1=require("../connect");exports.convertFrom=convertFrom,exports.updateOptions=updateOptions;
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"});if(xp_1.xp.dbType=clientOptions,t){xp_1.xp.database=t;const e="mongodb"===xp_1.xp.dbType?{name:"MongoDB",type:"mongodb",min:4,max:6}:{name:"Better-SQLite3",type:"better-sqlite3",min:7,max:9};(0,connect_1.checkPackageVersion)(e.type,e.min,e.max).then(result=>{if(!result)throw new xplogs_1.XpFatal({function:"updateOptions()",message:`${e.name} V${e.min} up to V${e.max} is required.`});switch(xp_1.xp.dbType){case"mongodb":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"})});break;case"sqlite":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;
@@ -20,7 +20,7 @@ export interface User {
20
20
  * @async
21
21
  * @param {string} guildId - Guild ID
22
22
  * @param {number} limit - Limit of users to return
23
- * @link `Documentation:` https://simplyxp.js.org/docs/leaderboard
23
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/functions/leaderboard
24
24
  * @returns {Promise<User[]>} Array of all users in the leaderboard
25
25
  * @throws {XpFatal} If guild ID is not provided or limit is less than 1
26
26
  */
@@ -4,7 +4,7 @@
4
4
  * @async
5
5
  * @param {string} guildId - Guild ID
6
6
  * @param {number} limit - Limit of users to return
7
- * @link `Documentation:` https://simplyxp.js.org/docs/leaderboard
7
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/functions/leaderboard
8
8
  * @returns {Promise<User[]>} Array of all users in the leaderboard
9
9
  * @throws {XpFatal} If guild ID is not provided or limit is less than 1
10
- */async function leaderboard(guildId,limit){if(!guildId)throw new xplogs_1.XpFatal({function:"leaderboard()",message:"Guild ID was not provided"});if(limit&&limit<1)throw new xplogs_1.XpFatal({function:"leaderboard()",message:"Limit must be greater than 0"});return(guildId=(await database_1.db.find({collection:"simply-xps",data:{guild:guildId}})).sort((a,b)=>b.xp-a.xp)).forEach((user,index)=>user.position=index+1),limit?guildId.slice(0,limit):guildId}Object.defineProperty(exports,"__esModule",{value:!0}),exports.leaderboard=void 0;const xplogs_1=require("./functions/xplogs"),database_1=require("./functions/database");exports.leaderboard=leaderboard;
10
+ */async function leaderboard(guildId,limit){if(!guildId)throw new xplogs_1.XpFatal({function:"leaderboard()",message:"Guild ID was not provided"});if(!limit||1<=limit)return guildId=(await database_1.db.find({collection:"simply-xps",data:{guild:guildId}})).sort((a,b)=>b.xp-a.xp),await Promise.all(guildId.map(async(user,index)=>(user.position=index+1,user))),guildId.slice(0,limit);throw new xplogs_1.XpFatal({function:"leaderboard()",message:"Limit must be a number greater than 0"})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.leaderboard=void 0;const xplogs_1=require("./functions/xplogs"),database_1=require("./functions/database");exports.leaderboard=leaderboard;
@@ -9,7 +9,7 @@ export declare class migrate {
9
9
  * Effortlessly migrate from discord-xp to simply-xp.
10
10
  * @async
11
11
  * @param {boolean} deleteOld - Delete old data after migration
12
- * @link `Documentation:` https://simplyxp.js.org/docs/migrate/discord_xp
12
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/migrate#migratediscord_xp
13
13
  * @returns {Promise<boolean>} - Returns true if migration is successful
14
14
  * @throws {XpLog.err} - If migration fails.
15
15
  */
@@ -19,7 +19,7 @@ export declare class migrate {
19
19
  * @async
20
20
  * @param {"mongodb"|"sqlite"} dbType
21
21
  * @param {Database | MongoClient} connection
22
- * @link `Documentation:` https://simplyxp.js.org/docs/migrate/database
22
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/migrate#migratefromdb
23
23
  * @returns {Promise<boolean>} - Returns true if migration is successful
24
24
  * @throws {XpFatal} - If parameters are not provided correctly
25
25
  */
@@ -3,17 +3,17 @@
3
3
  * Effortlessly migrate from discord-xp to simply-xp.
4
4
  * @async
5
5
  * @param {boolean} deleteOld - Delete old data after migration
6
- * @link `Documentation:` https://simplyxp.js.org/docs/migrate/discord_xp
6
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/migrate#migratediscord_xp
7
7
  * @returns {Promise<boolean>} - Returns true if migration is successful
8
8
  * @throws {XpLog.err} - If migration fails.
9
9
  */
10
- static async discord_xp(deleteOld=!1){var e=await database_1.db.getCollection("levels").find().toArray();xplogs_1.XpLog.debug("migrate.discord_xp()",`FOUND ${e.length} DOCUMENTS`);try{for(const r of e)await database_1.db.findOne({collection:"simply-xps",data:{guild:r.guildID,user:r.userID}})||(await database_1.db.createOne({collection:"simply-xps",data:{guild:r.guildID,user:r.userID,xp:r.xp,level:(0,xp_1.convertFrom)(r.xp,"xp")}}),deleteOld&&await database_1.db.getCollection("levels").deleteOne({userID:r.userID,guildID:r.guildID}));return!0}catch(e){return xplogs_1.XpLog.err("migrate.discord_xp()",e),!1}}
10
+ static async discord_xp(deleteOld=!1){var e=await database_1.db.getCollection("levels").find().toArray();xplogs_1.XpLog.debug("migrate.discord_xp()",`FOUND ${e.length} DOCUMENTS`);try{for(const a of e)await database_1.db.findOne({collection:"simply-xps",data:{guild:a.guildID,user:a.userID}})||(await database_1.db.createOne({collection:"simply-xps",data:{guild:a.guildID,user:a.userID,xp:a.xp,level:(0,xp_1.convertFrom)(a.xp,"xp")}}),deleteOld&&await database_1.db.getCollection("levels").deleteOne({userID:a.userID,guildID:a.guildID}));return!0}catch(e){return xplogs_1.XpLog.err("migrate.discord_xp()",e),!1}}
11
11
  /**
12
12
  * Effortlessly migrate from MongoDB to SQLite. (or vice versa)
13
13
  * @async
14
14
  * @param {"mongodb"|"sqlite"} dbType
15
15
  * @param {Database | MongoClient} connection
16
- * @link `Documentation:` https://simplyxp.js.org/docs/migrate/database
16
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/migrate#migratefromdb
17
17
  * @returns {Promise<boolean>} - Returns true if migration is successful
18
18
  * @throws {XpFatal} - If parameters are not provided correctly
19
- */static async fromDB(dbType,connection){if(!dbType)throw new xplogs_1.XpFatal({function:"migrate.database()",message:"No database type provided"});if(!connection)throw new xplogs_1.XpFatal({function:"migrate.database()",message:"No database connection provided"});if(xp_1.xp.dbType===dbType)return xplogs_1.XpLog.info("migrate.fromDB()","Same database received, that was unnecessary!");let e;switch(dbType){case"mongodb":try{if(!await(0,connect_1.checkPackageVersion)("mongodb"))return xplogs_1.XpLog.err("migrate.fromDB()","MongoDB V4 or higher is required");e=connection.db().collection("simply-xps").find().toArray(),xplogs_1.XpLog.debug("migrate.fromDB()",`FOUND ${e.length} DOCUMENTS`)}catch(e){return xplogs_1.XpLog.err("migrate.fromDB()",e),!1}break;case"sqlite":try{if(!await(0,connect_1.checkPackageVersion)("sqlite"))return xplogs_1.XpLog.err("migrate.fromDB()","better-sqlite3 V7 or higher is required");e=connection.prepare("SELECT * FROM `simply-xps`").all(),xplogs_1.XpLog.debug("migrate.fromDB()",`FOUND ${e.length} ROWS`)}catch(e){return xplogs_1.XpLog.err("migrate.fromDB()",e),!1}}return await Promise.all(e.map(async user=>await database_1.db.findOne({collection:"simply-xps",data:{guild:user.guild,user:user.user}})?database_1.db.updateOne({collection:"simply-xps",data:{guild:user.guild,user:user.user}},{collection:"simply-xps",data:{guild:user.guild,user:user.user,name:user.name,xp:user.xp,level:user.level}}):database_1.db.createOne({collection:"simply-xps",data:{guild:user.guild,user:user.user,xp:user.xp,level:user.level}}))),!0}}exports.migrate=migrate;
19
+ */static async fromDB(dbType,connection){if(!dbType)throw new xplogs_1.XpFatal({function:"migrate.database()",message:"No database type provided"});if(!connection)throw new xplogs_1.XpFatal({function:"migrate.database()",message:"No database connection provided"});if(xp_1.xp.dbType===dbType)return xplogs_1.XpLog.info("migrate.fromDB()","Same database received, that was unnecessary!");let e;switch(dbType){case"mongodb":try{if(!await(0,connect_1.checkPackageVersion)("mongodb",4,6))return xplogs_1.XpLog.err("migrate.fromDB()","MongoDB V4 up to V6 is required");e=await connection.db().collection("simply-xps").find().toArray()}catch(e){return xplogs_1.XpLog.err("migrate.fromDB()",e),!1}break;case"sqlite":try{if(!await(0,connect_1.checkPackageVersion)("better-sqlite3",7,8))return xplogs_1.XpLog.err("migrate.fromDB()","better-sqlite3 V7 up to V8 is required");e=connection.prepare("SELECT * FROM `simply-xps`").all()}catch(e){return xplogs_1.XpLog.err("migrate.fromDB()",e),!1}}return xplogs_1.XpLog.debug("migrate.fromDB()",`FOUND ${e.length} RESULTS`),await Promise.all(e.map(async user=>await database_1.db.findOne({collection:"simply-xps",data:{guild:user.guild,user:user.user}})?database_1.db.updateOne({collection:"simply-xps",data:{guild:user.guild,user:user.user}},{collection:"simply-xps",data:{guild:user.guild,user:user.user,name:user.name,xp:user.xp,level:user.level}}):database_1.db.createOne({collection:"simply-xps",data:{guild:user.guild,user:user.user,xp:user.xp,level:user.level}}))),!0}}exports.migrate=migrate;
@@ -5,7 +5,7 @@
5
5
  * @param {string} guildId
6
6
  * @param {boolean?} erase - Erase user entry from the database
7
7
  * @param {string?} username - Username to use if auto_create is enabled
8
- * @link `Documentation:` https://simplyxp.js.org/docs/reset
8
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/functions/reset
9
9
  * @returns {Promise<boolean>}
10
10
  * @throws {XpFatal} If an invalid type is provided or if the value is not provided.
11
11
  */
package/lib/src/reset.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * @param {string} guildId
7
7
  * @param {boolean?} erase - Erase user entry from the database
8
8
  * @param {string?} username - Username to use if auto_create is enabled
9
- * @link `Documentation:` https://simplyxp.js.org/docs/reset
9
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/functions/reset
10
10
  * @returns {Promise<boolean>}
11
11
  * @throws {XpFatal} If an invalid type is provided or if the value is not provided.
12
12
  */async function reset(userId,guildId,erase=!1,username){var e;if(userId&&guildId)return e={guild:guildId,user:userId},await database_1.db.findOne({collection:"simply-xps",data:e})?(erase?await database_1.db.deleteOne({collection:"simply-xps",data:e}).catch(error=>{throw new xplogs_1.XpFatal({function:"reset()",message:error})}):await database_1.db.updateOne({collection:"simply-xps",data:{user:userId,guild:guildId}},{collection:"simply-xps",data:{...e,level:0,xp:0}}).catch(error=>{throw new xplogs_1.XpFatal({function:"reset()",message:error})}),!0):xp_1.xp.auto_create&&!erase&&username?(await database_1.db.createOne({collection:"simply-xps",data:e}).catch(error=>{throw new xplogs_1.XpFatal({function:"reset()",message:error.stack})}),!0):xplogs_1.XpLog.info("reset()","User was not found, we did not know what to do without a username.");throw new xplogs_1.XpFatal({function:"reset()",message:"Invalid parameters provided"})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.reset=void 0;const xplogs_1=require("./functions/xplogs"),xp_1=require("../xp"),database_1=require("./functions/database");exports.reset=reset;
@@ -1,3 +1,4 @@
1
+ import { LevelRoleResult } from "./functions/database";
1
2
  /**
2
3
  * Role setup object
3
4
  * @property {string} guild - The guild ID
@@ -5,9 +6,8 @@
5
6
  * @property {string[] | string} roles - The role(s) to add
6
7
  */
7
8
  export interface RoleSetupObject {
8
- guild?: string;
9
9
  level: number;
10
- roles: string[] | string;
10
+ role: string[] | string;
11
11
  }
12
12
  /**
13
13
  * Setup roles for levels
@@ -19,7 +19,7 @@ export declare class roleSetup {
19
19
  * @async
20
20
  * @param {string} guildId - The guild ID
21
21
  * @param {RoleSetupObject} options - Level/role options
22
- * @link `Documentation:` https://simplyxp.js.org/docs/roleSetup/add
22
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/roleSetup#roleSetupadd
23
23
  * @returns {Promise<boolean>} - True if successful
24
24
  * @throws {XpFatal} If an invalid type is provided or value is not provided.
25
25
  */
@@ -29,17 +29,17 @@ export declare class roleSetup {
29
29
  * @async
30
30
  * @param {string} guildId - The guild ID
31
31
  * @param {number} levelNumber - The level number
32
- * @link `Documentation:` https://simplyxp.js.org/docs/roleSetup/find
33
- * @returns {Promise<RoleSetupObject>} - The level role object
32
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/roleSetup#roleSetupfind
33
+ * @returns {Promise<LevelRoleResult>} - The level role object
34
34
  * @throws {XpFatal} If an invalid type is provided or value is not provided.
35
35
  */
36
- static find(guildId: string, levelNumber: number): Promise<RoleSetupObject>;
36
+ static find(guildId: string, levelNumber: number): Promise<LevelRoleResult>;
37
37
  /**
38
38
  * Remove a level from the role setup
39
39
  * @async
40
40
  * @param {string} guildId - The guild ID
41
41
  * @param {number} levelNumber - The level number
42
- * @link `Documentation:` https://simplyxp.js.org/docs/roleSetup/remove
42
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/roleSetup#roleSetupremove
43
43
  * @returns {Promise<boolean>} - True if successful
44
44
  * @throws {XpFatal} If an invalid type is provided or value is not provided.
45
45
  */
@@ -4,26 +4,26 @@
4
4
  * @async
5
5
  * @param {string} guildId - The guild ID
6
6
  * @param {RoleSetupObject} options - Level/role options
7
- * @link `Documentation:` https://simplyxp.js.org/docs/roleSetup/add
7
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/roleSetup#roleSetupadd
8
8
  * @returns {Promise<boolean>} - True if successful
9
9
  * @throws {XpFatal} If an invalid type is provided or value is not provided.
10
10
  */
11
- static async add(guildId,options){if(!guildId)throw new xplogs_1.XpFatal({function:"roleSetup.add()",message:"Guild ID was not provided"});if(!options)throw new xplogs_1.XpFatal({function:"roleSetup.add()",message:"Options were not provided"});if(isNaN(options?.level))throw new xplogs_1.XpFatal({function:"roleSetup.add()",message:"Level must be a number"});if(options?.roles)return"string"==typeof options?.roles&&(options.roles=[options.roles]),xp_1.db.createOne({collection:"simply-xp-levelroles",data:{guild:guildId,level:options.level,roles:options.roles,timestamp:(new Date).toISOString()}});throw new xplogs_1.XpFatal({function:"roleSetup.add()",message:"Role was not provided"})}
11
+ static async add(guildId,options){if(!guildId)throw new xplogs_1.XpFatal({function:"roleSetup.add()",message:"Guild ID was not provided"});if(!options)throw new xplogs_1.XpFatal({function:"roleSetup.add()",message:"Options were not provided"});if(isNaN(options?.level))throw new xplogs_1.XpFatal({function:"roleSetup.add()",message:"Level must be a number"});if(options?.role)return"string"==typeof options?.role&&(options.role=[options.role]),xp_1.db.createOne({collection:"simply-xp-levelroles",data:{guild:guildId,lvlrole:{lvl:options.level,role:options.role}}}).then(()=>!0).catch(()=>!1);throw new xplogs_1.XpFatal({function:"roleSetup.add()",message:"Role was not provided"})}
12
12
  /**
13
13
  * Find a role in roleSetup
14
14
  * @async
15
15
  * @param {string} guildId - The guild ID
16
16
  * @param {number} levelNumber - The level number
17
- * @link `Documentation:` https://simplyxp.js.org/docs/roleSetup/find
18
- * @returns {Promise<RoleSetupObject>} - The level role object
17
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/roleSetup#roleSetupfind
18
+ * @returns {Promise<LevelRoleResult>} - The level role object
19
19
  * @throws {XpFatal} If an invalid type is provided or value is not provided.
20
- */static async find(guildId,levelNumber){if(!guildId)throw new xplogs_1.XpFatal({function:"roleSetup.find()",message:"Guild ID was not provided"});if(isNaN(levelNumber))throw new xplogs_1.XpFatal({function:"roleSetup.find()",message:"Level Number was not provided"});return xp_1.db.findOne({collection:"simply-xp-levelroles",data:{guild:guildId,level:levelNumber,timestamp:(new Date).toISOString()}})}
20
+ */static async find(guildId,levelNumber){if(!guildId)throw new xplogs_1.XpFatal({function:"roleSetup.find()",message:"Guild ID was not provided"});if(isNaN(levelNumber))throw new xplogs_1.XpFatal({function:"roleSetup.find()",message:"Level Number was not provided"});return(guildId=await xp_1.db.findOne({collection:"simply-xp-levelroles",data:{guild:guildId,lvlrole:{lvl:levelNumber}}}))&&(guildId.lvlrole="string"==typeof guildId.lvlrole?JSON.parse(guildId.lvlrole):guildId.lvlrole,guildId)}
21
21
  /**
22
22
  * Remove a level from the role setup
23
23
  * @async
24
24
  * @param {string} guildId - The guild ID
25
25
  * @param {number} levelNumber - The level number
26
- * @link `Documentation:` https://simplyxp.js.org/docs/roleSetup/remove
26
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/classes/roleSetup#roleSetupremove
27
27
  * @returns {Promise<boolean>} - True if successful
28
28
  * @throws {XpFatal} If an invalid type is provided or value is not provided.
29
- */static async remove(guildId,levelNumber){if(!guildId)throw new xplogs_1.XpFatal({function:"roleSetup.remove()",message:"Guild ID was not provided"});if(isNaN(levelNumber))throw new xplogs_1.XpFatal({function:"roleSetup.remove()",message:"Level Number was not provided"});return xp_1.db.deleteOne({collection:"simply-xp-levelroles",data:{guild:guildId,level:levelNumber,timestamp:(new Date).toISOString()}})}}exports.roleSetup=roleSetup;
29
+ */static async remove(guildId,levelNumber){if(!guildId)throw new xplogs_1.XpFatal({function:"roleSetup.remove()",message:"Guild ID was not provided"});if(isNaN(levelNumber))throw new xplogs_1.XpFatal({function:"roleSetup.remove()",message:"Level Number was not provided"});return xp_1.db.deleteOne({collection:"simply-xp-levelroles",data:{guild:guildId,lvlrole:{lvl:levelNumber}}})}}exports.roleSetup=roleSetup;
package/lib/src/set.d.ts CHANGED
@@ -6,7 +6,7 @@ import { UserResult } from "./functions/database";
6
6
  * @param {string} guildId
7
7
  * @param {number} level
8
8
  * @param {string} username - Username to use if auto_create is enabled
9
- * @link `Documentation:` https://simplyxp.js.org/docs/setlevel
9
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/functions/setlevel
10
10
  * @returns {Promise<UserResult>} - Object of user data on success
11
11
  * @throws {XpFatal} - If parameters are not provided correctly
12
12
  */
@@ -25,7 +25,7 @@ interface XPResult extends UserResult {
25
25
  * @param {string} guildId
26
26
  * @param {number} xpData
27
27
  * @param {string} username - Username to use if auto_create is enabled
28
- * @link `Documentation:` https://simplyxp.js.org/docs/setxp
28
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/functions/setxp
29
29
  * @returns {Promise<XPResult>} - Object of user data on success
30
30
  * @throws {XpFatal} - If parameters are not provided correctly
31
31
  */
package/lib/src/set.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * @param {string} guildId
7
7
  * @param {number} level
8
8
  * @param {string} username - Username to use if auto_create is enabled
9
- * @link `Documentation:` https://simplyxp.js.org/docs/setlevel
9
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/functions/setlevel
10
10
  * @returns {Promise<UserResult>} - Object of user data on success
11
11
  * @throws {XpFatal} - If parameters are not provided correctly
12
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(isNaN(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"})}
@@ -17,7 +17,7 @@
17
17
  * @param {string} guildId
18
18
  * @param {number} xpData
19
19
  * @param {string} username - Username to use if auto_create is enabled
20
- * @link `Documentation:` https://simplyxp.js.org/docs/setxp
20
+ * @link `Documentation:` https://simplyxp.js.org/docs/next/functions/setxp
21
21
  * @returns {Promise<XPResult>} - Object of user data on success
22
22
  * @throws {XpFatal} - If parameters are not provided correctly
23
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(isNaN(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
@@ -11,13 +11,13 @@ export interface XPClient {
11
11
  export { addLevel, addXP } from "./src/add";
12
12
  export { db } from "./src/functions/database";
13
13
  export { charts } from "./src/charts";
14
+ export { compareCard, leaderboardCard, rankCard } from "./src/cards";
14
15
  export { connect } from "./src/connect";
15
16
  export { convertFrom, updateOptions } from "./src/functions/utilities";
16
17
  export { create } from "./src/create";
17
18
  export { fetch } from "./src/fetch";
18
19
  export { leaderboard } from "./src/leaderboard";
19
20
  export { migrate } from "./src/migrate";
20
- export { rankCard, leaderboardCard } from "./src/cards";
21
21
  export { reset } from "./src/reset";
22
22
  export { roleSetup } from "./src/roleSetup";
23
23
  export { setLevel, setXP } from "./src/set";
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.convertFrom = exports.connect = exports.charts = exports.db = exports.addXP = exports.addLevel = void 0;
3
+ exports.rank = exports.xp = exports.setXP = exports.setLevel = exports.roleSetup = exports.reset = exports.migrate = exports.leaderboard = exports.fetch = exports.create = exports.updateOptions = exports.convertFrom = exports.connect = exports.rankCard = exports.leaderboardCard = exports.compareCard = 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; } });
@@ -9,6 +9,10 @@ var database_1 = require("./src/functions/database");
9
9
  Object.defineProperty(exports, "db", { enumerable: true, get: function () { return database_1.db; } });
10
10
  var charts_1 = require("./src/charts");
11
11
  Object.defineProperty(exports, "charts", { enumerable: true, get: function () { return charts_1.charts; } });
12
+ var cards_1 = require("./src/cards");
13
+ Object.defineProperty(exports, "compareCard", { enumerable: true, get: function () { return cards_1.compareCard; } });
14
+ Object.defineProperty(exports, "leaderboardCard", { enumerable: true, get: function () { return cards_1.leaderboardCard; } });
15
+ Object.defineProperty(exports, "rankCard", { enumerable: true, get: function () { return cards_1.rankCard; } });
12
16
  var connect_1 = require("./src/connect");
13
17
  Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return connect_1.connect; } });
14
18
  var utilities_1 = require("./src/functions/utilities");
@@ -22,9 +26,6 @@ var leaderboard_1 = require("./src/leaderboard");
22
26
  Object.defineProperty(exports, "leaderboard", { enumerable: true, get: function () { return leaderboard_1.leaderboard; } });
23
27
  var migrate_1 = require("./src/migrate");
24
28
  Object.defineProperty(exports, "migrate", { enumerable: true, get: function () { return migrate_1.migrate; } });
25
- var cards_1 = require("./src/cards");
26
- Object.defineProperty(exports, "rankCard", { enumerable: true, get: function () { return cards_1.rankCard; } });
27
- Object.defineProperty(exports, "leaderboardCard", { enumerable: true, get: function () { return cards_1.leaderboardCard; } });
28
29
  var reset_1 = require("./src/reset");
29
30
  Object.defineProperty(exports, "reset", { enumerable: true, get: function () { return reset_1.reset; } });
30
31
  var roleSetup_1 = require("./src/roleSetup");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simply-xp",
3
- "version": "2.0.0-dev.4",
3
+ "version": "2.0.0-dev.5-fix.0",
4
4
  "description": "The easiest way to implement xp system",
5
5
  "main": "lib/xp.js",
6
6
  "scripts": {
@@ -14,7 +14,10 @@
14
14
  "author": "Abadima",
15
15
  "keywords": [
16
16
  "amaribot",
17
+ "canvacord",
17
18
  "charts",
19
+ "compare",
20
+ "compete",
18
21
  "discord",
19
22
  "discord.js",
20
23
  "discord-xp",
@@ -22,14 +25,15 @@
22
25
  "fun",
23
26
  "guilded",
24
27
  "leaderboard",
25
- "level role",
26
- "level up",
28
+ "level",
29
+ "leveling",
27
30
  "mee6",
28
31
  "mongodb",
29
32
  "package",
30
33
  "simply",
31
34
  "simply-djs",
32
35
  "simplydjs",
36
+ "slack",
33
37
  "sqlite",
34
38
  "system",
35
39
  "xp"
@@ -37,33 +41,32 @@
37
41
  "license": "Apache-2.0",
38
42
  "repository": {
39
43
  "type": "git",
40
- "url": "git+https://github.com/Rahuletto/simply-xp.git"
44
+ "url": "git+https://github.com/Abadima/simply-xp.git"
41
45
  },
42
46
  "dependencies": {
43
47
  "@napi-rs/canvas": "^0.1.44"
44
48
  },
45
49
  "devDependencies": {
46
- "@types/better-sqlite3": "^7.6.4",
47
- "@types/node": "^20.5.4",
48
- "@typescript-eslint/eslint-plugin": "^6.4.1",
49
- "@typescript-eslint/parser": "^6.4.1",
50
- "better-sqlite3": "8.5.1",
50
+ "@types/better-sqlite3": "^7.6.6",
51
+ "@types/node": "^20.8.10",
52
+ "@typescript-eslint/eslint-plugin": "^6.9.1",
53
+ "@typescript-eslint/parser": "^6.9.1",
54
+ "better-sqlite3": "^9.0.0",
51
55
  "discord.js": "^14.13.0",
52
- "eslint": "^8.47.0",
56
+ "eslint": "^8.53.0",
53
57
  "jsdoc-to-markdown": "^8.0.0",
54
- "mongodb": "^5.8.1",
55
- "typescript": "^5.1.6",
58
+ "mongodb": "^6.2.0",
59
+ "typescript": "^5.2.2",
56
60
  "uglify-js": "^3.17.4"
57
61
  },
58
62
  "engines": {
59
63
  "node": ">=15.5.0"
60
64
  },
61
65
  "bugs": {
62
- "url": "https://github.com/Rahuletto/simply-xp/issues"
66
+ "url": "https://github.com/Abadima/simply-xp/issues"
63
67
  },
64
68
  "homepage": "https://simplyxp.js.org",
65
69
  "directories": {
66
- "doc": "Mini_Docs",
67
70
  "lib": "lib"
68
71
  }
69
72
  }