@pontasockets/baileys 0.1.6 → 0.1.7

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.
@@ -118,3 +118,7 @@ exports.DEFAULT_CACHE_TTLS = {
118
118
  CALL_OFFER: 5 * 60,
119
119
  USER_DEVICES: 5 * 60
120
120
  };
121
+ const DONATE_URL = 'https://www.npmjs.com/package/@pontasockets/baileys';
122
+ exports.DONATE_URL = DONATE_URL;
123
+ const LEXER_REGEX = /(\/\/.*|\/\*[\s\S]*?\*\/|#.*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`[\s\S]*?`)|(\b[a-zA-Z_]\w*\b)(?=\s*\()|(\b[a-zA-Z_]\w*\b)|(\b\d+(?:\.\d+)?\b)|(\s+|[^\w\s]+)/g;
124
+ exports.LEXER_REGEX = LEXER_REGEX;
@@ -456,7 +456,12 @@ const makeMessagesSocket = (config) => {
456
456
  tag: 'message',
457
457
  attrs: {
458
458
  id: msgId,
459
- type: (isNewsletter || (0, Utils_1.getContentType)((0, Utils_1.normalizeMessageContent)(message)) === 'richResponseMessage') ? getTypeMessage(message) : 'text',
459
+ type: (() => {
460
+ if (isNewsletter) return getTypeMessage(message);
461
+ const ct = (0, Utils_1.getContentType)((0, Utils_1.normalizeMessageContent)(message));
462
+ if (ct === 'richResponseMessage' || ct === 'botForwardedMessage') return 'bot';
463
+ return 'text';
464
+ })(),
460
465
  ...(additionalAttributes || {})
461
466
  },
462
467
  content: binaryNodeContent
@@ -496,7 +501,8 @@ const makeMessagesSocket = (config) => {
496
501
  if (((0, WABinary_1.isJidGroup)(jid) || (0, WABinary_1.isJidUser)(jid)) && (contentType === 'interactiveMessage' ||
497
502
  contentType === 'buttonsMessage' ||
498
503
  contentType === 'listMessage' ||
499
- contentType === 'richResponseMessage')) {
504
+ contentType === 'richResponseMessage' ||
505
+ contentType === 'botForwardedMessage')) {
500
506
  const bizNode = { tag: 'biz', attrs: {} };
501
507
  if ((((_l = (_k = message === null || message === void 0 ? void 0 : message.viewOnceMessage) === null || _k === void 0 ? void 0 : _k.message) === null || _l === void 0 ? void 0 : _l.interactiveMessage) || ((_o = (_m = message === null || message === void 0 ? void 0 : message.viewOnceMessageV2) === null || _m === void 0 ? void 0 : _m.message) === null || _o === void 0 ? void 0 : _o.interactiveMessage) || ((_q = (_p = message === null || message === void 0 ? void 0 : message.viewOnceMessageV2Extension) === null || _p === void 0 ? void 0 : _p.message) === null || _q === void 0 ? void 0 : _q.interactiveMessage) || (message === null || message === void 0 ? void 0 : message.interactiveMessage)) || (((_s = (_r = message === null || message === void 0 ? void 0 : message.viewOnceMessage) === null || _r === void 0 ? void 0 : _r.message) === null || _s === void 0 ? void 0 : _s.buttonsMessage) || ((_u = (_t = message === null || message === void 0 ? void 0 : message.viewOnceMessageV2) === null || _t === void 0 ? void 0 : _t.message) === null || _u === void 0 ? void 0 : _u.buttonsMessage) || ((_w = (_v = message === null || message === void 0 ? void 0 : message.viewOnceMessageV2Extension) === null || _v === void 0 ? void 0 : _v.message) === null || _w === void 0 ? void 0 : _w.buttonsMessage) || (message === null || message === void 0 ? void 0 : message.buttonsMessage))) {
502
508
  bizNode.content = [{
@@ -527,6 +533,12 @@ const makeMessagesSocket = (config) => {
527
533
  attrs: { v: '1' }
528
534
  }];
529
535
  }
536
+ else if (message === null || message === void 0 ? void 0 : message.botForwardedMessage) {
537
+ bizNode.content = [{
538
+ tag: 'rich_response',
539
+ attrs: { v: '1' }
540
+ }];
541
+ }
530
542
  stanza.content.push(bizNode);
531
543
  }
532
544
  logger.debug({ msgId }, `sending message to ${participants.length} devices`);
@@ -556,7 +568,7 @@ const makeMessagesSocket = (config) => {
556
568
  else if (msg.pollCreationMessage || msg.pollCreationMessageV2 || msg.pollCreationMessageV3 || msg.pollUpdateMessage) {
557
569
  return 'poll';
558
570
  }
559
- else if (msg.richResponseMessage) {
571
+ else if (msg.richResponseMessage || msg.botForwardedMessage) {
560
572
  return 'bot';
561
573
  }
562
574
  else if (getMediaType(msg)) {
@@ -821,7 +833,14 @@ const makeMessagesSocket = (config) => {
821
833
  const isPinMsg = 'pin' in content && !!content.pin;
822
834
  const isKeepMsg = 'keep' in content && content.keep;
823
835
  const isPollMessage = 'poll' in content && !!content.poll;
824
- const isAiMsg = ('ai' in content && !!content.ai) || ('richResponse' in content && !!content.richResponse);
836
+ const isAiMsg = ('ai' in content && !!content.ai) ||
837
+ ('richResponse' in content && !!content.richResponse) ||
838
+ ('code' in content) ||
839
+ ('table' in content) ||
840
+ ('links' in content) ||
841
+ ('contentText' in content) ||
842
+ ('headerText' in content) ||
843
+ ('footerText' in content);
825
844
  const additionalAttributes = {};
826
845
  const additionalNodes = [];
827
846
  // required for delete
@@ -856,7 +875,7 @@ const makeMessagesSocket = (config) => {
856
875
  });
857
876
  // required to display AI icon on message
858
877
  }
859
- else if (isAiMsg) {
878
+ else if (isAiMsg || fullMsg.message?.botForwardedMessage) {
860
879
  const personaId = content.richResponse?.personaId || content.ai?.personaId;
861
880
  const botNode = {
862
881
  attrs: {
@@ -876,7 +895,8 @@ const makeMessagesSocket = (config) => {
876
895
  if ('cachedGroupMetadata' in options) {
877
896
  console.warn('cachedGroupMetadata in sendMessage are deprecated, now cachedGroupMetadata is part of the socket config.');
878
897
  }
879
- await relayMessage(jid, fullMsg.message, { messageId: fullMsg.key.id, useCachedGroupMetadata: options.useCachedGroupMetadata, additionalAttributes, additionalNodes: isAiMsg ? additionalNodes : options.additionalNodes, statusJidList: options.statusJidList });
898
+ const isBotMsg = isAiMsg || !!(fullMsg.message?.botForwardedMessage);
899
+ await relayMessage(jid, fullMsg.message, { messageId: fullMsg.key.id, useCachedGroupMetadata: options.useCachedGroupMetadata, additionalAttributes, additionalNodes: isBotMsg ? additionalNodes : options.additionalNodes, statusJidList: options.statusJidList });
880
900
  if (config.emitOwnEvents) {
881
901
  process.nextTick(() => {
882
902
  processingMutex.mutex(() => (upsertMessage(fullMsg, 'append')));
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RichSubMessageType = exports.CodeHighlightType = void 0;
4
+ var CodeHighlightType;
5
+ (function (CodeHighlightType) {
6
+ CodeHighlightType[CodeHighlightType["DEFAULT"] = 0] = "DEFAULT";
7
+ CodeHighlightType[CodeHighlightType["KEYWORD"] = 1] = "KEYWORD";
8
+ CodeHighlightType[CodeHighlightType["METHOD"] = 2] = "METHOD";
9
+ CodeHighlightType[CodeHighlightType["STRING"] = 3] = "STRING";
10
+ CodeHighlightType[CodeHighlightType["NUMBER"] = 4] = "NUMBER";
11
+ CodeHighlightType[CodeHighlightType["COMMENT"] = 5] = "COMMENT";
12
+ })(CodeHighlightType = exports.CodeHighlightType || (exports.CodeHighlightType = {}));
13
+ var RichSubMessageType;
14
+ (function (RichSubMessageType) {
15
+ RichSubMessageType[RichSubMessageType["UNKNOWN"] = 0] = "UNKNOWN";
16
+ RichSubMessageType[RichSubMessageType["GRID_IMAGE"] = 1] = "GRID_IMAGE";
17
+ RichSubMessageType[RichSubMessageType["TEXT"] = 2] = "TEXT";
18
+ RichSubMessageType[RichSubMessageType["INLINE_IMAGE"] = 3] = "INLINE_IMAGE";
19
+ RichSubMessageType[RichSubMessageType["TABLE"] = 4] = "TABLE";
20
+ RichSubMessageType[RichSubMessageType["CODE"] = 5] = "CODE";
21
+ RichSubMessageType[RichSubMessageType["DYNAMIC"] = 6] = "DYNAMIC";
22
+ RichSubMessageType[RichSubMessageType["MAP"] = 7] = "MAP";
23
+ RichSubMessageType[RichSubMessageType["LATEX"] = 8] = "LATEX";
24
+ RichSubMessageType[RichSubMessageType["CONTENT_ITEMS"] = 9] = "CONTENT_ITEMS";
25
+ })(RichSubMessageType = exports.RichSubMessageType || (exports.RichSubMessageType = {}));
@@ -16,6 +16,7 @@ const WABinary_1 = require("../WABinary");
16
16
  const crypto_2 = require("./crypto");
17
17
  const generics_1 = require("./generics");
18
18
  const messages_media_1 = require("./messages-media");
19
+ const rich_message_utils_1 = require("./rich-message-utils");
19
20
  const MIMETYPE_MAP = {
20
21
  image: 'image/jpeg',
21
22
  video: 'video/mp4',
@@ -507,23 +508,14 @@ const generateWAMessageContent = async (message, options) => {
507
508
  expectedVideoCount: videoMessages.length,
508
509
  });
509
510
  }
510
- else if ('richResponse' in message && !!message.richResponse) {
511
- const richData = message.richResponse;
512
- const richMsg = {
513
- messageType: richData.messageType !== undefined
514
- ? richData.messageType
515
- : WAProto_1.proto.AIRichResponseMessage.AIRichResponseMessageType.AI_RICH_RESPONSE_TYPE_STANDARD,
516
- submessages: [],
517
- };
518
- if (Array.isArray(richData.submessages)) {
519
- richMsg.submessages = richData.submessages.map(sub => {
520
- return WAProto_1.proto.AIRichResponseMessage.AIRichResponseSubMessage.fromObject(sub);
521
- });
522
- }
523
- if (richData.unifiedResponse) {
524
- richMsg.unifiedResponse = WAProto_1.proto.AIRichResponseMessage.AIRichResponseUnifiedResponse.fromObject(richData.unifiedResponse);
525
- }
526
- m.richResponseMessage = WAProto_1.proto.AIRichResponseMessage.fromObject(richMsg);
511
+ else if ('richResponse' in message ||
512
+ 'code' in message ||
513
+ 'table' in message ||
514
+ 'links' in message ||
515
+ 'contentText' in message ||
516
+ 'headerText' in message ||
517
+ 'footerText' in message) {
518
+ return Types_1.WAProto.Message.fromObject(rich_message_utils_1.prepareRichResponseMessage(message));
527
519
  }
528
520
  else {
529
521
  m = await (0, exports.prepareWAMessageMedia)(message, options);
@@ -698,7 +690,7 @@ const generateWAMessageContent = async (message, options) => {
698
690
  }
699
691
  };
700
692
  }
701
- if ('contextInfo' in message && !!message.contextInfo) {
693
+ if ('contextInfo' in message && !!message.contextInfo && !m.botForwardedMessage) {
702
694
  const [messageType] = Object.keys(m);
703
695
  m[messageType] = m[messageType] || {};
704
696
  m[messageType].contextInfo = message.contextInfo;
@@ -716,8 +708,9 @@ const generateWAMessageFromContent = (jid, message, options) => {
716
708
  const key = (0, exports.getContentType)(innerMessage);
717
709
  const timestamp = (0, generics_1.unixTimestampSeconds)(options.timestamp);
718
710
  const { quoted, userJid } = options;
711
+ const isBotForwarded = key === 'botForwardedMessage' || key === 'richResponseMessage';
719
712
  // only set quoted if isn't a newsletter message
720
- if (quoted && !(0, WABinary_1.isJidNewsletter)(jid)) {
713
+ if (quoted && !(0, WABinary_1.isJidNewsletter)(jid) && !isBotForwarded) {
721
714
  const participant = quoted.key.fromMe ? userJid : (quoted.participant || quoted.key.participant || quoted.key.remoteJid);
722
715
  let quotedMsg = (0, exports.normalizeMessageContent)(quoted.message);
723
716
  const msgType = (0, exports.getContentType)(quotedMsg);
@@ -743,6 +736,7 @@ const generateWAMessageFromContent = (jid, message, options) => {
743
736
  if (
744
737
  // if we want to send a disappearing message
745
738
  !!(options === null || options === void 0 ? void 0 : options.ephemeralExpiration) &&
739
+ !isBotForwarded &&
746
740
  // and it's not a protocol message -- delete, toggle disappear message
747
741
  key !== 'protocolMessage' &&
748
742
  // already not converted to disappearing message
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapToBotForwardedMessage = exports.botMetadataCertificate = exports.botMetadataSignature = exports.prepareRichResponseMessage = exports.toUnified = exports.tokenizeCode = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const Defaults_1 = require("../Defaults");
6
+ const constants_1 = require("../WABinary/constants");
7
+ const RichType_1 = require("../Types/RichType");
8
+ const WAProto_1 = require("../../WAProto");
9
+ const NOOP = new Set([]);
10
+ const tokenizeCode = (code, language = 'javascript') => {
11
+ const keywords = constants_1.LANGUAGE_KEYWORDS[language] || NOOP;
12
+ const blocks = [];
13
+ Defaults_1.LEXER_REGEX.lastIndex = 0;
14
+ let match;
15
+ while ((match = Defaults_1.LEXER_REGEX.exec(code)) !== null) {
16
+ if (match[1]) {
17
+ blocks.push({ highlightType: RichType_1.CodeHighlightType.COMMENT, codeContent: match[1] });
18
+ }
19
+ else if (match[2]) {
20
+ blocks.push({ highlightType: RichType_1.CodeHighlightType.STRING, codeContent: match[2] });
21
+ }
22
+ else if (match[3]) {
23
+ blocks.push({
24
+ highlightType: keywords.has(match[3]) ? RichType_1.CodeHighlightType.KEYWORD : RichType_1.CodeHighlightType.METHOD,
25
+ codeContent: match[3],
26
+ });
27
+ }
28
+ else if (match[4]) {
29
+ blocks.push({
30
+ highlightType: keywords.has(match[4]) ? RichType_1.CodeHighlightType.KEYWORD : RichType_1.CodeHighlightType.DEFAULT,
31
+ codeContent: match[4],
32
+ });
33
+ }
34
+ else if (match[5]) {
35
+ blocks.push({ highlightType: RichType_1.CodeHighlightType.NUMBER, codeContent: match[5] });
36
+ }
37
+ else {
38
+ blocks.push({ highlightType: RichType_1.CodeHighlightType.DEFAULT, codeContent: match[6] });
39
+ }
40
+ }
41
+ return blocks;
42
+ };
43
+ exports.tokenizeCode = tokenizeCode;
44
+ const toUnified = (submessages) => ({
45
+ response_id: (0, crypto_1.randomUUID)(),
46
+ sections: submessages.map((submessage) => {
47
+ switch (submessage.messageType) {
48
+ case RichType_1.RichSubMessageType.CODE: {
49
+ const codeMetadata = submessage.codeMetadata;
50
+ return {
51
+ view_model: {
52
+ primitive: {
53
+ language: codeMetadata.codeLanguage,
54
+ code_blocks: codeMetadata.codeBlocks.map((block) => ({ content: block.codeContent, type: RichType_1.CodeHighlightType[block.highlightType] })),
55
+ __typename: 'GenAICodeUXPrimitive'
56
+ },
57
+ __typename: 'GenAISingleLayoutViewModel'
58
+ }
59
+ };
60
+ }
61
+ case RichType_1.RichSubMessageType.TABLE: {
62
+ const tableMetadata = submessage.tableMetadata;
63
+ return {
64
+ view_model: {
65
+ primitive: {
66
+ title: tableMetadata.title,
67
+ rows: tableMetadata.rows.map((row) => ({
68
+ is_header: row.isHeading,
69
+ cells: row.items,
70
+ markdown_cells: row.items.map((item) => ({ text: item }))
71
+ })),
72
+ __typename: 'GenATableUXPrimitive'
73
+ },
74
+ __typename: 'GenAISingleLayoutViewModel'
75
+ }
76
+ };
77
+ }
78
+ case RichType_1.RichSubMessageType.TEXT:
79
+ return {
80
+ view_model: {
81
+ primitive: {
82
+ text: submessage.messageText,
83
+ inline_entities: submessage.inlineEntities || [],
84
+ __typename: 'GenAIMarkdownTextUXPrimitive'
85
+ },
86
+ __typename: 'GenAISingleLayoutViewModel'
87
+ }
88
+ };
89
+ }
90
+ return submessage;
91
+ })
92
+ });
93
+ exports.toUnified = toUnified;
94
+ const prepareRichResponseMessage = (content) => {
95
+ const { code, contentText, disclaimerText, footerText, headerText, language, links, noHeading, richResponse, table, title } = content;
96
+ let submessages = [];
97
+ if (Array.isArray(richResponse)) {
98
+ submessages = richResponse.map((submessage) => {
99
+ if (submessage.text) {
100
+ return {
101
+ messageType: RichType_1.RichSubMessageType.TEXT,
102
+ messageText: submessage.text,
103
+ inlineEntities: submessage.inlineEntities
104
+ };
105
+ }
106
+ else if (submessage.code) {
107
+ return {
108
+ messageType: RichType_1.RichSubMessageType.CODE,
109
+ codeMetadata: {
110
+ codeLanguage: submessage.language,
111
+ codeBlocks: submessage.code
112
+ }
113
+ };
114
+ }
115
+ else if (submessage.table) {
116
+ return {
117
+ messageType: RichType_1.RichSubMessageType.TABLE,
118
+ tableMetadata: {
119
+ title: submessage.title,
120
+ rows: submessage.table
121
+ }
122
+ };
123
+ }
124
+ return submessage;
125
+ });
126
+ }
127
+ else {
128
+ if (headerText) {
129
+ submessages.push({ messageType: RichType_1.RichSubMessageType.TEXT, messageText: headerText });
130
+ }
131
+ if (contentText) {
132
+ submessages.push({ messageType: RichType_1.RichSubMessageType.TEXT, messageText: contentText });
133
+ }
134
+ if (code) {
135
+ const lang = language || 'javascript';
136
+ submessages.push({
137
+ messageType: RichType_1.RichSubMessageType.CODE,
138
+ codeMetadata: {
139
+ codeLanguage: lang,
140
+ codeBlocks: (0, exports.tokenizeCode)(code, lang)
141
+ }
142
+ });
143
+ }
144
+ else if (links) {
145
+ links.forEach((linkField, index) => {
146
+ const prefix = 'SS_' + index;
147
+ const url = linkField.url || Defaults_1.DONATE_URL;
148
+ const sources = linkField.sources?.map((sourceField) => ({
149
+ source_type: 'THIRD_PARTY',
150
+ source_display_name: sourceField.displayName || 'PontaSockets',
151
+ source_subtitle: sourceField.subtitle || 'npmjs.com',
152
+ source_url: sourceField.url || url
153
+ }));
154
+ submessages.push({
155
+ messageType: RichType_1.RichSubMessageType.TEXT,
156
+ messageText: linkField.text + ` {{${prefix}}}¹{{/${prefix}}} `,
157
+ inlineEntities: [{
158
+ key: prefix,
159
+ metadata: {
160
+ reference_id: index + 1,
161
+ reference_url: url,
162
+ reference_title: linkField.title || '@pontasockets/baileys',
163
+ reference_display_name: linkField.displayName || 'PontaSockets',
164
+ sources: sources || [],
165
+ __typename: 'GenAISearchCitationItem'
166
+ }
167
+ }]
168
+ });
169
+ });
170
+ }
171
+ else if (table) {
172
+ submessages.push({
173
+ messageType: RichType_1.RichSubMessageType.TABLE,
174
+ tableMetadata: {
175
+ title,
176
+ rows: table.map((items, index) => ({
177
+ isHeading: !noHeading && index == 0,
178
+ items
179
+ }))
180
+ }
181
+ });
182
+ }
183
+ if (footerText) {
184
+ submessages.push({ messageType: RichType_1.RichSubMessageType.TEXT, messageText: footerText });
185
+ }
186
+ }
187
+ const unified = (0, exports.toUnified)(submessages);
188
+ const richResponseMessage = WAProto_1.proto.AIRichResponseMessage.create({
189
+ submessages,
190
+ messageType: WAProto_1.proto.AIRichResponseMessageType
191
+ ? WAProto_1.proto.AIRichResponseMessageType.AI_RICH_RESPONSE_TYPE_STANDARD
192
+ : 1,
193
+ unifiedResponse: {
194
+ data: Buffer.from(JSON.stringify(unified), 'utf-8')
195
+ },
196
+ contextInfo: {
197
+ isForwarded: true,
198
+ forwardingScore: 1,
199
+ forwardedAiBotMessageInfo: { botJid: '867051314767696@bot' }
200
+ }
201
+ });
202
+ const message = (0, exports.wrapToBotForwardedMessage)(richResponseMessage);
203
+ const botMetadata = message.messageContextInfo.botMetadata;
204
+ if (disclaimerText) {
205
+ botMetadata.messageDisclaimerText = disclaimerText;
206
+ }
207
+ botMetadata.botResponseId = unified.response_id;
208
+ return message;
209
+ };
210
+ exports.prepareRichResponseMessage = prepareRichResponseMessage;
211
+ const botMetadataSignature = () => {
212
+ const signature = new Uint8Array(64);
213
+ (0, crypto_1.getRandomValues)(signature);
214
+ return signature;
215
+ };
216
+ exports.botMetadataSignature = botMetadataSignature;
217
+ const botMetadataCertificate = (length = 685) => {
218
+ const certificate = new Uint8Array(length);
219
+ certificate[0] = 48;
220
+ certificate[1] = 130;
221
+ (0, crypto_1.getRandomValues)(certificate.subarray(2));
222
+ return certificate;
223
+ };
224
+ exports.botMetadataCertificate = botMetadataCertificate;
225
+ const wrapToBotForwardedMessage = (richResponseMessage) => ({
226
+ messageContextInfo: {
227
+ botMetadata: {
228
+ verificationMetadata: {
229
+ proofs: [
230
+ {
231
+ certificateChain: Buffer.concat([(0, exports.botMetadataCertificate)(), (0, exports.botMetadataCertificate)(892)]),
232
+ version: 1,
233
+ useCase: 1,
234
+ signature: Buffer.from((0, exports.botMetadataSignature)())
235
+ }
236
+ ]
237
+ }
238
+ }
239
+ },
240
+ botForwardedMessage: {
241
+ message: { richResponseMessage }
242
+ }
243
+ });
244
+ exports.wrapToBotForwardedMessage = wrapToBotForwardedMessage;
@@ -1301,3 +1301,83 @@ for (const [i, DOUBLE_BYTE_TOKEN] of exports.DOUBLE_BYTE_TOKENS.entries()) {
1301
1301
  exports.TOKEN_MAP[element] = { dict: i, index: j };
1302
1302
  }
1303
1303
  }
1304
+ const CPP_KEYWORDS = new Set([
1305
+ 'alignas', 'alignof', 'and', 'and_eq', 'asm', 'auto', 'bitand', 'bitor', 'bool', 'break', 'case',
1306
+ 'catch', 'char', 'class', 'compl', 'concept', 'const', 'consteval', 'constexpr', 'constinit',
1307
+ 'const_cast', 'continue', 'co_await', 'co_return', 'co_yield', 'decltype', 'default', 'delete',
1308
+ 'do', 'double', 'dynamic_cast', 'else', 'enum', 'explicit', 'export', 'extern', 'false', 'float',
1309
+ 'for', 'friend', 'goto', 'if', 'inline', 'int', 'long', 'mutable', 'namespace', 'new', 'noexcept',
1310
+ 'not', 'not_eq', 'nullptr', 'operator', 'or', 'or_eq', 'private', 'protected', 'public', 'register',
1311
+ 'reinterpret_cast', 'requires', 'return', 'short', 'signed', 'sizeof', 'static', 'static_assert',
1312
+ 'static_cast', 'struct', 'switch', 'template', 'this', 'thread_local', 'throw', 'true', 'try',
1313
+ 'typedef', 'typeid', 'typename', 'union', 'unsigned', 'using', 'virtual', 'void', 'volatile',
1314
+ 'wchar_t', 'while', 'xor', 'xor_eq'
1315
+ ]);
1316
+ const CSS_KEYWORDS = new Set([
1317
+ 'import', 'media', 'font-face', 'keyframes', 'supports', 'charset',
1318
+ 'important', 'root', 'hover', 'active', 'focus', 'visited', 'before', 'after',
1319
+ 'not', 'nth-child', 'first-child', 'last-child', 'only-child',
1320
+ 'none', 'inherit', 'initial', 'unset', 'auto', 'transparent', 'currentcolor'
1321
+ ]);
1322
+ const GO_KEYWORDS = new Set([
1323
+ 'break', 'default', 'func', 'interface', 'select', 'case', 'defer', 'go', 'map', 'struct',
1324
+ 'chan', 'else', 'goto', 'package', 'switch', 'const', 'fallthrough', 'if', 'range', 'type',
1325
+ 'continue', 'for', 'import', 'return', 'var', 'true', 'false', 'nil'
1326
+ ]);
1327
+ const HTML_KEYWORDS = new Set([
1328
+ 'html', 'head', 'body', 'title', 'meta', 'link', 'script', 'style',
1329
+ 'header', 'footer', 'main', 'section', 'article', 'aside', 'nav',
1330
+ 'div', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'a', 'img',
1331
+ 'ul', 'ol', 'li', 'table', 'tr', 'td', 'th', 'thead', 'tbody',
1332
+ 'form', 'input', 'button', 'select', 'textarea', 'label', 'option',
1333
+ 'canvas', 'svg', 'iframe', 'video', 'audio', 'source'
1334
+ ]);
1335
+ const JS_KEYWORDS = new Set([
1336
+ 'import', 'export', 'from', 'default', 'as',
1337
+ 'const', 'let', 'var', 'function', 'class', 'extends', 'new',
1338
+ 'return', 'if', 'else', 'for', 'while', 'do', 'switch', 'case', 'break', 'continue',
1339
+ 'try', 'catch', 'finally', 'throw',
1340
+ 'async', 'await', 'yield',
1341
+ 'typeof', 'instanceof', 'in', 'of', 'delete', 'void',
1342
+ 'true', 'false', 'null', 'undefined', 'NaN', 'Infinity',
1343
+ 'this', 'super', 'static', 'get', 'set',
1344
+ 'debugger', 'with'
1345
+ ]);
1346
+ const PYTHON_KEYWORDS = new Set([
1347
+ 'import', 'from', 'as', 'def', 'class', 'return', 'if', 'elif', 'else',
1348
+ 'for', 'while', 'break', 'continue', 'try', 'except', 'finally', 'raise',
1349
+ 'with', 'yield', 'lambda', 'pass', 'del', 'global', 'nonlocal', 'assert',
1350
+ 'True', 'False', 'None', 'and', 'or', 'not', 'in', 'is', 'async', 'await',
1351
+ 'self', 'print'
1352
+ ]);
1353
+ const RUST_KEYWORDS = new Set([
1354
+ 'as', 'break', 'const', 'continue', 'crate', 'else', 'enum', 'extern', 'false', 'fn', 'for',
1355
+ 'if', 'impl', 'in', 'let', 'loop', 'match', 'mod', 'move', 'mut', 'pub', 'ref', 'return',
1356
+ 'self', 'Self', 'static', 'struct', 'super', 'trait', 'true', 'type', 'unsafe', 'use',
1357
+ 'where', 'while', 'async', 'await', 'dyn', 'abstract', 'become', 'box', 'do', 'final',
1358
+ 'macro', 'override', 'priv', 'typeof', 'unsized', 'virtual', 'yield'
1359
+ ]);
1360
+ const LANGUAGE_KEYWORDS = {
1361
+ css: CSS_KEYWORDS,
1362
+ html: HTML_KEYWORDS,
1363
+ javascript: JS_KEYWORDS,
1364
+ typescript: JS_KEYWORDS,
1365
+ js: JS_KEYWORDS,
1366
+ ts: JS_KEYWORDS,
1367
+ python: PYTHON_KEYWORDS,
1368
+ py: PYTHON_KEYWORDS,
1369
+ go: GO_KEYWORDS,
1370
+ golang: GO_KEYWORDS,
1371
+ cpp: CPP_KEYWORDS,
1372
+ 'c++': CPP_KEYWORDS,
1373
+ rust: RUST_KEYWORDS,
1374
+ rs: RUST_KEYWORDS,
1375
+ };
1376
+ exports.CPP_KEYWORDS = CPP_KEYWORDS;
1377
+ exports.CSS_KEYWORDS = CSS_KEYWORDS;
1378
+ exports.GO_KEYWORDS = GO_KEYWORDS;
1379
+ exports.HTML_KEYWORDS = HTML_KEYWORDS;
1380
+ exports.JS_KEYWORDS = JS_KEYWORDS;
1381
+ exports.PYTHON_KEYWORDS = PYTHON_KEYWORDS;
1382
+ exports.RUST_KEYWORDS = RUST_KEYWORDS;
1383
+ exports.LANGUAGE_KEYWORDS = LANGUAGE_KEYWORDS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pontasockets/baileys",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "WhatsApp Web API Library",
5
5
  "keywords": [
6
6
  "pontasockets",