simply-xp 1.1.6 → 1.2.0-test-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.
@@ -1,31 +1,31 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: 'bug'
6
- assignees: ''
7
- ---
8
-
9
- **Describe the bug**
10
- A clear and concise description of what the bug is.
11
-
12
- **To Reproduce**
13
- Steps to reproduce the behavior:
14
-
15
- 1. Run the bot
16
- 2. Try the function
17
- 3. See error
18
-
19
- **Expected behavior**
20
- A clear and concise description of what you expected to happen.
21
-
22
- **Screenshots**
23
- If applicable, add screenshots to help explain your problem.
24
-
25
- **Versions (please complete the following information):**
26
-
27
- - Discord.js Version [e.g. v13]
28
- - simply-xp Version [e.g. v2.0.0]
29
-
30
- **Additional context**
31
- Add any other context about the problem here.
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: 'bug'
6
+ assignees: ''
7
+ ---
8
+
9
+ **Describe the bug**
10
+ A clear and concise description of what the bug is.
11
+
12
+ **To Reproduce**
13
+ Steps to reproduce the behavior:
14
+
15
+ 1. Run the bot
16
+ 2. Try the function
17
+ 3. See error
18
+
19
+ **Expected behavior**
20
+ A clear and concise description of what you expected to happen.
21
+
22
+ **Screenshots**
23
+ If applicable, add screenshots to help explain your problem.
24
+
25
+ **Versions (please complete the following information):**
26
+
27
+ - Discord.js Version [e.g. v13]
28
+ - simply-xp Version [e.g. v2.0.0]
29
+
30
+ **Additional context**
31
+ Add any other context about the problem here.
package/.prettierrc.json CHANGED
@@ -1,8 +1,8 @@
1
- {
2
- "trailingComma": "none",
3
- "tabWidth": 2,
4
- "semi": false,
5
- "singleQuote": true,
6
- "useTabs": false,
7
- "bracketSpacing": true
8
- }
1
+ {
2
+ "trailingComma": "none",
3
+ "tabWidth": 2,
4
+ "semi": false,
5
+ "singleQuote": true,
6
+ "useTabs": false,
7
+ "bracketSpacing": true
8
+ }
package/README.md CHANGED
@@ -1,9 +1,8 @@
1
- <p align="center"><img align="center" style="width: 128px" src="https://user-images.githubusercontent.com/71836991/173240203-ca92976f-2e5e-4a85-ba5e-155796eac889.png"></p>
1
+ <p align="center"><img align="center" style="margin-bottom:-6px" src="https://i.imgur.com/BiaHJA7.png?maxwidth=128&fidelity=grand"></p>
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>Uses Discord.js v13<br><br>Developed by Rahuletto#0243</h2>
6
-
5
+ <h2 align="center">A Simple, Easy and Beginner friendly XP System. <br>Uses Discord.js v13<br><br>Developed by Rahuletto#0243 & Maintained by Abadima#6356</h2>
7
6
 
8
7
  <br>
9
8
  <p align="center">
@@ -29,33 +28,20 @@ yarn add simply-xp
29
28
 
30
29
  <br>
31
30
 
32
- # 👋 Goodbye XP 👋
33
-
34
-
35
- > We are deprecating, Because making an XP system is already easy. And working on a package which not much people uses is an time waste. We are not deleting the package whatsoever !
36
-
37
- # 👋 Last Update log
38
-
39
- - Fixed bugs
40
- - New `addLevel(), setLevel(), reset()`
41
- - roleSetup redefined.. Redid whole system.
42
- - New everything.. Everything is now tidy and compact.
43
- - levelUp event returns role id too !
44
- - Re-coded to squeeze bugs
45
- - Bug Fixes
31
+ # 🎉 What's New 🎉
46
32
 
47
- # ~~But Why ?~~
48
- ## We do not recommend using this package as you can encounter bugs.
33
+ - We have patched known issues, and we continue to monitor changes!
34
+ - Our rank card has a new font applied
49
35
 
