(sock, message, args, context)
| 40 | description: 'Play hangman word guessing game', |
| 41 | usage: '.hangman to start, then .guess <letter>', |
| 42 | async handler(sock, message, args, context) { |
| 43 | const chatId = context.chatId || message.key.remoteJid; |
| 44 | const word = words[Math.floor(Math.random() * words.length)]; |
| 45 | const maskedWord = '_ '.repeat(word.length).trim(); |
| 46 | hangmanGames[chatId] = { |
| 47 | word, |
| 48 | maskedWord: maskedWord.split(' '), |
| 49 | guessedLetters: [], |
| 50 | wrongGuesses: 0, |
| 51 | maxWrongGuesses: 6, |
| 52 | }; |
| 53 | await sock.sendMessage(chatId, { |
| 54 | text: `🎮 *HANGMAN GAME STARTED!*\n\n` + |
| 55 | `The word is: ${maskedWord}\n\n` + |
| 56 | `*How to play:*\n` + |
| 57 | `• Use \`.guess <letter>\` to guess\n` + |
| 58 | `• You have 6 wrong guesses allowed\n` + |
| 59 | `• Guess the word before running out of tries!\n\n` + |
| 60 | `Good luck! 🍀` |
| 61 | }, { quoted: message }); |
| 62 | }, |
| 63 | guessLetter |
| 64 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected