MCPcopy Index your code
hub / github.com/Maccoder3/MAC-MD / makeWASocket

Function makeWASocket

lib/simple.js:32–1249  ·  view source on GitHub ↗
(connectionOptions, options = {})

Source from the content-addressed store, hash-verified

30} = (await import('@whiskeysockets/baileys')).default
31
32export function makeWASocket(connectionOptions, options = {}) {
33 /**
34 * @type {import('@whiskeysockets/baileys').WASocket | import('@whiskeysockets/baileys').WALegacySocket}
35 */
36 let conn = (global.opts['legacy'] ? makeWALegacySocket : _makeWaSocket)(connectionOptions)
37
38 let sock = Object.defineProperties(conn, {
39 chats: {
40 value: { ...(options.chats || {}) },
41 writable: true,
42 },
43 decodeJid: {
44 value(jid) {
45 if (!jid || typeof jid !== 'string') return (!nullish(jid) && jid) || null
46 return jid.decodeJid()
47 },
48 },
49 logger: {
50 get() {
51 return {
52 info(...args) {
53 console.log(
54 chalk.bold.bgRgb(51, 204, 51)('INFO '),
55 `[${chalk.rgb(255, 255, 255)(new Date().toUTCString())}]:`,
56 chalk.cyan(format(...args))
57 )
58 },
59 error(...args) {
60 console.log(
61 chalk.bold.bgRgb(247, 38, 33)('ERROR '),
62 `[${chalk.rgb(255, 255, 255)(new Date().toUTCString())}]:`,
63 chalk.rgb(255, 38, 0)(format(...args))
64 )
65 },
66 warn(...args) {
67 console.log(
68 chalk.bold.bgRgb(255, 153, 0)('WARNING '),
69 `[${chalk.rgb(255, 255, 255)(new Date().toUTCString())}]:`,
70 chalk.redBright(format(...args))
71 )
72 },
73 trace(...args) {
74 console.log(
75 chalk.grey('TRACE '),
76 `[${chalk.rgb(255, 255, 255)(new Date().toUTCString())}]:`,
77 chalk.white(format(...args))
78 )
79 },
80 debug(...args) {
81 console.log(
82 chalk.bold.bgRgb(66, 167, 245)('DEBUG '),
83 `[${chalk.rgb(255, 255, 255)(new Date().toUTCString())}]:`,
84 chalk.white(format(...args))
85 )
86 },
87 }
88 },
89 enumerable: true,

Callers 1

connectToWAFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected