MCPcopy Create free account
hub / github.com/Xchristech2/Zenitsu-Bot / piesCommand

Function piesCommand

commands/pies.js:15–36  ·  view source on GitHub ↗
(sock, chatId, message, args)

Source from the content-addressed store, hash-verified

13}
14
15async function piesCommand(sock, chatId, message, args) {
16 const sub = (args && args[0] ? args[0] : '').toLowerCase();
17 if (!sub) {
18 await sock.sendMessage(chatId, { text: `Usage: .pies <country>\nCountries: ${VALID_COUNTRIES.join(', ')}` }, { quoted: message });
19 return;
20 }
21 if (!VALID_COUNTRIES.includes(sub)) {
22 await sock.sendMessage(chatId, { text: `❌ Unsupported country: ${sub}. Try one of: ${VALID_COUNTRIES.join(', ')}` }, { quoted: message });
23 return;
24 }
25 try {
26 const imageBuffer = await fetchPiesImageBuffer(sub);
27 await sock.sendMessage(
28 chatId,
29 { image: imageBuffer, caption: `pies: ${sub}` },
30 { quoted: message }
31 );
32 } catch (err) {
33 console.error('Error in pies command:', err);
34 await sock.sendMessage(chatId, { text: '❌ Failed to fetch image. Please try again.' }, { quoted: message });
35 }
36}
37
38async function piesAlias(sock, chatId, message, country) {
39 try {

Callers

nothing calls this directly

Calls 1

fetchPiesImageBufferFunction · 0.85

Tested by

no test coverage detected