neekuro 2.0.1 → 2.0.3
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/package.json +63 -63
- package/sources/classes/{sfw.js → SFW.js} +4 -4
- package/sources/classes/package/{welcome.js → Welcome.js} +21 -21
- package/sources/classes/user/{user.js → User.js} +2 -2
- package/sources/main/index.js +8 -8
- package/sources/rest/{apiclient.js → APIClient.js} +1 -1
- package/sources/typings/index.d.ts +2 -2
- /package/{readme.md → README.md} +0 -0
- /package/sources/classes/errors/{apierror.js → APIerror.js} +0 -0
- /package/sources/classes/errors/{error.js → Error.js} +0 -0
- /package/sources/classes/package/{nekogif.js → NekoGif.js} +0 -0
- /package/sources/classes/user/{baseuser.js → BaseUser.js} +0 -0
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"name": "neekuro",
|
|
4
|
-
"version": "2.0.
|
|
5
|
-
"description": "Una biblioteca de imágenes con temática de anime para bots de Discord.",
|
|
6
|
-
"main": "sources/main/index.js",
|
|
7
|
-
"types": "sources/typings/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": {
|
|
11
|
-
"types": "./sources/typings/index.d.ts",
|
|
12
|
-
"default": "./sources/main/index.js"
|
|
13
|
-
},
|
|
14
|
-
"require": {
|
|
15
|
-
"types": "./sources/typings/index.d.ts",
|
|
16
|
-
"default": "./sources/main/index.js"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"directories": {
|
|
21
|
-
"test": "test"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"sources",
|
|
25
|
-
"README.md"
|
|
26
|
-
],
|
|
27
|
-
"contributors": [
|
|
28
|
-
"cacao0027 <kzmkuro@gmail.com>"
|
|
29
|
-
],
|
|
30
|
-
"author": "cacao0027 <kzmkuro@gmail.com>",
|
|
31
|
-
"keywords": [
|
|
32
|
-
"anime",
|
|
33
|
-
"acción",
|
|
34
|
-
"gifs",
|
|
35
|
-
"imagenes",
|
|
36
|
-
"nsfw",
|
|
37
|
-
"sfw",
|
|
38
|
-
"discord",
|
|
39
|
-
"action",
|
|
40
|
-
"images"
|
|
41
|
-
],
|
|
42
|
-
"license": "ISC",
|
|
43
|
-
"scripts": {
|
|
44
|
-
"test": "nodemon node ./test/main.test.js"
|
|
45
|
-
},
|
|
46
|
-
"engines": {
|
|
47
|
-
"node": ">=20.12.2"
|
|
48
|
-
},
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"canvas": "^3.1.0",
|
|
51
|
-
"hex-color-regex": "^1.1.0",
|
|
52
|
-
"neekuro": "file:",
|
|
53
|
-
"node-fetch": "^3.3.2"
|
|
54
|
-
},
|
|
55
|
-
"repository": {
|
|
56
|
-
"type": "git",
|
|
57
|
-
"url": "git+https://github.com/CacaoNk0027/neekuro_package.git"
|
|
58
|
-
},
|
|
59
|
-
"bugs": {
|
|
60
|
-
"url": "https://github.com/CacaoNk0027/neekuro_package/issues"
|
|
61
|
-
},
|
|
62
|
-
"homepage": "https://github.com/CacaoNk0027/neekuro_package#readme"
|
|
63
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
+
"name": "neekuro",
|
|
4
|
+
"version": "2.0.3",
|
|
5
|
+
"description": "Una biblioteca de imágenes con temática de anime para bots de Discord.",
|
|
6
|
+
"main": "sources/main/index.js",
|
|
7
|
+
"types": "sources/typings/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./sources/typings/index.d.ts",
|
|
12
|
+
"default": "./sources/main/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./sources/typings/index.d.ts",
|
|
16
|
+
"default": "./sources/main/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"directories": {
|
|
21
|
+
"test": "test"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"sources",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"contributors": [
|
|
28
|
+
"cacao0027 <kzmkuro@gmail.com>"
|
|
29
|
+
],
|
|
30
|
+
"author": "cacao0027 <kzmkuro@gmail.com>",
|
|
31
|
+
"keywords": [
|
|
32
|
+
"anime",
|
|
33
|
+
"acción",
|
|
34
|
+
"gifs",
|
|
35
|
+
"imagenes",
|
|
36
|
+
"nsfw",
|
|
37
|
+
"sfw",
|
|
38
|
+
"discord",
|
|
39
|
+
"action",
|
|
40
|
+
"images"
|
|
41
|
+
],
|
|
42
|
+
"license": "ISC",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"test": "nodemon node ./test/main.test.js"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=20.12.2"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"canvas": "^3.1.0",
|
|
51
|
+
"hex-color-regex": "^1.1.0",
|
|
52
|
+
"neekuro": "file:",
|
|
53
|
+
"node-fetch": "^3.3.2"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/CacaoNk0027/neekuro_package.git"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/CacaoNk0027/neekuro_package/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/CacaoNk0027/neekuro_package#readme"
|
|
63
|
+
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* @typedef {import('../typings').GifMap} GifMap
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
const APIClient = require('../rest/
|
|
7
|
-
const NekoError = require('./errors/
|
|
8
|
-
const NekoGif = require('./package/
|
|
9
|
-
const { getToken } = require('./user/
|
|
6
|
+
const APIClient = require('../rest/APIClient.js');
|
|
7
|
+
const NekoError = require('./errors/Error.js');
|
|
8
|
+
const NekoGif = require('./package/NekoGif.js');
|
|
9
|
+
const { getToken } = require('./user/BaseUser.js');
|
|
10
10
|
|
|
11
11
|
// url base de la api para SFW
|
|
12
12
|
const base = 'https://www.nexatdc.work.gd/api/sfw/'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const Canvas = require('canvas');
|
|
3
|
-
const NekoError = require('../errors/
|
|
3
|
+
const NekoError = require('../errors/Error.js');
|
|
4
4
|
const hex_reg = require('hex-color-regex')({ strict: true })
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
@@ -56,31 +56,31 @@ class Welcome {
|
|
|
56
56
|
*/
|
|
57
57
|
this.data = {
|
|
58
58
|
font: 'arial',
|
|
59
|
-
width:
|
|
60
|
-
height:
|
|
59
|
+
width: 1140,
|
|
60
|
+
height: 520,
|
|
61
61
|
background: {
|
|
62
62
|
type: 'color',
|
|
63
63
|
value: '#23272A'
|
|
64
64
|
},
|
|
65
65
|
avatar: {
|
|
66
66
|
source: null,
|
|
67
|
-
x:
|
|
67
|
+
x: 448,
|
|
68
68
|
y: 80,
|
|
69
69
|
radio: 120,
|
|
70
70
|
border: "#F7F7F7"
|
|
71
71
|
},
|
|
72
72
|
title: {
|
|
73
73
|
content: "¡Bienvenido!",
|
|
74
|
-
x:
|
|
75
|
-
y:
|
|
76
|
-
font_size:
|
|
74
|
+
x: 565,
|
|
75
|
+
y: 400,
|
|
76
|
+
font_size: 55,
|
|
77
77
|
text_color: '#FFFFFF'
|
|
78
78
|
},
|
|
79
79
|
description: {
|
|
80
80
|
content: 'Al mejor servidor de discord',
|
|
81
81
|
x: 590,
|
|
82
|
-
y:
|
|
83
|
-
font_size:
|
|
82
|
+
y: 450,
|
|
83
|
+
font_size: 35,
|
|
84
84
|
text_color: "#F7F7F7"
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -291,7 +291,7 @@ class Welcome {
|
|
|
291
291
|
/**
|
|
292
292
|
* Establece el fondo de la imagen de bienvenida (color o imagen)
|
|
293
293
|
* @param {'color'|'image'} type - Tipo de fondo ('color' o 'image')
|
|
294
|
-
* @param {string|Buffer}
|
|
294
|
+
* @param {string|Buffer} value - Color hexadecimal (ej. '#FF5733') o imagen (URL/Buffer)
|
|
295
295
|
* @returns {Welcome}
|
|
296
296
|
* @throws {NekoError} Si los parámetros son inválidos
|
|
297
297
|
* @example
|
|
@@ -305,36 +305,36 @@ class Welcome {
|
|
|
305
305
|
* const imageBuffer = fs.readFileSync('fondo.jpg');
|
|
306
306
|
* welcome.setBackground('image', imageBuffer);
|
|
307
307
|
*/
|
|
308
|
-
setBackground(type,
|
|
308
|
+
setBackground(type, value) {
|
|
309
309
|
if (!type) throw new NekoError('BackgroundError', 'El parámetro <type> no puede estar vacío');
|
|
310
310
|
if (typeof type != 'string') throw new NekoError('TypeError', `El parámetro <type> debe ser string, recibió ${typeof type}`);
|
|
311
311
|
if (!['color', 'image'].includes(type)) throw new NekoError('BackgroundError', 'El tipo de fondo debe ser "color" o "image"');
|
|
312
312
|
|
|
313
|
-
if (!
|
|
313
|
+
if (!value) throw new NekoError('BackgroundError', 'El parámetro <value> no puede estar vacío');
|
|
314
314
|
|
|
315
315
|
if (type == 'color') {
|
|
316
|
-
if (typeof
|
|
317
|
-
if (!
|
|
318
|
-
if (!hex_reg.test(
|
|
316
|
+
if (typeof value != 'string') throw new NekoError('TypeError', 'Para fondo de color, <data> debe ser string');
|
|
317
|
+
if (!value.startsWith('#')) throw new NekoError('BackgroundError', 'El color debe comenzar con \'#\'');
|
|
318
|
+
if (!hex_reg.test(value)) throw new NekoError('BackgroundError', 'El valor no es un color hexadecimal válido');
|
|
319
319
|
|
|
320
|
-
this.data.background = { type,
|
|
320
|
+
this.data.background = { type, value };
|
|
321
321
|
return this;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
if (type == 'image') {
|
|
325
|
-
if (typeof
|
|
326
|
-
throw new NekoError('TypeError', 'Para fondo de imagen, <
|
|
325
|
+
if (typeof value != 'string' && !Buffer.isBuffer(value)) {
|
|
326
|
+
throw new NekoError('TypeError', 'Para fondo de imagen, <value> debe ser URL (string) o Buffer');
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
if (typeof
|
|
329
|
+
if (typeof value == 'string') {
|
|
330
330
|
try {
|
|
331
|
-
new URL(
|
|
331
|
+
new URL(value);
|
|
332
332
|
} catch (error) {
|
|
333
333
|
throw new NekoError('BackgroundError', 'La URL proporcionada no es válida');
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
this.data.background = { type,
|
|
337
|
+
this.data.background = { type, value };
|
|
338
338
|
return this;
|
|
339
339
|
}
|
|
340
340
|
}
|
package/sources/main/index.js
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
//#region Clases
|
|
4
4
|
|
|
5
|
-
exports.User = require('../classes/user/
|
|
5
|
+
exports.User = require('../classes/user/User.js')
|
|
6
6
|
|
|
7
7
|
// paquete
|
|
8
8
|
|
|
9
|
-
exports.NekoGif = require('../classes/package/
|
|
10
|
-
exports.BaseUser = require('../classes/user/
|
|
11
|
-
exports.Welcome = require('../classes/package/
|
|
9
|
+
exports.NekoGif = require('../classes/package/NekoGif.js')
|
|
10
|
+
exports.BaseUser = require('../classes/user/BaseUser.js')
|
|
11
|
+
exports.Welcome = require('../classes/package/Welcome.js')
|
|
12
12
|
|
|
13
13
|
// rest
|
|
14
14
|
|
|
15
|
-
exports.APIClient = require('../rest/
|
|
15
|
+
exports.APIClient = require('../rest/APIClient.js')
|
|
16
16
|
|
|
17
17
|
// errores
|
|
18
18
|
|
|
19
|
-
exports.APIError = require('../classes/errors/
|
|
20
|
-
exports.Error = require('../classes/errors/
|
|
19
|
+
exports.APIError = require('../classes/errors/APIerror.js')
|
|
20
|
+
exports.Error = require('../classes/errors/Error.js')
|
|
21
21
|
|
|
22
22
|
//#region "constantes"
|
|
23
23
|
|
|
24
|
-
exports.SFW = require('../classes/
|
|
24
|
+
exports.SFW = require('../classes/SFW.js')
|
|
@@ -216,10 +216,10 @@ export class Welcome {
|
|
|
216
216
|
/**
|
|
217
217
|
* Establece el fondo de la imagen (color o imagen)
|
|
218
218
|
* @param type Tipo de fondo ('color' o 'image')
|
|
219
|
-
* @param
|
|
219
|
+
* @param value Color hexadecimal o imagen (URL/Buffer)
|
|
220
220
|
* @throws {NekoError} Si los parámetros son inválidos
|
|
221
221
|
*/
|
|
222
|
-
setBackground(type: 'color' | 'image',
|
|
222
|
+
setBackground(type: 'color' | 'image', value: string | Buffer): this;
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
225
|
* Establece el avatar y su configuración
|
/package/{readme.md → README.md}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|