@builderbot/provider-venom 1.0.26-alpha.0 → 1.0.28-alpha.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.
- package/README.md +17 -7
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +5 -4
- package/scripts/fix.js +42 -0
- package/dist/fix.d.ts +0 -2
- package/dist/fix.d.ts.map +0 -1
- package/dist/server.d.ts +0 -39
- package/dist/server.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://builderbot.vercel.app/">
|
|
3
|
+
<h2 align="center">@builderbot/provider-venom</h2>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
2
6
|
|
|
3
|
-
> TODO: description
|
|
4
7
|
|
|
5
|
-
##
|
|
8
|
+
## Documentation
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
const providerVenom = require('provider-venom');
|
|
10
|
+
Visit [builderbot](https://builderbot.vercel.app/) to view the full documentation.
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
## Official Course
|
|
14
|
+
|
|
15
|
+
If you want to discover all the functions and features offered by the library you can take the course.
|
|
16
|
+
[View Course](https://app.codigoencasa.com/courses/builderbot?refCode=LEIFER)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Contact Us
|
|
20
|
+
- [💻 Discord](https://link.codigoencasa.com/DISCORD)
|
|
21
|
+
- [👌 𝕏 (Twitter)](https://twitter.com/leifermendez)
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var bot = require('@builderbot/bot');
|
|
3
4
|
var fs = require('fs');
|
|
4
5
|
var promises = require('fs/promises');
|
|
5
|
-
var bot = require('@builderbot/bot');
|
|
6
6
|
var require$$1 = require('path');
|
|
7
7
|
var os = require('os');
|
|
8
8
|
var venom = require('venom-bot');
|
|
@@ -11162,7 +11162,7 @@ class VenomProvider extends bot.ProviderClass {
|
|
|
11162
11162
|
const fileName = this.generateFileName(extension);
|
|
11163
11163
|
const pathFile = require$$1.join(options?.path ?? os.tmpdir(), fileName);
|
|
11164
11164
|
await promises.writeFile(pathFile, buffer);
|
|
11165
|
-
return pathFile;
|
|
11165
|
+
return require$$1.resolve(pathFile);
|
|
11166
11166
|
}
|
|
11167
11167
|
catch (err) {
|
|
11168
11168
|
console.log(`[Error]:`, err.message);
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kDAAkD,CAAA;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAMjF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,MAAM,WAAW,CAAA;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C;;;;GAIG;AACH,cAAM,aAAc,SAAQ,aAAa;IACrC,gBAAgB;;;;MAAkD;IAClE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAA;gBACV,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE;IAKxD,OAAO,CAAC,gBAAgB,CAAmE;cAE3E,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAiE1C,SAAS,CAAC,cAAc,CAAC,MAAM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0.28-alpha.0",
|
|
4
4
|
"description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Leifer Mendez <leifer33@gmail.com>",
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"files": [
|
|
12
|
+
"./scripts/",
|
|
12
13
|
"./dist/"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
16
|
"build": "rimraf dist && rollup --config",
|
|
16
17
|
"test": "npx uvu -r tsm ./__tests__",
|
|
17
18
|
"test:coverage": "npx c8 npm run test",
|
|
18
|
-
"postinstall": ""
|
|
19
|
+
"postinstall": "node ./scripts/fix.js"
|
|
19
20
|
},
|
|
20
21
|
"directories": {
|
|
21
22
|
"lib": "dist",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
},
|
|
31
32
|
"homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@builderbot/bot": "^1.0.
|
|
34
|
+
"@builderbot/bot": "^1.0.28-alpha.0",
|
|
34
35
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
35
36
|
"@rollup/plugin-json": "^6.1.0",
|
|
36
37
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
@@ -58,5 +59,5 @@
|
|
|
58
59
|
"spinnies": "^0.5.1",
|
|
59
60
|
"venom-bot": "^5.0.21"
|
|
60
61
|
},
|
|
61
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6e01de0b346e318f61f9a2e4d16f2f1c2d9c64de"
|
|
62
63
|
}
|
package/scripts/fix.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { readFileSync } from 'fs'
|
|
2
|
+
import { writeFile } from 'fs/promises'
|
|
3
|
+
|
|
4
|
+
// https://github.com/orkestral/venom/issues/2485
|
|
5
|
+
const fixSendFiles = async () => {
|
|
6
|
+
const path = './node_modules/venom-bot/dist/lib/wapi/wapi.js'
|
|
7
|
+
let toFix = readFileSync(path)
|
|
8
|
+
toFix = toFix
|
|
9
|
+
.toString()
|
|
10
|
+
.replace(
|
|
11
|
+
`return await n.processAttachments("0.4.613"===Debug.VERSION?t:t.map((e=>({file:e}))),e,1),n}`,
|
|
12
|
+
`return await n.processAttachments("0.4.613"===Debug.VERSION?t:t.map((e=>({file:e}))),e,e),n}`
|
|
13
|
+
)
|
|
14
|
+
await writeFile(path, toFix)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const removeOverLogs = async () => {
|
|
18
|
+
const path = './node_modules/venom-bot/dist/utils/spinnies.js'
|
|
19
|
+
let toFix = readFileSync(path, 'utf8')
|
|
20
|
+
|
|
21
|
+
toFix = toFix
|
|
22
|
+
.replace(
|
|
23
|
+
/function\s+getSpinnies\(options\)\s*{[^}]+}/,
|
|
24
|
+
`function getSpinnies_(options) {
|
|
25
|
+
if (!spinnies) {
|
|
26
|
+
spinnies = new spinnies_1.default(options);
|
|
27
|
+
}
|
|
28
|
+
spinnies.fail = () => null;
|
|
29
|
+
spinnies.succeed = () => null;
|
|
30
|
+
spinnies.add = () => null;
|
|
31
|
+
`
|
|
32
|
+
)
|
|
33
|
+
.replace('exports.getSpinnies = getSpinnies;', `exports.getSpinnies = getSpinnies_;`)
|
|
34
|
+
await writeFile(path, toFix)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const mainFix = async () => {
|
|
38
|
+
await removeOverLogs()
|
|
39
|
+
await fixSendFiles()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
mainFix()
|
package/dist/fix.d.ts
DELETED
package/dist/fix.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fix.d.ts","sourceRoot":"","sources":["../src/fix.ts"],"names":[],"mappings":""}
|
package/dist/server.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import EventEmitter from 'node:events';
|
|
3
|
-
import type { Polka } from 'polka';
|
|
4
|
-
import type polka from 'polka';
|
|
5
|
-
|
|
6
|
-
import type { VenomProvider } from '.';
|
|
7
|
-
import type { BotCtxMiddleware } from './types';
|
|
8
|
-
export declare class VenomHttpServer extends EventEmitter {
|
|
9
|
-
#private;
|
|
10
|
-
server: Polka;
|
|
11
|
-
port: number;
|
|
12
|
-
constructor(botName: string, _port: number);
|
|
13
|
-
/**
|
|
14
|
-
* Contruir HTTP Server
|
|
15
|
-
*/
|
|
16
|
-
protected buildHTTPServer(): Polka;
|
|
17
|
-
/**
|
|
18
|
-
* Iniciar el servidor HTTP
|
|
19
|
-
*/
|
|
20
|
-
start(vendor: BotCtxMiddleware, port?: number, args?: {
|
|
21
|
-
botName: string;
|
|
22
|
-
}): void;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param _
|
|
26
|
-
* @param res
|
|
27
|
-
*/
|
|
28
|
-
protected indexHome: polka.Middleware;
|
|
29
|
-
stop(): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @param inHandleCtx
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
export declare const inHandleCtx: <T extends Pick<VenomProvider, "sendMessage" | "vendor"> & {
|
|
37
|
-
provider: VenomProvider;
|
|
38
|
-
}>(ctxPolka: (bot: T, req: any, res: any) => Promise<void>) => (req: any, res: any) => any;
|
|
39
|
-
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA,OAAO,YAAY,MAAM,aAAa,CAAA;AAGtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,GAAG,CAAA;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAK/C,qBAAa,eAAgB,SAAQ,YAAY;;IACtC,MAAM,EAAE,KAAK,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;gBAGP,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAO1C;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,KAAK;IAQlC;;OAEG;IAEH,KAAK,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;IAczE;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,UAAU,CAMpC;IAED,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAWxB;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW;cACmD,aAAa;2BAC5C,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,WAEjE,GAAG,OAAO,GAAG,QAoBlB,CAAA"}
|