50
- - ~~Easiest XP System in Discord.js~~
51
- - ~~Fastest Support ever~~
52
- - ~~Rank Card Maker~~
53
- - ~~Beginner Friendly~~
54
- - ~~Easier than other XP Systems~~
55
- - ~~Inbuilt Auto Roles system~~
56
- - ~~Flexible and simple at the same time~~
36
+ # But Why ?
57
37
 
58
- `Reconstructed discord-xp to give you things simpler ;)`
38
+ - Easiest XP System in Discord.js
39
+ - Fastest Support ever
40
+ - Rank Card Maker
41
+ - Beginner Friendly
42
+ - Easier than other XP Systems
43
+ - Inbuilt Auto Roles system
44
+ - Flexible and simple at the same time
59
45
 
60
46
  <br>
61
47
 
package/index.d.ts CHANGED
@@ -1,107 +1,107 @@
1
- import { Message, Client } from 'discord.js'
2
-
3
- type HexColorString = `#${string}` | string
4
-
5
- export type connectOptions = {
6
- notify?: boolean
7
- }
8
-
9
- export declare function connect(
10
- db: string,
11
- options?: connectOptions
12
- ): Promise<any>
13
-
14
- export declare function addLevel(
15
- message: Message,
16
- userID: string,
17
- guildID: string,
18
- level: number
19
- ): Promise<any>
20
-
21
- export declare function addXP(
22
- message: Message,
23
- userID: string,
24
- guildID: string,
25
- xp: number
26
- ): Promise<any>
27
-
28
- export type chartsOptions = {
29
- position?: string
30
- background?: HexColorString
31
- type?: 'bar' | 'line' | 'radar' | 'doughnut' | 'polarArea'
32
- }
33
-
34
- export declare function charts(
35
- message: Message,
36
- options?: chartsOptions
37
- ): Promise<any>
38
-
39
- export declare function create(userID: string, guildID: string): Promise<any>
40
-
41
- export declare function fetch(userID: string, guildID: string): Promise<any>
42
-
43
- export declare function leaderboard(
44
- userID: string,
45
- guildID: string,
46
- limit: number
47
- ): Promise<any>
48
-
49
- export declare function lvlRole(
50
- message: Message,
51
- userID: string,
52
- guildID: string
53
- ): Promise<any>
54
-
55
- export type rankOptions = {
56
- slash?: boolean
57
- background?: string
58
- color?: HexColorString
59
- }
60
- export declare function rank(
61
- message: Message,
62
- userID: string,
63
- guildID: string,
64
- options?: rankOptions
65
- ): Promise<any>
66
-
67
- export declare function reset(userID: string, guildID: string): Promise<any>
68
-
69
- export type lvladdOptions = {
70
- level: string
71
- role: string
72
- }
73
- export type lvlremoveOptions = {
74
- level: string
75
- }
76
-
77
- export declare function setLevel(
78
- message: Message,
79
- userID: string,
80
- guildID: string,
81
- level: number
82
- ): Promise<any>
83
-
84
- export declare function setXP(
85
- userID: string,
86
- guildID: string,
87
- xp: number
88
- ): Promise<any>
89
-
90
- /** For levelUp event */
91
- export type Data = {
92
- xp: string
93
- level: number
94
- userID: string
95
- guildID: string
96
- }
97
-
98
- export type Role = {
99
- lvl: string
100
- role: string
101
- }
102
-
103
- declare module 'discord.js' {
104
- export interface ClientEvents {
105
- levelUp: [Message, Data, Role]
106
- }
107
- }
1
+ import { Message, Client } from 'discord.js'
2
+
3
+ type HexColorString = `#${string}` | string
4
+
5
+ export type connectOptions = {
6
+ notify?: boolean
7
+ }
8
+
9
+ export declare function connect(
10
+ db: string,
11
+ options?: connectOptions
12
+ ): Promise<any>
13
+
14
+ export declare function addLevel(
15
+ message: Message,
16
+ userID: string,
17
+ guildID: string,
18
+ level: number
19
+ ): Promise<any>
20
+
21
+ export declare function addXP(
22
+ message: Message,
23
+ userID: string,
24
+ guildID: string,
25
+ xp: number
26
+ ): Promise<any>
27
+
28
+ export type chartsOptions = {
29
+ position?: string
30
+ background?: HexColorString
31
+ type?: 'bar' | 'line' | 'radar' | 'doughnut' | 'polarArea'
32
+ }
33
+
34
+ export declare function charts(
35
+ message: Message,
36
+ options?: chartsOptions
37
+ ): Promise<any>
38
+
39
+ export declare function create(userID: string, guildID: string): Promise<any>
40
+
41
+ export declare function fetch(userID: string, guildID: string): Promise<any>
42
+
43
+ export declare function leaderboard(
44
+ userID: string,
45
+ guildID: string,
46
+ limit: number
47
+ ): Promise<any>
48
+
49
+ export declare function lvlRole(
50
+ message: Message,
51
+ userID: string,
52
+ guildID: string
53
+ ): Promise<any>
54
+
55
+ export type rankOptions = {
56
+ slash?: boolean
57
+ background?: string
58
+ color?: HexColorString
59
+ }
60
+ export declare function rank(
61
+ message: Message,
62
+ userID: string,
63
+ guildID: string,
64
+ options?: rankOptions
65
+ ): Promise<any>
66
+
67
+ export declare function reset(userID: string, guildID: string): Promise<any>
68
+
69
+ export type lvladdOptions = {
70
+ level: string
71
+ role: string
72
+ }
73
+ export type lvlremoveOptions = {
74
+ level: string
75
+ }
76
+
77
+ export declare function setLevel(
78
+ message: Message,
79
+ userID: string,
80
+ guildID: string,
81
+ level: number
82
+ ): Promise<any>
83
+
84
+ export declare function setXP(
85
+ userID: string,
86
+ guildID: string,
87
+ xp: number
88
+ ): Promise<any>
89
+
90
+ /** For levelUp event */
91
+ export type Data = {
92
+ xp: string
93
+ level: number
94
+ userID: string
95
+ guildID: string
96
+ }
97
+
98
+ export type Role = {
99
+ lvl: string
100
+ role: string
101
+ }
102
+
103
+ declare module 'discord.js' {
104
+ export interface ClientEvents {
105
+ levelUp: [Message, Data, Role]
106
+ }
107
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simply-xp",
3
- "version": "1.1.6",
3
+ "version": "1.2.0-test-1",
4
4
  "description": "A Simple, Easy and Beginner Friendly XP System",
5
5
  "main": "simplyxp.js",
6
6
  "typings": "index.d.ts",
@@ -40,13 +40,15 @@
40
40
  "url": "https://github.com/Rahuletto/simply-xp"
41
41
  },
