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

Function handler

plugins/flip.js:21–44  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

19 description: 'Flip text upside down (supports Uppercase)',
20 usage: '.flip <text> OR reply to a message',
21 async handler(sock, message, args, context) {
22 const chatId = context.chatId || message.key.remoteJid;
23 let txt = args?.join(' ') || "";
24 const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage;
25 if (quoted) {
26 txt = quoted.conversation || quoted.extendedTextMessage?.text || quoted.imageMessage?.caption || txt;
27 }
28 txt = txt.replace(/^\.\w+\s*/, '').trim();
29 if (!txt)
30 return await sock.sendMessage(chatId, { text: '*What should I flip?*' });
31 const charMap = {
32 'a': 'ɐ', 'b': 'q', 'c': 'ɔ', 'd': 'p', 'e': 'ǝ', 'f': 'ɟ', 'g': 'ƃ', 'h': 'ɥ', 'i': 'ᴉ', 'j': 'ɾ',
33 'k': 'ʞ', 'l': 'l', 'm': 'ɯ', 'n': 'u', 'o': 'o', 'p': 'd', 'q': 'b', 'r': 'ɹ', 's': 's', 't': 'ʇ',
34 'u': 'n', 'v': 'ʌ', 'w': 'ʍ', 'x': 'x', 'y': 'ʎ', 'z': 'z',
35 'A': '∀', 'B': 'ᗺ', 'C': 'Ɔ', 'D': 'p', 'E': 'Ǝ', 'F': 'Ⅎ', 'G': 'פ', 'H': 'H', 'I': 'I', 'J': 'ſ',
36 'K': 'ʞ', 'L': '˥', 'M': 'W', 'N': 'N', 'O': 'O', 'P': 'Ԁ', 'Q': 'Ό', 'R': 'ᴚ', 'S': 'S', 'T': '⊥',
37 'U': '∩', 'V': 'Λ', 'W': 'M', 'X': 'X', 'Y': '⅄', 'Z': 'Z',
38 '1': 'Ɩ', '2': 'ᄅ', '3': 'Ɛ', '4': 'ㄣ', '5': 'ϛ', '6': '9', '7': 'ㄥ', '8': '8', '9': '6', '0': '0',
39 '.': '˙', ',': '\'', '\'': ',', '"': '„', '!': '¡', '?': '¿', '(': ')', ')': '(', '[': ']', ']': '[',
40 '{': '}', '}': '{', '<': '>', '>': '<', '_': '‾', '&': '⅋'
41 };
42 const flipped = txt.split('').map((char) => charMap[char] || char).reverse().join('');
43 await sock.sendMessage(chatId, { text: flipped }, { quoted: message });
44 }
45};
46/*****************************************************************************
47 * *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected