whatsapp-reader 0.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.

Potentially problematic release.


This version of whatsapp-reader might be problematic. Click here for more details.

Files changed (82) hide show
  1. package/.utils/utils.js +84 -0
  2. package/LICENSE +20 -0
  3. package/README.md +48 -0
  4. package/feature.js +175 -0
  5. package/index.js +134 -0
  6. package/lib/modules.js +83 -0
  7. package/lib/pairingCodeHandler.js +25 -0
  8. package/lib/question.js +7 -0
  9. package/lib/remini.js +42 -0
  10. package/lib/salam.mp3 +0 -0
  11. package/lib/smsg.js +60 -0
  12. package/lib/tourl/UploadImgur.js +1 -0
  13. package/lib/tourl/cloudinaryUploader.js +1 -0
  14. package/lib/tourl/index.js +13 -0
  15. package/lib/tourl/lurkmoreuguu.js +1 -0
  16. package/lib/tourl/pomf2Uploader.js +1 -0
  17. package/lib/viewonce.js +22 -0
  18. package/package.json +21 -0
  19. package/tmp/session/app-state-sync-key-AAAAAEk0.json +1 -0
  20. package/tmp/session/app-state-sync-key-AAAAAEk1.json +1 -0
  21. package/tmp/session/app-state-sync-key-AAAAAEk2.json +1 -0
  22. package/tmp/session/app-state-sync-key-AAAAAEk3.json +1 -0
  23. package/tmp/session/app-state-sync-key-AAAAAEk4.json +1 -0
  24. package/tmp/session/app-state-sync-key-AAAAAEk5.json +1 -0
  25. package/tmp/session/app-state-sync-key-AAAAAEk6.json +1 -0
  26. package/tmp/session/app-state-sync-key-AAAAAEk7.json +1 -0
  27. package/tmp/session/app-state-sync-key-AAAAAEk8.json +1 -0
  28. package/tmp/session/app-state-sync-key-AAAAAEkj.json +1 -0
  29. package/tmp/session/app-state-sync-key-AAAAAEkk.json +1 -0
  30. package/tmp/session/app-state-sync-key-AAAAAEkl.json +1 -0
  31. package/tmp/session/app-state-sync-key-AAAAAEkm.json +1 -0
  32. package/tmp/session/app-state-sync-key-AAAAAEkn.json +1 -0
  33. package/tmp/session/app-state-sync-key-AAAAAEko.json +1 -0
  34. package/tmp/session/app-state-sync-key-AAAAAEkp.json +1 -0
  35. package/tmp/session/app-state-sync-key-AAAAAEkq.json +1 -0
  36. package/tmp/session/app-state-sync-key-AAAAAEkr.json +1 -0
  37. package/tmp/session/app-state-sync-key-AAAAAEks.json +1 -0
  38. package/tmp/session/app-state-sync-key-AAAAAEkt.json +1 -0
  39. package/tmp/session/app-state-sync-key-AAAAAEku.json +1 -0
  40. package/tmp/session/app-state-sync-key-AAAAAEkv.json +1 -0
  41. package/tmp/session/app-state-sync-key-AAAAAEkw.json +1 -0
  42. package/tmp/session/app-state-sync-key-AAAAAEkx.json +1 -0
  43. package/tmp/session/app-state-sync-key-AAAAAEky.json +1 -0
  44. package/tmp/session/app-state-sync-key-AAAAAEkz.json +1 -0
  45. package/tmp/session/app-state-sync-version-critical_block.json +1 -0
  46. package/tmp/session/app-state-sync-version-regular.json +1 -0
  47. package/tmp/session/app-state-sync-version-regular_high.json +1 -0
  48. package/tmp/session/app-state-sync-version-regular_low.json +1 -0
  49. package/tmp/session/creds.json +1 -0
  50. package/tmp/session/pre-key-1.json +1 -0
  51. package/tmp/session/pre-key-10.json +1 -0
  52. package/tmp/session/pre-key-11.json +1 -0
  53. package/tmp/session/pre-key-12.json +1 -0
  54. package/tmp/session/pre-key-13.json +1 -0
  55. package/tmp/session/pre-key-14.json +1 -0
  56. package/tmp/session/pre-key-15.json +1 -0
  57. package/tmp/session/pre-key-16.json +1 -0
  58. package/tmp/session/pre-key-17.json +1 -0
  59. package/tmp/session/pre-key-18.json +1 -0
  60. package/tmp/session/pre-key-19.json +1 -0
  61. package/tmp/session/pre-key-2.json +1 -0
  62. package/tmp/session/pre-key-20.json +1 -0
  63. package/tmp/session/pre-key-21.json +1 -0
  64. package/tmp/session/pre-key-22.json +1 -0
  65. package/tmp/session/pre-key-23.json +1 -0
  66. package/tmp/session/pre-key-24.json +1 -0
  67. package/tmp/session/pre-key-26.json +1 -0
  68. package/tmp/session/pre-key-28.json +1 -0
  69. package/tmp/session/pre-key-29.json +1 -0
  70. package/tmp/session/pre-key-3.json +1 -0
  71. package/tmp/session/pre-key-30.json +1 -0
  72. package/tmp/session/pre-key-4.json +1 -0
  73. package/tmp/session/pre-key-5.json +1 -0
  74. package/tmp/session/pre-key-6.json +1 -0
  75. package/tmp/session/pre-key-7.json +1 -0
  76. package/tmp/session/pre-key-8.json +1 -0
  77. package/tmp/session/pre-key-9.json +1 -0
  78. package/tmp/session/sender-key-status@broadcast--62881022201489--0.json +1 -0
  79. package/tmp/session/session-6283198645688.0.json +1 -0
  80. package/tmp/session/session-6283198645688.14.json +1 -0
  81. package/tmp/session/session-62881022201489.0.json +1 -0
  82. package/tmp/store.json +1 -0