42
42
  "dependencies": {
43
- "canvas": "^2.8.0",
44
- "chart.js-image": "^5.6.3",
45
- "mongoose": "^6.0.12"
43
+ "canvas": "^2.9.3",
44
+ "chart.js-image": "^6.0.3",
45
+ "mongoose": "^6.0.15"
46
46
  },
47
47
  "devDependencies": {
48
- "discord.js": "^13.2.0",
49
48
  "husky": "^7.0.0",
50
49
  "pretty-quick": "^3.1.1"
50
+ },
51
+ "peerDependencies": {
52
+ "discord.js": "^13.x.x"
51
53
  }
52
54
  }
package/simplyxp.js CHANGED
@@ -1,7 +1,7 @@
1
1
  try {
2
2
  require('discord.js')
3
3
  } catch (e) {
4
- throw new Error('Discord.JS is required for this package to run')
4
+ throw new Error('Discord.js v13 is required for this package to run')
5
5
  }
6
6
 
7
7
  module.exports.roleSetup = require('./src/roleSetup')
Binary file
package/src/addLevel.js CHANGED
@@ -1,71 +1,71 @@
1
- let Discord = require('discord.js')
2
- const levels = require('../src/models/level.js')
3
- let { roleSetup } = require('../simplyxp')
4
-
5
- /**
6
- * @param {Discord.Message} message
7
- * @param {string} userID
8
- * @param {string} guildID
9
- * @param {number} level
10
- */
11
- async function addLevel(message, userID, guildID, level) {
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 (!level) throw new Error('[XP] Level amount is not provided.')
17
-
18
- let { client } = message
19
-
20
- const user = await levels.findOne({ user: userID, guild: guildID })
21
-
22
- if (!user) {
23
- const newUser = new levels({
24
- user: userID,
25
- guild: guildID,
26
- xp: 0,
27
- level: 0
28
- })
29
-
30
- await newUser
31
- .save()
32
- .catch((e) => console.log(`[XP] Failed to save new user to database`))
33
-
34
- let xp = (level * 10) ** 2
35
-
36
- return {
37
- level: level,
38
- exp: xp
39
- }
40
- }
41
- let level1 = user.level
42
-
43
- user.xp += (level * 10) ** 2
44
- user.level += Math.floor(0.1 * Math.sqrt(user.xp))
45
-
46
- await user
47
- .save()
48
- .catch((e) =>
49
- console.log(`[XP] Failed to add Level | User: ${userID} | Err: ${e}`)
50
- )
51
-
52
- if (level1 !== level) {
53
- let data = {
54
- xp: user.xp,
55
- level: user.level,
56
- userID,
57
- guildID
58
- }
59
-
60
- let role = await roleSetup.find(client, guildID, level)
61
-
62
- client.emit('levelUp', message, data, role)
63
- }
64
-
65
- return {
66
- level: user.level,
67
- xp: user.xp
68
- }
69
- }
70
-
71
- module.exports = addLevel
1
+ let Discord = require('discord.js')
2
+ const levels = require('../src/models/level.js')
3
+ let { roleSetup } = require('../simplyxp')
4
+
5
+ /**
6
+ * @param {Discord.Message} message
7
+ * @param {string} userID
8
+ * @param {string} guildID
9
+ * @param {number} level
10
+ */
11
+ async function addLevel(message, userID, guildID, level) {
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 (!level) throw new Error('[XP] Level amount is not provided.')
17
+
18
+ let { client } = message
19
+
20
+ const user = await levels.findOne({ user: userID, guild: guildID })
21
+
22
+ if (!user) {
23
+ const newUser = new levels({
24
+ user: userID,
25
+ guild: guildID,
26
+ xp: 0,
27
+ level: 0
28
+ })
29
+
30
+ await newUser
31
+ .save()
32
+ .catch((e) => console.log(`[XP] Failed to save new user to database`))
33
+
34
+ let xp = (level * 10) ** 2
35
+
36
+ return {
37
+ level: level,
38
+ exp: xp
39
+ }
40
+ }
41
+ let level1 = user.level
42
+
43
+ user.xp += (level * 10) ** 2
44
+ user.level += Math.floor(0.1 * Math.sqrt(user.xp))
45
+
46
+ await user
47
+ .save()
48
+ .catch((e) =>
49
+ console.log(`[XP] Failed to add Level | User: ${userID} | Err: ${e}`)
50
+ )
51
+
52
+ if (level1 !== level) {
53
+ let data = {
54
+ xp: user.xp,
55
+ level: user.level,
56
+ userID,
57
+ guildID
58
+ }
59
+
60
+ let role = await roleSetup.find(client, guildID, level)
61
+
62
+ client.emit('levelUp', message, data, role)
63
+ }
64
+
65
+ return {
66
+ level: user.level,
67
+ xp: user.xp
68
+ }
69
+ }
70
+
71
+ module.exports = addLevel