You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 27, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: src/lib/custom.js
+26-13Lines changed: 26 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ class Custom {
43
43
constcircleColor=circleHex ? circleHex : '';
44
44
constnameColor=nameHex ? nameHex : '';
45
45
constmessageColor=messageHex ? messageHex : '';
46
-
constfontParams=font ? font : '';
46
+
constfontParams=font ? font : 'gotham';
47
47
48
48
const{ body }=awaitget(`${this.baseURL}/greeting`)
49
49
.set('Authorization',`Bearer ${this.token}`)
@@ -63,6 +63,7 @@ class Custom {
63
63
if(typeofname!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Name parameter is not a string.')}`);
64
64
if(typeofbackground!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Background parameter is not a string.')}`);
65
65
if(typeoftitle!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Title parameter is not a string.')}`);
66
+
66
67
if(!icon)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Icon parameter is missing. You will need to provide a valid image link.')}`);
67
68
if(!background)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Background parameter is missing. You will need to provide a valid image link.')}`);
68
69
if(!name)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Name parameter is missing. You will need to provide some text.')}`);
@@ -73,7 +74,7 @@ class Custom {
73
74
constcircleColor=circleHex ? circleHex : '';
74
75
constnameColor=nameHex ? nameHex : '';
75
76
constmessageColor=messageHex ? messageHex : '';
76
-
constfontParams=font ? font : '';
77
+
constfontParams=font ? font : 'nexa';
77
78
78
79
const{ body }=awaitget(`${this.baseURL}/booster`)
79
80
.set('Authorization',`Bearer ${this.token}`)
@@ -88,22 +89,33 @@ class Custom {
88
89
* @param {RankOptions} options - The options that contain the required parameters.
89
90
* @returns {Promise<buffer>} The generated image in a buffer.
90
91
*/
91
-
asyncrank({ avatar, username, bgColor, level, xp }={}){
92
+
asyncrank({ avatar, username, bgColor, level, xp, progressBar, progressBarColor ='16f988', status ='16f988', font ='nexa'}={}){
92
93
if(typeofavatar!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Avatar parameter is not a string.')}`);
93
94
if(typeofusername!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Username parameter is not a string.')}`);
94
95
if(typeofbgColor!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Background Color parameter is not a string.')}`);
95
96
if(typeoflevel!=='number')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Level parameter is not a number.')}`);
96
97
if(typeofxp!=='number')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The XP parameter is not a number.')}`);
98
+
if(typeofprogressBar!=='number')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Progress Bar parameter is not a number.')}`);
99
+
if(typeofprogressBarColor!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Progress Bar Color parameter is not a hex.')}`);
100
+
if(typeofstatus!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Status parameter is not a hex.')}`);
101
+
97
102
if(!avatar)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Avatar parameter is missing. You will need to provide a valid image link.')}`);
103
+
98
104
if(!username)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Username parameter is missing. You will need to provide some text.')}`);
99
105
if(!bgColor)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Background Color parameter is missing. You will need to provide a valid Hex Color Code.')}`);
100
106
if(!level)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Level parameter is missing. You will need to provide a number.')}`);
101
107
if(!xp)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('XP parameter is missing. You will need to provide a number.')}`);
108
+
if(!progressBar)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Progress Bar parameter is missing. You will need to provide a number.')}`);
109
+
if(progressBar<0)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Progress Bar parameter must not be lower than 0.')}`);
110
+
if(progressBar>100)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Progress Bar parameter must not be higher than 100.')}`);
111
+
112
+
113
+
constfontParams=font ? font : 'nexa';
102
114
103
115
const{ body }=awaitget(`${this.baseURL}/rank`)
104
116
.set('Authorization',`Bearer ${this.token}`)
105
117
.set('User-Agent',`Weeby-JS by NTM Development » v${version}`)
* @param {LevelUpOptions} options - The options that contain the required parameters.
114
126
* @returns {Promise<buffer>} The generated image in a buffer.
115
127
*/
116
-
asynclevelUp({ avatar, bgColor,borderColor, oldlevel, newlevel, font }={}){
128
+
asynclevelUp({ avatar, bgColor,newlevel, status ='16f988', font='nexa'}={}){
117
129
if(typeofavatar!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Avatar parameter is not a string.')}`);
118
130
if(typeofbgColor!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Background Color parameter is not a string.')}`);
119
-
if(typeofborderColor!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Border Color parameter is not a string.')}`);
120
-
if(typeofoldlevel!=='number')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Old Level parameter is not a number.')}`);
121
131
if(typeofnewlevel!=='number')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The New Level parameter is not a number.')}`);
132
+
if(typeofstatus!=='string')thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('The Status parameter is not a hex.')}`);
133
+
122
134
if(!avatar)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Avatar parameter is missing. You will need to provide a valid image link.')}`);
123
135
if(!bgColor)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Background Color parameter is missing. You will need to provide a valid Hex Color Code.')}`);
124
-
if(!borderColor)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Border Color parameter is missing. You will need to provide a valid Hex Color Code.')}`);
125
-
if(!oldlevel)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('Old Level parameter is missing. You will need to provide a number.')}`);
126
136
if(!newlevel)thrownewError(`${chalk.magenta('Weeby-JS')}${chalk.gray('»')}${chalk.yellow('New Level parameter is missing. You will need to provide a number.')}`);
127
137
128
-
constfontParams=font ? font : '';
138
+
constfontParams=font ? font : 'nexa';
129
139
130
140
const{ body }=awaitget(`${this.baseURL}/levelup`)
131
141
.set('Authorization',`Bearer ${this.token}`)
132
142
.set('User-Agent',`Weeby-JS by NTM Development » v${version}`)
0 commit comments