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

Function handler

plugins/flip.ts:25–52  ·  view source on GitHub ↗
(sock: any, message: any, args: any, context: BotContext)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected