simply-xp 1.3.3 → 1.3.5-beta-1
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 +7 -8
- package/package.json +49 -54
- package/simplyxp.js +31 -31
- package/src/addLevel.js +70 -70
- package/src/addXP.js +111 -111
- package/src/charts.js +89 -88
- package/src/leaderboard.js +69 -69
- package/src/lvlRole.js +53 -53
- package/src/rank.js +296 -296
- package/src/reset.js +22 -22
- package/src/roleSetup.js +121 -121
- package/src/setLevel.js +70 -70
- package/.prettierrc.json +0 -8
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<h2 style="font-size:2.5rem;" align="center">Simply-XP</h2>
|
|
4
4
|
|
|
5
|
-
<h2 align="center">A Simple, Easy and Beginner friendly XP System. <br>
|
|
5
|
+
<h2 align="center">A Simple, Easy and Beginner friendly XP System. <br>Supports Discord.JS<br><br>Developed by Rahuletto#0243 & Maintained by Abadima#6356</h2>
|
|
6
6
|
|
|
7
7
|
<br>
|
|
8
8
|
<p align="center">
|
|
@@ -28,13 +28,12 @@ yarn add simply-xp
|
|
|
28
28
|
|
|
29
29
|
<br>
|
|
30
30
|
|
|
31
|
-
# 🎉
|
|
31
|
+
# 🎉 Recent Updates 🎉
|
|
32
|
+
|
|
33
|
+
- Fixed Various Bugs
|
|
34
|
+
- Updated `Chart.js`
|
|
35
|
+
- D.JS v14 Support
|
|
32
36
|
|
|
33
|
-
- We have patched various issues
|
|
34
|
-
- Switched to the true **Chart.js** package!
|
|
35
|
-
- You no longer require to use D.JS for this package, alternatives can work!
|
|
36
|
-
- We have also updated our website guide! We hope you find it useful 😊
|
|
37
|
-
- Updated Various Packages to work universally with DJS V14 & More!
|
|
38
37
|
|
|
39
38
|
# But Why ?
|
|
40
39
|
|
|
@@ -55,4 +54,4 @@ yarn add simply-xp
|
|
|
55
54
|
<h1>👥 Contact us | Support</h1>
|
|
56
55
|
<p>
|
|
57
56
|
<a href="https://discord.gg/3JzDV9T5Fn"><img src="https://invidget.switchblade.xyz/3JzDV9T5Fn" /></a>
|
|
58
|
-
</p>
|
|
57
|
+
</p>
|
package/package.json
CHANGED
|
@@ -1,54 +1,49 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "simply-xp",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "A Simple, Easy and Beginner Friendly XP System",
|
|
5
|
-
"main": "simplyxp.js",
|
|
6
|
-
"typings": "index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"discord",
|
|
20
|
-
"discord
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
"peerDependencies": {
|
|
52
|
-
"discord.js": "*"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "simply-xp",
|
|
3
|
+
"version": "1.3.5-beta-1",
|
|
4
|
+
"description": "A Simple, Easy and Beginner Friendly XP System",
|
|
5
|
+
"main": "simplyxp.js",
|
|
6
|
+
"typings": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"author": "Rahuletto",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"xp",
|
|
13
|
+
"simply",
|
|
14
|
+
"easy",
|
|
15
|
+
"xp-system",
|
|
16
|
+
"system",
|
|
17
|
+
"mongoose",
|
|
18
|
+
"discord",
|
|
19
|
+
"discord xp",
|
|
20
|
+
"discord-xp",
|
|
21
|
+
"simply-djs",
|
|
22
|
+
"discord.js",
|
|
23
|
+
"simplydjs",
|
|
24
|
+
"weky",
|
|
25
|
+
"nuggies",
|
|
26
|
+
"experience",
|
|
27
|
+
"level role",
|
|
28
|
+
"amari",
|
|
29
|
+
"package",
|
|
30
|
+
"leaderboard",
|
|
31
|
+
"mee6",
|
|
32
|
+
"charts",
|
|
33
|
+
"ChartJS",
|
|
34
|
+
"level up"
|
|
35
|
+
],
|
|
36
|
+
"license": "Apache-2.0",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/Rahuletto/simply-xp"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@napi-rs/canvas": "^0.1.30",
|
|
43
|
+
"chart.js": "^3.9.1",
|
|
44
|
+
"mongoose": "^6.6.5"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"discord.js": ">=13.12.0"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/simplyxp.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
try {
|
|
2
|
-
require('discord.js')
|
|
3
|
-
} catch (e) {
|
|
4
|
-
console.warn('[XP] Discord.js is recommended for this package.')
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
module.exports.roleSetup = require('./src/roleSetup')
|
|
8
|
-
|
|
9
|
-
module.exports.addLevel = require('./src/addLevel')
|
|
10
|
-
|
|
11
|
-
module.exports.addXP = require('./src/addXP')
|
|
12
|
-
|
|
13
|
-
module.exports.charts = require('./src/charts')
|
|
14
|
-
|
|
15
|
-
module.exports.connect = require('./src/connect')
|
|
16
|
-
|
|
17
|
-
module.exports.create = require('./src/create')
|
|
18
|
-
|
|
19
|
-
module.exports.fetch = require('./src/fetch')
|
|
20
|
-
|
|
21
|
-
module.exports.leaderboard = require('./src/leaderboard')
|
|
22
|
-
|
|
23
|
-
module.exports.lvlRole = require('./src/lvlRole')
|
|
24
|
-
|
|
25
|
-
module.exports.rank = require('./src/rank')
|
|
26
|
-
|
|
27
|
-
module.exports.setLevel = require('./src/setLevel')
|
|
28
|
-
|
|
29
|
-
module.exports.setXP = require('./src/setXP')
|
|
30
|
-
|
|
31
|
-
module.exports.reset = require('./src/reset')
|
|
1
|
+
try {
|
|
2
|
+
require('discord.js')
|
|
3
|
+
} catch (e) {
|
|
4
|
+
console.warn('[XP] Discord.js is recommended for this package.')
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module.exports.roleSetup = require('./src/roleSetup')
|
|
8
|
+
|
|
9
|
+
module.exports.addLevel = require('./src/addLevel')
|
|
10
|
+
|
|
11
|
+
module.exports.addXP = require('./src/addXP')
|
|
12
|
+
|
|
13
|
+
module.exports.charts = require('./src/charts')
|
|
14
|
+
|
|
15
|
+
module.exports.connect = require('./src/connect')
|
|
16
|
+
|
|
17
|
+
module.exports.create = require('./src/create')
|
|
18
|
+
|
|
19
|
+
module.exports.fetch = require('./src/fetch')
|
|
20
|
+
|
|
21
|
+
module.exports.leaderboard = require('./src/leaderboard')
|
|
22
|
+
|
|
23
|
+
module.exports.lvlRole = require('./src/lvlRole')
|
|
24
|
+
|
|
25
|
+
module.exports.rank = require('./src/rank')
|
|
26
|
+
|
|
27
|
+
module.exports.setLevel = require('./src/setLevel')
|
|
28
|
+
|
|
29
|
+
module.exports.setXP = require('./src/setXP')
|
|
30
|
+
|
|
31
|
+
module.exports.reset = require('./src/reset')
|
package/src/addLevel.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
const levels = require('../src/models/level.js')
|
|
2
|
-
let { roleSetup } = require('../simplyxp')
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {Discord.Message} message
|
|
6
|
-
* @param {string} userID
|
|
7
|
-
* @param {string} guildID
|
|
8
|
-
* @param {number} level
|
|
9
|
-
*/
|
|
10
|
-
async function addLevel(message, userID, guildID, level) {
|
|
11
|
-
if (!userID) throw new Error('[XP] User ID was not provided.')
|
|
12
|
-
|
|
13
|
-
if (!guildID) throw new Error('[XP] Guild ID was not provided.')
|
|
14
|
-
|
|
15
|
-
if (!level) throw new Error('[XP] Level amount is not provided.')
|
|
16
|
-
|
|
17
|
-
let { client } = message
|
|
18
|
-
|
|
19
|
-
const user = await levels.findOne({ user: userID, guild: guildID })
|
|
20
|
-
|
|
21
|
-
if (!user) {
|
|
22
|
-
const newUser = new levels({
|
|
23
|
-
user: userID,
|
|
24
|
-
guild: guildID,
|
|
25
|
-
xp: 0,
|
|
26
|
-
level: 0
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
await newUser
|
|
30
|
-
.save()
|
|
31
|
-
.catch((e) => console.log(`[XP] Failed to save new user to database`))
|
|
32
|
-
|
|
33
|
-
let xp = (level * 10) ** 2
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
level: level,
|
|
37
|
-
exp: xp
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
let level1 = user.level
|
|
41
|
-
|
|
42
|
-
user.level +=
|
|
43
|
-
user.xp = (user.level * 10) ** 2
|
|
44
|
-
|
|
45
|
-
await user
|
|
46
|
-
.save()
|
|
47
|
-
.catch((e) =>
|
|
48
|
-
console.log(`[XP] Failed to add Level | User: ${userID} | Err: ${e}`)
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
if (level1 !== level) {
|
|
52
|
-
let data = {
|
|
53
|
-
xp: user.xp,
|
|
54
|
-
level: user.level,
|
|
55
|
-
userID,
|
|
56
|
-
guildID
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let role = await roleSetup.find(client, guildID, level)
|
|
60
|
-
|
|
61
|
-
client.emit('levelUp', message, data, role)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
level: user.level,
|
|
66
|
-
xp: user.xp
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
module.exports = addLevel
|
|
1
|
+
const levels = require('../src/models/level.js')
|
|
2
|
+
let { roleSetup } = require('../simplyxp')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {Discord.Message} message
|
|
6
|
+
* @param {string} userID
|
|
7
|
+
* @param {string} guildID
|
|
8
|
+
* @param {number} level
|
|
9
|
+
*/
|
|
10
|
+
async function addLevel(message, userID, guildID, level) {
|
|
11
|
+
if (!userID) throw new Error('[XP] User ID was not provided.')
|
|
12
|
+
|
|
13
|
+
if (!guildID) throw new Error('[XP] Guild ID was not provided.')
|
|
14
|
+
|
|
15
|
+
if (!level) throw new Error('[XP] Level amount is not provided.')
|
|
16
|
+
|
|
17
|
+
let { client } = message
|
|
18
|
+
|
|
19
|
+
const user = await levels.findOne({ user: userID, guild: guildID })
|
|
20
|
+
|
|
21
|
+
if (!user) {
|
|
22
|
+
const newUser = new levels({
|
|
23
|
+
user: userID,
|
|
24
|
+
guild: guildID,
|
|
25
|
+
xp: 0,
|
|
26
|
+
level: 0
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
await newUser
|
|
30
|
+
.save()
|
|
31
|
+
.catch((e) => console.log(`[XP] Failed to save new user to database`))
|
|
32
|
+
|
|
33
|
+
let xp = (level * 10) ** 2
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
level: level,
|
|
37
|
+
exp: xp
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
let level1 = user.level
|
|
41
|
+
|
|
42
|
+
user.level += parseFloat(level)
|
|
43
|
+
user.xp = (user.level * 10) ** 2
|
|
44
|
+
|
|
45
|
+
await user
|
|
46
|
+
.save()
|
|
47
|
+
.catch((e) =>
|
|
48
|
+
console.log(`[XP] Failed to add Level | User: ${userID} | Err: ${e}`)
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
if (level1 !== level) {
|
|
52
|
+
let data = {
|
|
53
|
+
xp: user.xp,
|
|
54
|
+
level: user.level,
|
|
55
|
+
userID,
|
|
56
|
+
guildID
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let role = await roleSetup.find(client, guildID, level)
|
|
60
|
+
|
|
61
|
+
client.emit('levelUp', message, data, role)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
level: user.level,
|
|
66
|
+
xp: user.xp
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = addLevel
|
package/src/addXP.js
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
const levels = require('../src/models/level.js')
|
|
2
|
-
let { roleSetup } = require('../simplyxp')
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {Discord.Message} message
|
|
6
|
-
* @param {string} userID
|
|
7
|
-
* @param {string} guildID
|
|
8
|
-
* @param {number} xp
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
async function addXP(message, userID, guildID, xp) {
|
|
12
|
-
if (!userID) throw new Error('[XP] User ID was not provided.')
|
|
13
|
-
|
|
14
|
-
if (!guildID) throw new Error('[XP] Guild ID was not provided.')
|
|
15
|
-
|
|
16
|
-
if (!xp) throw new Error('[XP] XP amount is not provided.')
|
|
17
|
-
|
|
18
|
-
let { client } = message
|
|
19
|
-
|
|
20
|
-
let min
|
|
21
|
-
let max
|
|
22
|
-
if (xp.min) {
|
|
23
|
-
if (!xp.max)
|
|
24
|
-
throw new Error(
|
|
25
|
-
'[XP] XP min amount is provided but max amount is not provided.'
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
min = Number(xp.min)
|
|
29
|
-
|
|
30
|
-
if (Number(xp.min).toString() === 'NaN')
|
|
31
|
-
throw new Error('[XP] XP amount (min) is not a number.')
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (xp.max) {
|
|
35
|
-
if (!xp.min)
|
|
36
|
-
throw new Error(
|
|
37
|
-
'[XP] XP max amount is provided but min amount is not provided.'
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
max = Number(xp.max)
|
|
41
|
-
|
|
42
|
-
if (Number(xp.max).toString() === 'NaN')
|
|
43
|
-
throw new Error('[XP] XP amount (max) is not a number.')
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (xp.min && xp.max) {
|
|
47
|
-
let randomNumber = Math.floor(Math.random() * (max - min) + min)
|
|
48
|
-
|
|
49
|
-
xp = randomNumber
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const user = await levels.findOne({ user: userID, guild: guildID })
|
|
53
|
-
|
|
54
|
-
let lvl = Math.floor(0.1 * Math.sqrt(xp))
|
|
55
|
-
|
|
56
|
-
if (!user) {
|
|
57
|
-
const newUser = new levels({
|
|
58
|
-
user: userID,
|
|
59
|
-
guild: guildID,
|
|
60
|
-
xp: xp,
|
|
61
|
-
level: lvl
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
await newUser
|
|
65
|
-
.save()
|
|
66
|
-
.catch((e) => console.log(`[XP] Failed to save new user to database`))
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
level: 0,
|
|
70
|
-
exp: 0
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
let level1 = user.level
|
|
74
|
-
|
|
75
|
-
user.xp += parseInt(xp, 10)
|
|
76
|
-
user.level = Math.floor(0.1 * Math.sqrt(user.xp))
|
|
77
|
-
|
|
78
|
-
await user
|
|
79
|
-
.save()
|
|
80
|
-
.catch((e) =>
|
|
81
|
-
console.log(`[XP] Failed to add XP | User: ${userID} | Err: ${e}`)
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
let level = user.level
|
|
85
|
-
|
|
86
|
-
xp = user.xp
|
|
87
|
-
|
|
88
|
-
if (user.xp === 0 || Math.sign(user.xp) === -1) {
|
|
89
|
-
xp = 0
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (level1 !== level) {
|
|
93
|
-
let data = {
|
|
94
|
-
xp,
|
|
95
|
-
level,
|
|
96
|
-
userID,
|
|
97
|
-
guildID
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
let role = await roleSetup.find(client, guildID, level)
|
|
101
|
-
|
|
102
|
-
client.emit('levelUp', message, data, role)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
level,
|
|
107
|
-
xp
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
module.exports = addXP
|
|
1
|
+
const levels = require('../src/models/level.js')
|
|
2
|
+
let { roleSetup } = require('../simplyxp')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {Discord.Message} message
|
|
6
|
+
* @param {string} userID
|
|
7
|
+
* @param {string} guildID
|
|
8
|
+
* @param {number} xp
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
async function addXP(message, userID, guildID, xp) {
|
|
12
|
+
if (!userID) throw new Error('[XP] User ID was not provided.')
|
|
13
|
+
|
|
14
|
+
if (!guildID) throw new Error('[XP] Guild ID was not provided.')
|
|
15
|
+
|
|
16
|
+
if (!xp) throw new Error('[XP] XP amount is not provided.')
|
|
17
|
+
|
|
18
|
+
let { client } = message
|
|
19
|
+
|
|
20
|
+
let min
|
|
21
|
+
let max
|
|
22
|
+
if (xp.min) {
|
|
23
|
+
if (!xp.max)
|
|
24
|
+
throw new Error(
|
|
25
|
+
'[XP] XP min amount is provided but max amount is not provided.'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
min = Number(xp.min)
|
|
29
|
+
|
|
30
|
+
if (Number(xp.min).toString() === 'NaN')
|
|
31
|
+
throw new Error('[XP] XP amount (min) is not a number.')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (xp.max) {
|
|
35
|
+
if (!xp.min)
|
|
36
|
+
throw new Error(
|
|
37
|
+
'[XP] XP max amount is provided but min amount is not provided.'
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
max = Number(xp.max)
|
|
41
|
+
|
|
42
|
+
if (Number(xp.max).toString() === 'NaN')
|
|
43
|
+
throw new Error('[XP] XP amount (max) is not a number.')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (xp.min && xp.max) {
|
|
47
|
+
let randomNumber = Math.floor(Math.random() * (max - min) + min)
|
|
48
|
+
|
|
49
|
+
xp = randomNumber
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const user = await levels.findOne({ user: userID, guild: guildID })
|
|
53
|
+
|
|
54
|
+
let lvl = Math.floor(0.1 * Math.sqrt(xp))
|
|
55
|
+
|
|
56
|
+
if (!user) {
|
|
57
|
+
const newUser = new levels({
|
|
58
|
+
user: userID,
|
|
59
|
+
guild: guildID,
|
|
60
|
+
xp: xp,
|
|
61
|
+
level: lvl
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
await newUser
|
|
65
|
+
.save()
|
|
66
|
+
.catch((e) => console.log(`[XP] Failed to save new user to database`))
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
level: 0,
|
|
70
|
+
exp: 0
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
let level1 = user.level
|
|
74
|
+
|
|
75
|
+
user.xp += parseInt(xp, 10)
|
|
76
|
+
user.level = Math.floor(0.1 * Math.sqrt(user.xp))
|
|
77
|
+
|
|
78
|
+
await user
|
|
79
|
+
.save()
|
|
80
|
+
.catch((e) =>
|
|
81
|
+
console.log(`[XP] Failed to add XP | User: ${userID} | Err: ${e}`)
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
let level = user.level
|
|
85
|
+
|
|
86
|
+
xp = user.xp
|
|
87
|
+
|
|
88
|
+
if (user.xp === 0 || Math.sign(user.xp) === -1) {
|
|
89
|
+
xp = 0
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (level1 !== level) {
|
|
93
|
+
let data = {
|
|
94
|
+
xp,
|
|
95
|
+
level,
|
|
96
|
+
userID,
|
|
97
|
+
guildID
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
let role = await roleSetup.find(client, guildID, level)
|
|
101
|
+
|
|
102
|
+
client.emit('levelUp', message, data, role)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
level,
|
|
107
|
+
xp
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = addXP
|