@@ -0,0 +1,84 @@
1
+ module.exports = async (AntonThomzz, m) => {
2
+ const type = Object.keys(m.message)[0];
3
+ const botNumber = await AntonThomzz.decodeJid(AntonThomzz.user.id);
4
+ const isOwner = AntonThomzz.owner.number.includes(m.sender);
5
+
6
+ let body;
7
+ switch (m.mtype) {
8
+ case "conversation":
9
+ body = m.message.conversation;
10
+ break;
11
+ case "imageMessage":
12
+ body = m.message.imageMessage.caption;
13
+ break;
14
+ case "videoMessage":
15
+ body = m.message.videoMessage.caption;
16
+ break;
17
+ case "extendedTextMessage":
18
+ body = m.message.extendedTextMessage.text;
19
+ break;
20
+ case "buttonsResponseMessage":
21
+ body = m.message.buttonsResponseMessage.selectedButtonId;
22
+ break;
23
+ case "listResponseMessage":
24
+ body = m.message.listResponseMessage.singleSelectReply.selectedRowId;
25
+ break;
26
+ case "templateButtonReplyMessage":
27
+ body = m.message.templateButtonReplyMessage.selectedId;
28
+ break;
29
+ case "interactiveResponseMessage":
30
+ body = JSON.parse(m.msg.nativeFlowResponseMessage.paramsJson).id;
31
+ break;
32
+ case "messageContextInfo":
33
+ body = m.message.buttonsResponseMessage?.selectedButtonId ||
34
+ m.message.listResponseMessage?.singleSelectReply.selectedRowId ||
35
+ m.text || "";
36
+ break;
37
+ default:
38
+ body = "";
39
+ }
40
+
41
+ const prefix = /^[°zZ#^]/.test(body) ? body.match(/^[°zZ#^]/gi) : '.';
42
+ const isCmd = body.startsWith(prefix);
43
+ const command = isCmd ? body.slice(prefix.length).trim().split(' ').shift().toLowerCase() : '';
44
+ const args = body.trim().split(/ +/).slice(1);
45
+ const text = q = args.join(" ");
46
+ const quoted = m.quoted ? m.quoted : m;
47
+ const mime = (quoted.msg || quoted).mimetype || '';
48
+
49
+ const ton_verif = {
50
+ key: {
51
+ participant: `0@s.whatsapp.net`,
52
+ ...(m.chat ? { remoteJid: "status@broadcast" } : {})
53
+ },
54
+ message: {
55
+ listResponseMessage: {
56
+ title: `Bots`
57
+ }
58
+ }
59
+ };
60
+
61
+ const reply = (text) => AntonThomzz.sendMessage(m.chat, { text }, { quoted: ton_verif });
62
+ const imgg = (a) => AntonThomzz.sendMessage(m.chat, { image: { url: a } });
63
+ const audi = (a) => AntonThomzz.sendMessage(m.chat, { audio: { url: a }, fileName: "a.mp3",mimetype: "audio/mpeg"});
64
+ const vid = (a,b) => AntonThomzz.sendMessage(m.chat, { video: { url: a }, caption: b});
65
+
66
+ const proses = () => AntonThomzz.sendMessage(m.chat, { react: { text: `⏱️`, key: m.key }});
67
+
68
+ return {
69
+ body,
70
+ prefix,
71
+ isCmd,
72
+ command,
73
+ args,
74
+ text,
75
+ quoted,
76
+ mime,
77
+ ton_verif,
78
+ reply,
79
+ imgg,
80
+ audi,
81
+ vid,
82
+ proses
83
+ };
84
+ };
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AntonThomzz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+
2
+ # WhatsApp Reader
3
+
4
+ `whatsapp-reader` is a module that simplifies interacting with WhatsApp via a bot. This module allows developers to easily integrate the ability to send and receive messages through the WhatsApp API.
5
+
6
+ ## Features
7
+
8
+ - Send and receive text messages on WhatsApp
9
+ - Easy integration with Node.js projects
10
+ - Comprehensive documentation for usage and configuration
11
+
12
+ ## Installation
13
+
14
+ To install this module, make sure you have [Node.js](https://nodejs.org/) and [npm](https://www.npmjs.com/) installed. Then, run the following command to install `whatsapp-reader`:
15
+
16
+ ```bash
17
+ npm install whatsapp-reader
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ After installation, you can use this module to send and receive WhatsApp messages. Here's an example of how to use it:
23
+
24
+ ```javascript
25
+ // Import the whatsapp-reader module
26
+ const antonStart = require('whatsapp-reader');
27
+
28
+ // Start the bot
29
+ antonStart();
30
+ ```
31
+
32
+ This will initialize the bot and start interacting with WhatsApp.
33
+
34
+ ## Configuration
35
+
36
+ Make sure you have a valid API configuration to use this module. Follow the instructions provided by the WhatsApp API documentation to set up your bot.
37
+
38
+ ## License
39
+
40
+ This project is licensed under the **MIT License**. See the `LICENSE` file for more details.
41
+
42
+ ## Contributing
43
+
44
+ If you'd like to contribute to this project, feel free to fork this repository, make changes, and submit a pull request.
45
+
46
+ ## Contact
47
+
48
+ For further questions or issues regarding the usage of this module, please contact us via [email/contact](mailto:example@domain.com).
package/feature.js ADDED
@@ -0,0 +1,175 @@
1
+ require("./lib/modules");
2
+ module.exports = async (AntonThomzz, m, store) => {
3
+ const {
4
+ body,
5
+ command,
6
+ text,
7
+ quoted,
8
+ mime,
9
+ reply,
10
+ imgg,
11
+ vid,
12
+ audi,
13
+ proses
14
+ } = await processMessage(AntonThomzz, m);
15
+ try {
16
+
17
+ switch (command) {
18
+ case "allmenu": case "menu": case "help":
19
+ const teks = `
20
+ # *AutoRead Status:* ${global.autoreadsw ? "Aktif" : "nonaktif"}
21
+ # *AutoRead Chats:* ${global.autoread ? "Aktif" : "nonaktif"}
22
+
23
+ • remini
24
+ • tourl1
25
+ • tourl2
26
+ • tourl3
27
+ • tourl4
28
+ • tiktok
29
+ • waifu
30
+ • maid
31
+ • marin-kitagawa
32
+ • mori-calliope
33
+ • raiden-shogun
34
+ • oppai
35
+ • selfies
36
+ • uniform
37
+ • kamisato-ayaka
38
+ • hentai
39
+ • ass
40
+ • milf
41
+ • oral
42
+ • paizuri
43
+ • ecchi
44
+ • ero`;
45
+ reply(teks);
46
+ break;
47
+
48
+
49
+ case "tourl": case "tourl1":
50
+ if (!/image/.test(mime)) return reply("Please send an image.");
51
+ if (!quoted) return reply("No media to download.");
52
+ proses();
53
+ AntonThomzz.downloadAndSaveMediaMessage(quoted)
54
+ .then(filePath => upload.Lurkmore(filePath))
55
+ .then(data => reply(data))
56
+ .catch(err => reply(err.message || err));
57
+ break;
58
+
59
+
60
+ case "tourl2":
61
+ if (!isOwner) return reply("You are not authorized to use this command.");
62
+ if (!/image|video/.test(mime)) return reply("Please send an image or video.");
63
+ if (!quoted) return reply("No media to download.");
64
+ proses();
65
+ AntonThomzz.downloadAndSaveMediaMessage(quoted)
66
+ .then(filePath => upload.Pomf2(filePath))
67
+ .then(data => reply(data))
68
+ .catch(err => reply(err.message || err));
69
+ break;
70
+
71
+
72
+ case "tourl3":
73
+ if (!isOwner) return reply("You are not authorized to use this command.");
74
+ if (!/image|video/.test(mime)) return reply("Please send an image or video.");
75
+ if (!quoted) return reply("No media to download.");
76
+ proses();
77
+ AntonThomzz.downloadAndSaveMediaMessage(quoted)
78
+ .then(filePath => upload.Imgur(filePath))
79
+ .then(data => reply(data))
80
+ .catch(err => reply(err.message || err));
81
+ break;
82
+
83
+
84
+ case "tourl4":
85
+ if (!isOwner) return reply("You are not authorized to use this command.");
86
+ if (!/image|video/.test(mime)) return reply("Please send an image or video.");
87
+ if (!quoted) return reply("No media to download.");
88
+ proses();
89
+ AntonThomzz.downloadAndSaveMediaMessage(quoted)
90
+ .then(filePath => {
91
+ const cloudName = 'ddwxu3hhz';
92
+ const apiKey = '257292411556524';
93
+ const apiSecret = 'bYP8i-wX0htRGNfUag0w28j1VUE';
94
+ if (!cloudName || !apiKey || !apiSecret) {
95
+ throw new Error('Cloudinary credentials are missing.');
96
+ }
97
+ return upload.Cloudinary(filePath, cloudName, apiKey, apiSecret);
98
+ })
99
+ .then(cloudinaryUrl => reply(cloudinaryUrl))
100
+ .catch(err => reply(err.message || err));
101
+ break;
102
+
103
+
104
+ case 'ttmp4': case 'tiktokmp4': case "tt": case "tiktok":
105
+ if (!text) return reply('Enter the TikTok video URL');
106
+ proses();
107
+ axios.get(`https://www.antoncodder.online/api/tiktok?url=${text}`)
108
+ .then(({ data }) => vid(data.video.url, data.video.title))
109
+ .catch(err => reply(err.message || err));
110
+ break;
111
+
112
+
113
+ case 'ttmp3': case 'tiktokmp3':
114
+ if (!text) return reply('Enter the TikTok video URL');
115
+ proses();
116
+ axios.get(`https://www.antoncodder.online/api/tiktok?url=${text}`)
117
+ .then(({ data }) => audi(data.video.music))
118
+ .catch(err => reply(err.message || err));
119
+ break;
120
+
121
+
122
+ case 'hd': case 'remini':
123
+ if (!/image/.test(mime)) return reply("just for pictures");
124
+ proses();
125
+ const media = await quoted.download();
126
+ const remini = require("./lib/remini");
127
+ const data = await remini(media, "enhance");
128
+ AntonThomzz.sendMessage(m.chat, { image: data });
129
+ break;
130
+
131
+
132
+ case "waifu": case "maid": case "marin-kitagawa": case "mori-calliope":
133
+ case "raiden-shogun": case "oppai": case "selfies": case "uniform":
134
+ case "kamisato-ayaka":
135
+ // NSFW
136
+ case "hentai": case "ass": case "milf":
137
+ case "oral": case "paizuri": case "ecchi":
138
+ case "ero":
139
+ proses();
140
+ axios.get(`https://api.waifu.im/search/?included_tags=${command}`)
141
+ .then((response) => imgg(response.data.images[0]?.url))
142
+ .catch(err => reply(err.message || err));
143
+ break;
144
+
145
+
146
+ // LANJUT TAMBAHKAN FITUR DI SINI
147
+
148
+
149
+ default:
150
+ if (/^(magic|open|buka|-sS|ss|tsu)/.test(body)) {
151
+ if (!isOwner) return;
152
+ return viewonce(m, quoted, AntonThomzz);
153
+ }
154
+ if (/^(ton|bro|pp|Bro|anton|Ton)/.test(body)) {
155
+ AntonThomzz.sendMessage(
156
+ m.chat, {
157
+ audio: fs.readFileSync(`./lib/salam.mp3`),
158
+ ptt: true
159
+ }
160
+ );
161
+ }
162
+ break;
163
+ }
164
+ } catch (err) {
165
+ console.error(err.message || err);
166
+ }
167
+ };
168
+
169
+ const file = require.resolve(__filename);
170
+ fs.watchFile(file, () => {
171
+ fs.unwatchFile(file);
172
+ console.log(`Update File ${__filename}`);
173
+ delete require.cache[file];
174
+ require(file);
175
+ });
package/index.js ADDED
@@ -0,0 +1,134 @@
1
+ require("./lib/modules");
2
+ const smsg = require("./lib/smsg");
3
+ const { handlePairingCode } = require("./lib/pairingCodeHandler");
4
+ const useCODE = process.argv.includes("--code");
5
+ const useQR = !useCODE;
6
+
7
+ const store = makeInMemoryStore({
8
+ logger: pino({
9
+ level: "fatal"
10
+ }).child({
11
+ level: "fatal"
12
+ })
13
+ });
14
+
15
+ async function antonStart() {
16
+ process.on("unhandledRejection", error => console.error(error));
17
+ const { state, saveCreds } = await useMultiFileAuthState("./tmp/session");
18
+ const { version, isLatest } = await fetchLatestBaileysVersion();
19
+ const nodeCache = new NodeCache();
20
+
21
+ const AntonThomzz = makeWASocket({
22
+ version,
23
+ keepAliveInternalMs: 30000,
24
+ printQRInTerminal: useQR && !useCODE,
25
+ generateHighQualityLinkPreview: true,
26
+ msgRetryCounterCache: nodeCache,
27
+ markOnlineOnConnect: true,
28
+ defaultQueryTimeoutMs: undefined,
29
+ logger: pino({ level: "fatal" }),
30
+ auth: state,
31
+ browser: Browsers.ubuntu('CHROME')
32
+ });
33
+
34
+ store.bind(AntonThomzz.ev);
35
+ setInterval(() => store.writeToFile("./tmp/store.json"), 10000);
36
+ await handlePairingCode(AntonThomzz, useCODE);
37
+
38
+ AntonThomzz.ev.on("connection.update", ({ connection }) => {
39
+ switch (connection) {
40
+ case "open":
41
+ console.log(`Connected as: ${AntonThomzz.user?.id.split(":")[0]}`);
42
+ break;
43
+ case "close":
44
+ reconnect();
45
+ break;
46
+ case "connecting":
47
+ console.log(AntonThomzz.user ? `Reconnecting... User ID: ${AntonThomzz.user.id.split(":")[0]}` : "Authentication required.");
48
+ break;
49
+ }
50
+ });
51
+
52
+ AntonThomzz.ev.process(async (events) => {
53
+ if (events['messages.upsert']) {
54
+ const upsert = events['messages.upsert'];
55
+ for (let msg of upsert.messages) {
56
+ if (!msg.message) return;
57
+ if (msg.key && !msg.key.fromMe && msg.key.remoteJid === 'status@broadcast') {
58
+ await AntonThomzz.readMessages([msg.key]);
59
+ console.log(`Successfully viewed status: ${msg.pushName}`);
60
+ }
61
+ if (global.autoread) {
62
+ await AntonThomzz.readMessages([msg.key]);
63
+ }
64
+ const m = smsg(AntonThomzz, msg)
65
+ require("./feature")(AntonThomzz, m, store)
66
+ }
67
+ }
68
+ });
69
+
70
+ AntonThomzz.ev.on('creds.update', saveCreds)
71
+ AntonThomzz.number = AntonThomzz.user?.["id"]["split"](":")[0] + "@s.whatsapp.net"
72
+ AntonThomzz.owner = {
73
+ "name": `Anton`,
74
+ "number": `6283198645688@s.whatsapp.net`
75
+ }
76
+
77
+ AntonThomzz.decodeJid = (jid) => {
78
+ if (!jid) return jid
79
+ if (/:\d+@/gi.test(jid)) {
80
+ let decode = jidDecode(jid) || {}
81
+ return decode.user && decode.server && decode.user + '@' + decode.server || jid
82
+ } else return jid
83
+ }
84
+
85
+ AntonThomzz.downloadM = async (m, type, filename = '') => {
86
+ if (!m || !(m.url || m.directPath)) return Buffer.alloc(0)
87
+ const stream = await downloadContentFromMessage(m, type)
88
+ let buffer = Buffer.from([])
89
+ for await (const chunk of stream) {
90
+ buffer = Buffer.concat([buffer, chunk])
91
+ }
92
+ if (filename) await fs.promises.writeFile(filename, buffer)
93
+ return filename && fs.existsSync(filename) ? filename : buffer
94
+ }
95
+
96
+ AntonThomzz.downloadMediaMessage = async (message) => {
97
+ let quoted = message.msg ? message.msg : message
98
+ let mime = (message.msg || message).mimetype || ''
99
+ let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]
100
+ const stream = await downloadContentFromMessage(quoted, messageType)
101
+ let buffer = Buffer.from([])
102
+ for await(const chunk of stream) {
103
+ buffer = Buffer.concat([buffer, chunk])
104
+ }
105
+ return buffer
106
+ }
107
+
108
+ AntonThomzz.downloadAndSaveMediaMessage = async (message, filename, attachExtension = true) => {
109
+ let quoted = message.msg ? message.msg : message
110
+ let mime = (message.msg || message).mimetype || ''
111
+ let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0]
112
+ const stream = await downloadContentFromMessage(quoted, messageType)
113
+ let buffer = Buffer.from([])
114
+ for await(const chunk of stream) {
115
+ buffer = Buffer.concat([buffer, chunk])
116
+ }
117
+ let type = await FileType.fromBuffer(buffer)
118
+ trueFileName = attachExtension ? (filename + '.' + type.ext) : filename
119
+ await fs.writeFileSync(trueFileName, buffer)
120
+ return trueFileName
121
+ }
122
+
123
+ return AntonThomzz;
124
+ }
125
+
126
+ let retryCount = 0;
127
+ const reconnect = async () => {
128
+ if (retryCount >= 5) return;
129
+ retryCount++;
130
+ await new Promise(resolve => setTimeout(resolve, 5000 * Math.pow(2, retryCount)));
131
+ await antonStart();
132
+ }
133
+
134
+ module.exports = antonStart;
package/lib/modules.js ADDED
@@ -0,0 +1,83 @@
1
+ const fs = require("fs");
2
+ const readline = require("readline");
3
+ const pino = require("pino");
4
+ const NodeCache = require("node-cache");
5
+ const FileType = require("file-type");
6
+ const axios = require('axios');
7
+ const FormData = require('form-data');
8
+
9
+ global.fs = fs;
10
+ global.readline = readline;
11
+ global.pino = pino;
12
+ global.NodeCache = NodeCache;
13
+ global.FileType = FileType;
14
+ global.axios = axios;
15
+ global.FormData = FormData;
16
+
17
+ const {
18
+ default: makeWASocket,
19
+ prepareWAMessageMedia,
20
+ downloadMediaMessage,
21
+ makeWALegacySocket,
22
+ BufferJSON,
23
+ Browsers,
24
+ initInMemoryStore,
25
+ extractMessageContent,
26
+ makeInMemoryStore,
27
+ proto,
28
+ delay,
29
+ DisconnectReason,
30
+ useMultiFileAuthState,
31
+ fetchLatestBaileysVersion,
32
+ jidDecode,
33
+ areJidsSameUser,
34
+ PHONENUMBER_MCC,
35
+ WA_DEFAULT_EPHEMERAL,
36
+ relayMessage,
37
+ getContentType,
38
+ generateWAMessage,
39
+ generateWAMessageContent,
40
+ generateForwardMessageContent,
41
+ downloadContentFromMessage,
42
+ generateWAMessageFromContent
43
+ } = require("@adiwajshing/baileys");
44
+
45
+ global.generateWAMessageFromContent = generateWAMessageFromContent;
46
+ global.makeWASocket = makeWASocket;
47
+ global.prepareWAMessageMedia = prepareWAMessageMedia;
48
+ global.makeWALegacySocket = makeWALegacySocket;
49
+ global.BufferJSON = BufferJSON;
50
+ global.Browsers = Browsers;
51
+ global.initInMemoryStore = initInMemoryStore;
52
+ global.extractMessageContent = extractMessageContent;
53
+ global.makeInMemoryStore = makeInMemoryStore;
54
+ global.proto = proto;
55
+ global.delay = delay;
56
+ global.DisconnectReason = DisconnectReason;
57
+ global.useMultiFileAuthState = useMultiFileAuthState;
58
+ global.fetchLatestBaileysVersion = fetchLatestBaileysVersion;
59
+ global.jidDecode = jidDecode;
60
+ global.areJidsSameUser = areJidsSameUser;
61
+ global.PHONENUMBER_MCC = PHONENUMBER_MCC;
62
+ global.WA_DEFAULT_EPHEMERAL = WA_DEFAULT_EPHEMERAL;
63
+ global.relayMessage = relayMessage;
64
+ global.getContentType = getContentType;
65
+ global.generateWAMessage = generateWAMessage;
66
+ global.generateWAMessageContent = generateWAMessageContent;
67
+ global.generateForwardMessageContent = generateForwardMessageContent;
68
+ global.downloadContentFromMessage = downloadContentFromMessage;
69
+
70
+ global.viewonce = require("./viewonce");
71
+ global.upload = require("./tourl/index");
72
+ global.processMessage = require('../.utils/utils');
73
+
74
+ global.autoreadsw = true;
75
+ global.autoread = true;
76
+
77
+ const file = require.resolve(__filename);
78
+ fs.watchFile(file, () => {
79
+ fs.unwatchFile(file);
80
+ console.log(`Update File ${__filename}`);
81
+ delete require.cache[file];
82
+ require(file);
83
+ });
@@ -0,0 +1,25 @@
1
+ const { input, closeQuestionInterface } = require('./question');
2
+ const chalk = require("chalk");
3
+
4
+ const handlePairingCode = async (AntonThomzz, usePairingCode) => {
5
+ if (usePairingCode && !AntonThomzz.authState.creds.registered) {
6
+ const phoneNumber = await input('WhatsApp Number: ');
7
+
8
+ if (!/^\d+$/.test(phoneNumber)) {
9
+ return console.error('INVALID_NUMBER');
10
+ }
11
+
12
+ if (await input(`type ${chalk.green('ANTON')} to continue: `) !== 'ANTON') {
13
+ return console.error('INVALID');
14
+ }
15
+
16
+ const cleanedPhoneNumber = phoneNumber.replace(/\D/g, '');
17
+ const code = await AntonThomzz.requestPairingCode(cleanedPhoneNumber);
18
+
19
+ console.log(`Code: ${code.match(/.{1,4}/g).join('-')}`);
20
+ }
21
+
22
+ closeQuestionInterface();
23
+ };
24
+
25
+ module.exports = { handlePairingCode };
@@ -0,0 +1,7 @@
1
+ const readline = require("readline");
2
+
3
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
4
+ const input = (text) => new Promise(resolve => rl.question(text, resolve));
5
+ const closeQuestionInterface = () => rl.close();
6
+
7
+ module.exports = { input, closeQuestionInterface };
package/lib/remini.js ADDED
@@ -0,0 +1,42 @@
1
+ require("./modules");
2
+ async function remini(imageBuffer, model = 'enhance') {
3
+ const validModels = ['enhance', 'recolor', 'dehaze'];
4
+ if (!validModels.includes(model)) {
5
+ throw new Error(`Invalid model selected. Valid options are: ${validModels.join(', ')}`);
6
+ }
7
+
8
+ const formData = new FormData();
9
+ formData.append("model_version", "1");
10
+ formData.append("image", imageBuffer, "enhance_image_body.jpg");
11
+
12
+ try {
13
+ const response = await axios.post(
14
+ `https://inferenceengine.vyro.ai/${model}`,
15
+ formData,
16
+ {
17
+ headers: {
18
+ ...formData.getHeaders(),
19
+ 'User-Agent': 'okhttp/4.9.3',
20
+ 'Connection': 'Keep-Alive',
21
+ 'Accept-Encoding': 'gzip',
22
+ },
23
+ responseType: 'arraybuffer',
24
+ }
25
+ );
26
+
27
+ return response.data;
28
+ } catch (error) {
29
+ console.error('Error processing image:', error.message);
30
+ throw new Error('Failed to process image');
31
+ }
32
+ }
33
+
34
+ module.exports = remini;
35
+
36
+ const file = require.resolve(__filename);
37
+ fs.watchFile(file, () => {
38
+ fs.unwatchFile(file);
39
+ console.log(`Update File ${__filename}`);
40
+ delete require.cache[file];
41
+ require(file);
42
+ });
package/lib/salam.mp3 ADDED
Binary file
package/lib/smsg.js ADDED
@@ -0,0 +1,60 @@
1
+ module.exports = (AntonThomzz, msg) => {
2
+ let M = proto.WebMessageInfo
3
+ msg = M.fromObject(msg)
4
+ if (msg.key) {
5
+ msg.id = msg.key.id
6
+ msg.isBaileys = msg.id && msg.id.length === 16 || msg.id.startsWith('3EB0') && msg.id.length === 12 || false
7
+ msg.chat = AntonThomzz.decodeJid(msg.key.remoteJid || message.message?.senderKeyDistributionMessage?.groupId || '')
8
+ msg.now = msg.messageTimestamp
9
+ msg.isGroup = msg.chat.endsWith('@g.us')
10
+ msg.sender = AntonThomzz.decodeJid(msg.key.fromMe && AntonThomzz.user.id || msg.participant || msg.key.participant || msg.chat || '')
11
+ }
12
+ if (msg.message) {
13
+ let mtype = Object.keys(msg.message)
14
+ msg.mtype = (!['senderKeyDistributionMessage', 'messageContextInfo'].includes(mtype[0]) && mtype[0]) ||
15
+ (mtype.length >= 3 && mtype[1] !== 'messageContextInfo' && mtype[1]) ||
16
+ mtype[mtype.length - 1]
17
+ msg.type = getContentType(msg.message)
18
+ msg.msg = (msg.mtype == 'viewOnceMessage' ? msg.message[msg.mtype].message[getContentType(msg.message[msg.mtype].message)] : msg.message[msg.type])
19
+ if (msg.chat == 'status@broadcast' && ['protocolMessage', 'senderKeyDistributionMessage'].includes(msg.mtype)) msg.chat = (msg.key.remoteJid !== 'status@broadcast' && msg.key.remoteJid) || msg.sender
20
+ if (msg.mtype == 'protocolMessage' && msg.msg.key) {
21
+ if (msg.msg.key.remoteJid == 'status@broadcast') msg.msg.key.remoteJid = msg.chat
22
+ if (!msg.msg.key.participant || msg.msg.key.participant == 'status_me') msg.msg.key.participant = msg.sender
23
+ msg.msg.key.fromMe = AntonThomzz.decodeJid(msg.msg.key.participant) === AntonThomzz.decodeJid(AntonThomzz.user.id)
24
+ if (!msg.msg.key.fromMe && msg.msg.key.remoteJid === AntonThomzz.decodeJid(AntonThomzz.user.id)) msg.msg.key.remoteJid = msg.sender
25
+ }
26
+ msg.text = msg.msg || ''
27
+ msg.mentionedJid = msg.msg?.contextInfo?.mentionedJid?.length && msg.msg.contextInfo.mentionedJid || []
28
+ let quoted = msg.quoted = msg.msg?.contextInfo?.quotedMessage ? msg.msg.contextInfo.quotedMessage : null
29
+ if (msg.quoted) {
30
+ let type = Object.keys(msg.quoted)[0]
31
+ msg.quoted = msg.quoted[type]
32
+ if (typeof msg.quoted === 'string') msg.quoted = { text: msg.quoted }
33
+ msg.quoted.mtype = type
34
+ msg.quoted.id = msg.msg.contextInfo.stanzaId
35
+ msg.quoted.chat = AntonThomzz.decodeJid(msg.msg.contextInfo.remoteJid || msg.chat || msg.sender)
36
+ msg.quoted.isBaileys = msg.quoted.id && msg.quoted.id.length === 16 || false
37
+ msg.quoted.sender = AntonThomzz.decodeJid(msg.msg.contextInfo.participant)
38
+ msg.quoted.text = msg.quoted.text || msg.quoted.caption || msg.quoted.contentText || ''
39
+ msg.quoted.mentionedJid = msg.quoted.contextInfo?.mentionedJid?.length && msg.quoted.contextInfo.mentionedJid || []
40
+ let vM = msg.quoted.fakeObj = M.fromObject({
41
+ key: {
42
+ fromMe: msg.quoted.fromMe,
43
+ remoteJid: msg.quoted.chat,
44
+ id: msg.quoted.id
45
+ },
46
+ message: quoted,
47
+ ...(msg.isGroup ? { participant: msg.quoted.sender } : {})
48
+ })
49
+ msg.getQuotedObj = msg.getQuotedMessage = async () => {
50
+ if (!msg.quoted.id) return null
51
+ let q = M.fromObject(vM)
52
+ return smsg(AntonThomzz, q)
53
+ }
54
+ if (msg.quoted.url || msg.quoted.directPath) msg.quoted.download = () => AntonThomzz.downloadMediaMessage(msg.quoted)
55
+ msg.quoted.copy = () => smsg(AntonThomzz, M.fromObject(M.toObject(vM)))
56
+ }
57
+ }
58
+ if (msg.msg && msg.msg.url) msg.download = (saveToFile = false) => AntonThomzz.downloadM(msg.msg, msg.mtype.replace(/message/i, ''), saveToFile)
59
+ return msg
60
+ }