comparison plugins/hangman/hangman.js @ 437:722f2bbd654a

Plugin hangman: show current word on command, closes #643
author David Demelier <markand@malikania.fr>
date Sun, 16 Apr 2017 09:56:34 +0200
parents c6fbb6e0e06d
children f3c27790d0d1
comparison
equal deleted inserted replaced
435:18574b79e422 437:722f2bbd654a
38 // Formats. 38 // Formats.
39 Plugin.format = { 39 Plugin.format = {
40 "asked": "#{nickname}, '#{letter}' was already asked.", 40 "asked": "#{nickname}, '#{letter}' was already asked.",
41 "dead": "#{nickname}, fail the word was: #{word}.", 41 "dead": "#{nickname}, fail the word was: #{word}.",
42 "found": "#{nickname}, nice! the word is now #{word}", 42 "found": "#{nickname}, nice! the word is now #{word}",
43 "running": "#{nickname}, the game is already running.", 43 "running": "#{nickname}, the game is already running and the word is: #{word}",
44 "start": "#{nickname}, the game is started, the word to find is: #{word}", 44 "start": "#{nickname}, the game is started, the word to find is: #{word}",
45 "win": "#{nickname}, congratulations, the word is #{word}.", 45 "win": "#{nickname}, congratulations, the word is #{word}.",
46 "wrong-word": "#{nickname}, this is not the word.", 46 "wrong-word": "#{nickname}, this is not the word.",
47 "wrong-player": "#{nickname}, please wait until someone else proposes.", 47 "wrong-player": "#{nickname}, please wait until someone else proposes.",
48 "wrong-letter": "#{nickname}, there is no '#{letter}'." 48 "wrong-letter": "#{nickname}, there is no '#{letter}'."
340 }; 340 };
341 341
342 if (game) { 342 if (game) {
343 var list = message.split(" \t"); 343 var list = message.split(" \t");
344 344
345 if (list.length === 0 || String(list[0]).length === 0) 345 if (list.length === 0 || String(list[0]).length === 0) {
346 kw.word = game.formatWord();
346 server.message(channel, Util.format(Plugin.format["running"], kw)); 347 server.message(channel, Util.format(Plugin.format["running"], kw));
347 else { 348 } else {
348 var word = String(list[0]); 349 var word = String(list[0]);
349 350
350 if (Hangman.isWord(word)) 351 if (Hangman.isWord(word))
351 propose(server, channel, origin, game, word); 352 propose(server, channel, origin, game, word);
352 } 353 }