MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MD / handler

Function handler

plugins/setbio.js:101–204  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

99 usage: '.setbio <on|off|set|reset>',
100 ownerOnly: true,
101 async handler(sock, message, args, context) {
102 const chatId = context.chatId || message.key.remoteJid;
103 const action = args[0]?.toLowerCase();
104 try {
105 const autoBioSettings = await store.getSetting('global', 'autoBio') || { enabled: false, customBio: null };
106 if (!action) {
107 const quotes = await fetchQuotes();
108 return await sock.sendMessage(chatId, {
109 text: `*📝 AUTO BIO SETTINGS*\n\n` +
110 `*Status:* ${autoBioSettings.enabled ? '✅ Enabled' : '❌ Disabled'}\n` +
111 `*Custom Bio:* ${autoBioSettings.customBio ? 'Set' : 'Default'}\n` +
112 `*Quotes Loaded:* ${quotes.length}\n` +
113 `*Update Interval:* Every 10 minute\n\n` +
114 `*Commands:*\n` +
115 `• \`.setbio on\` - Enable auto bio\n` +
116 `• \`.setbio off\` - Disable auto bio\n` +
117 `• \`.setbio set <text>\` - Set custom bio\n` +
118 `• \`.setbio reset\` - Reset to default bio\n` +
119 `• \`.setbio preview\` - Preview random quote\n\n` +
120 `*Default Bio:*\n{quote}\n💎 MEGA-MD\n\n` +
121 `*Custom Bio:*\n${autoBioSettings.customBio || 'Not set'}\n\n` +
122 `*Note:* Use \`{quote}\` in custom bio to insert random quotes.\n\n` +
123 `*Sources:*\n• Famous Quotes\n• Motivational Quotes\n• Pickup Lines`
124 }, { quoted: message });
125 }
126 if (action === 'preview') {
127 const quotes = await fetchQuotes();
128 const randomQuote = getRandomQuote(quotes);
129 return await sock.sendMessage(chatId, {
130 text: `*📝 Preview Quote*\n\n${randomQuote}\n\n💎 MEGA-MD\n\n_This is how your bio will look with random quotes_`
131 }, { quoted: message });
132 }
133 if (action === 'on') {
134 if (autoBioSettings.enabled) {
135 return await sock.sendMessage(chatId, {
136 text: '⚠️ *Auto bio is already enabled*'
137 }, { quoted: message });
138 }
139 autoBioSettings.enabled = true;
140 await store.saveSetting('global', 'autoBio', autoBioSettings);
141 startAutoBio(sock);
142 return await sock.sendMessage(chatId, {
143 text: '✅ *Auto bio enabled!*\n\nYour bio will now update every 1 minute with random quotes from:\n• Islamic Quotes\n• Motivational Quotes\n• Pickup Lines'
144 }, { quoted: message });
145 }
146 if (action === 'off') {
147 if (!autoBioSettings.enabled) {
148 return await sock.sendMessage(chatId, {
149 text: '⚠️ *Auto bio is already disabled*'
150 }, { quoted: message });
151 }
152 autoBioSettings.enabled = false;
153 await store.saveSetting('global', 'autoBio', autoBioSettings);
154 stopAutoBio();
155 return await sock.sendMessage(chatId, {
156 text: '❌ *Auto bio disabled!*\n\nYour bio will no longer auto-update.'
157 }, { quoted: message });
158 }

Callers

nothing calls this directly

Calls 5

fetchQuotesFunction · 0.85
getRandomQuoteFunction · 0.85
startAutoBioFunction · 0.85
stopAutoBioFunction · 0.85
updateAutoBioFunction · 0.85

Tested by

no test coverage detected