From ddc9ac3d22904970bd0fa2dd44e5b4924490bbd8 Mon Sep 17 00:00:00 2001 From: pan93412 Date: Tue, 27 Aug 2019 19:09:44 +0800 Subject: [PATCH] i18n: add pot generator and ... - let more strings translatable. - regenerate the pot file. - let plural forms can be extracted properly. Co-authored-by: Jim Chen --- actions.py | 20 +- genpot.sh | 12 + locales/unobot.pot | 778 +++++++++++++++++++++++++-------------------- simple_commands.py | 117 ++++--- 4 files changed, 513 insertions(+), 414 deletions(-) create mode 100644 genpot.sh diff --git a/actions.py b/actions.py index c8c5f1e..04bee40 100644 --- a/actions.py +++ b/actions.py @@ -45,13 +45,13 @@ def do_skip(bot, player, job_queue=None): n = skipped_player.waiting_time send_async(bot, chat.id, - text="Waiting time to skip this player has " + text=__("Waiting time to skip this player has " "been reduced to {time} seconds.\n" - "Next player: {name}" + "Next player: {name}", multi=game.translate) .format(time=n, name=display_name(next_player.user)) - ) - logger.info("{player} was skipped!. " + ) + logger.info(__("{player} was skipped! ", multi=game.translate) .format(player=display_name(player.user))) game.turn() if job_queue: @@ -61,21 +61,21 @@ def do_skip(bot, player, job_queue=None): try: gm.leave_game(skipped_player.user, chat) send_async(bot, chat.id, - text="{name1} ran out of time " + text=__("{name1} ran out of time " "and has been removed from the game!\n" - "Next player: {name2}" + "Next player: {name2}", multi=game.translate) .format(name1=display_name(skipped_player.user), name2=display_name(next_player.user))) - logger.info("{player} was skipped!. " + logger.info(__("{player} was skipped! ", multi=game.translate) .format(player=display_name(player.user))) if job_queue: start_player_countdown(bot, game, job_queue) except NotEnoughPlayersError: send_async(bot, chat.id, - text="{name} ran out of time " + text=__("{name} ran out of time " "and has been removed from the game!\n" - "The game ended." + "The game ended.", multi=game.translate) .format(name=display_name(skipped_player.user))) gm.end_game(chat, skipped_player.user) @@ -98,7 +98,7 @@ def do_play_card(bot, player, result_id): us.cards_played += 1 if game.choosing_color: - send_async(bot, chat.id, text=_("Please choose a color")) + send_async(bot, chat.id, text=__("Please choose a color", multi=game.translate)) if len(player.cards) == 1: send_async(bot, chat.id, text="UNO!") diff --git a/genpot.sh b/genpot.sh new file mode 100644 index 0000000..e3d6c4e --- /dev/null +++ b/genpot.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +currentVer='1.0' + +xgettext *.py -o ./locales/unobot.pot --foreign-user \ + --package-name="uno_bot" \ + --package-version="$currentVer" \ + --msgid-bugs-address='uno@jhoeke.de' \ + --keyword=__ \ + --keyword=_ \ + --keyword=_:1,2 \ + --keyword=__:1,2 \ No newline at end of file diff --git a/locales/unobot.pot b/locales/unobot.pot index e8acc7f..92e3bd6 100644 --- a/locales/unobot.pot +++ b/locales/unobot.pot @@ -1,63 +1,411 @@ -# Telegram bot to play UNO in group chats -# Copyright (c) 2016 Jannes HΓΆke +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR , YEAR. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - - -#: bot.py:224 #, fuzzy msgid "" msgstr "" -"Project-Id-Version: uno_bot 0.1\n" +"Project-Id-Version: uno_bot 1.0\n" "Report-Msgid-Bugs-To: uno@jhoeke.de\n" -"POT-Creation-Date: 2016-05-19 22:38+0200\n" -"PO-Revision-Date: 2016-05-19 22:38+0200\n" -"Last-Translator: Jannes HΓΆke \n" -"Language-Team: en \n" -"Language: en_US\n" +"POT-Creation-Date: 2019-08-28 14:21+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: utf-8\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +#: actions.py:48 +#, python-brace-format +msgid "" +"Waiting time to skip this player has been reduced to {time} seconds.\n" +"Next player: {name}" +msgstr "" + +#: actions.py:54 actions.py:69 +#, python-brace-format +msgid "{player} was skipped! " +msgstr "" + +#: actions.py:64 +#, python-brace-format +msgid "" +"{name1} ran out of time and has been removed from the game!\n" +"Next player: {name2}" +msgstr "" + +#: actions.py:76 +#, python-brace-format +msgid "" +"{name} ran out of time and has been removed from the game!\n" +"The game ended." +msgstr "" + +#: actions.py:101 +msgid "Please choose a color" +msgstr "" + +#: actions.py:108 +#, python-brace-format +msgid "{name} won!" +msgstr "" + +#: actions.py:123 bot.py:119 bot.py:199 bot.py:261 bot.py:340 +msgid "Game ended!" +msgstr "" + +#: actions.py:141 actions.py:165 actions.py:179 +msgid "There are no more cards in the deck." +msgstr "" + +#: actions.py:157 +#, python-brace-format +msgid "Bluff called! Giving 4 cards to {name}" +msgstr "" + +#: actions.py:171 +#, python-brace-format +msgid "{name1} didn't bluff! Giving 6 cards to {name2}" +msgstr "" #: bot.py:60 -#, fuzzy -msgid "Follow these steps:\n" +msgid "" +"Send this command in a group to be notified when a new game is started there." +msgstr "" + +#: bot.py:83 +#, python-brace-format +msgid "A new game has been started in {title}" +msgstr "" + +#: bot.py:93 +msgid "" +"Created a new game! Join the game with /join and start the game with /start" +msgstr "" + +#: bot.py:110 bot.py:433 bot.py:461 bot.py:488 bot.py:516 +msgid "There is no running game in this chat." +msgstr "" + +#: bot.py:123 bot.py:239 +msgid "" +"The game is not started yet. Join the game with /join and start the game " +"with /start" +msgstr "" + +#: bot.py:129 bot.py:281 bot.py:446 bot.py:473 bot.py:501 bot.py:530 +#, python-brace-format +msgid "Only the game creator ({name}) and admin can do that." +msgstr "" + +#: bot.py:146 +msgid "The lobby is closed" +msgstr "" + +#: bot.py:150 bot.py:232 +msgid "No game is running at the moment. Create a new game with /new" +msgstr "" + +#: bot.py:156 +msgid "You already joined the game. Start the game with /start" +msgstr "" + +#: bot.py:162 +msgid "There are not enough cards left in the deck for new players to join." +msgstr "" + +#: bot.py:168 +msgid "Joined the game" +msgstr "" + +#: bot.py:181 bot.py:193 +msgid "You are not playing in a game in this group." +msgstr "" + +#: bot.py:204 bot.py:274 +#, python-brace-format +msgid "Okay. Next Player: {name}" +msgstr "" + +#: bot.py:210 +#, python-brace-format +msgid "{name} left the game before it started." +msgstr "" + +#: bot.py:253 +#, python-brace-format +msgid "Player {name} is not found in the current game." +msgstr "" + +#: bot.py:260 bot.py:265 +#, python-brace-format +msgid "{0} was kicked by {1}" +msgstr "" + +#: bot.py:269 +msgid "Please reply to the person you want to kick and type /kick again." +msgstr "" + +#: bot.py:299 +msgid "Game not found." +msgstr "" + +#: bot.py:304 +msgid "Back to last group" +msgstr "" + +#: bot.py:307 +msgid "Please switch to the group you selected!" +msgstr "" + +#: bot.py:313 +#, python-brace-format +msgid "" +"Selected group: {group}\n" +"Make sure that you switch to the correct group!" +msgstr "" + +#: bot.py:343 +#, python-brace-format +msgid "Removing {name} from the game" +msgstr "" + +#: bot.py:360 +msgid "There is no game running in this chat. Create a new one with /new" +msgstr "" + +#: bot.py:365 +msgid "The game has already started" +msgstr "" + +#: bot.py:369 +#, python-brace-format +msgid "" +"At least {minplayers} players must /join the game before you can start it" +msgstr "" + +#: bot.py:380 +#, python-brace-format +msgid "" +"First player: {name}\n" +"Use /close to stop people from joining the game.\n" +"Enable multi-translations with /enable_translations" +msgstr "" + +#: bot.py:417 +msgid "Please select the group you want to play in." +msgstr "" + +#: bot.py:440 +msgid "Closed the lobby. No more players can join this game." +msgstr "" + +#: bot.py:468 +msgid "Opened the lobby. New players may /join the game." +msgstr "" + +#: bot.py:495 +msgid "Enabled multi-translations. Disable with /disable_translations" +msgstr "" + +#: bot.py:523 +msgid "" +"Disabled multi-translations. Enable them again with /enable_translations" +msgstr "" + +#: bot.py:546 +msgid "You are not playing in a game in this chat." +msgstr "" + +#: bot.py:561 +#, python-brace-format +msgid "Please wait {time} second" +msgid_plural "Please wait {time} seconds" +msgstr[0] "" +msgstr[1] "" + +#: bot.py:637 +#, python-brace-format +msgid "Current game: {game}" +msgstr "" + +#: bot.py:672 +#, python-brace-format +msgid "Gamemode changed to {mode}" +msgstr "" + +#: bot.py:678 +#, python-brace-format +msgid "Cheat attempt by {name}" +msgstr "" + +#: bot.py:697 +#, python-brace-format +msgid "Next player: {name}" +msgstr "" + +#: bot.py:709 +#, python-brace-format +msgid "Waiting time for {name} has been reset to {time} seconds" +msgstr "" + +#: results.py:39 +msgid "Choose Color" +msgstr "" + +#: results.py:53 +msgid "Card (tap for game state):" +msgid_plural "Cards (tap for game state):" +msgstr[0] "" +msgstr[1] "" + +#: results.py:64 +#, python-brace-format +msgid "{name} ({number} card)" +msgid_plural "{name} ({number} cards)" +msgstr[0] "" +msgstr[1] "" + +#: results.py:76 +msgid "You are not playing" +msgstr "" + +#: results.py:78 +msgid "" +"Not playing right now. Use /new to start a game or /join to join the current " +"game in this group" +msgstr "" + +#: results.py:90 +msgid "The game wasn't started yet" +msgstr "" + +#: results.py:92 +msgid "Start the game with /start" +msgstr "" + +#: results.py:102 +msgid "🎻 Classic mode" +msgstr "" + +#: results.py:104 +msgid "Classic 🎻" +msgstr "" + +#: results.py:114 +msgid "πŸš€ Sanic mode" +msgstr "" + +#: results.py:116 +msgid "Gotta go fast! πŸš€" +msgstr "" + +#: results.py:126 +msgid "πŸ‰ Wild mode" +msgstr "" + +#: results.py:128 +msgid "Into the Wild~ πŸ‰" +msgstr "" + +#: results.py:141 +#, python-brace-format +msgid "Drawing {number} card" +msgid_plural "Drawing {number} cards" +msgstr[0] "" +msgstr[1] "" + +#: results.py:167 +msgid "Pass" +msgstr "" + +#: results.py:180 +msgid "I'm calling your bluff!" +msgstr "" + +#: results.py:203 +#, python-brace-format +msgid "Current player: {name}" +msgstr "" + +#: results.py:206 +#, python-brace-format +msgid "Last card: {card}" +msgstr "" + +#: results.py:208 +#, python-brace-format +msgid "Player: {player_list}" +msgid_plural "Players: {player_list}" +msgstr[0] "" +msgstr[1] "" + +#: settings.py:37 +msgid "Please edit your settings in a private chat with the bot." +msgstr "" + +#: settings.py:47 +msgid "Enable statistics" +msgstr "" + +#: settings.py:49 +msgid "Delete all statistics" +msgstr "" + +#: settings.py:51 +msgid "Language" +msgstr "" + +#: settings.py:52 +msgid "Settings" +msgstr "" + +#: settings.py:66 +msgid "Enabled statistics!" +msgstr "" + +#: settings.py:72 +msgid "Select locale" +msgstr "" + +#: settings.py:82 +msgid "Deleted and disabled statistics!" +msgstr "" + +#: settings.py:95 +msgid "Set locale!" +msgstr "" + +#: simple_commands.py:31 +msgid "" +"Follow these steps:\n" "\n" "1. Add this bot to a group\n" "2. In the group, start a new game with /new or join an already running game " "with /join\n" "3. After at least two players have joined, start the game with /start\n" -"4. Type @unobot into your chat box and hit space, " -"or click the via @unobot text next to messages. You will " -"see your cards (some greyed out), any extra options like drawing, and a ?" -" to see the current game state. The greyed out cards are those " -"you can not play at the moment. Tap an option to execute the selected " -"action.\n" +"4. Type @unobot into your chat box and hit space, or " +"click the via @unobot text next to messages. You will see your " +"cards (some greyed out), any extra options like drawing, and a ? to " +"see the current game state. The greyed out cards are those you can " +"not play at the moment. Tap an option to execute the selected action.\n" "Players can join the game at any time. To leave a game, use /leave. If a " "player takes more than 90 seconds to play, you can use /skip to skip that " -"player. " -"Use /notify_me to receive a private message when a new game is started.\n" +"player. Use /notify_me to receive a private message when a new game is " +"started.\n" "\n" "Language and other settings: /settings\n" "Other commands (only game creator):\n" "/close - Close lobby\n" "/open - Open lobby\n" -"/enable_translations - Translate relevant texts into all " -"languages spoken in a game\n" -"/disable_translations - Use English for those texts\n\n" +"/kill - Terminate the game\n" +"/kick - Select a player to kick by replying to him or her\n" +"/enable_translations - Translate relevant texts into all languages spoken in " +"a game\n" +"/disable_translations - Use English for those texts\n" +"\n" "Experimental: Play in multiple groups at the same time. Press the " "Current game: ... button and select the group you want to play " "a card in.\n" @@ -66,342 +414,84 @@ msgid "Follow these steps:\n" "unobotupdates\">update channel and buy an UNO card game." msgstr "" -#: bot.py:88 -msgid "This bot is Free Software and licensed under the AGPL. The code is available " +#: simple_commands.py:73 +msgid "" +"This UNO bot has three game modes: Classic, Sanic and Wild.\n" +"\n" +" 🎻 The Classic mode uses the conventional UNO deck and there is no auto " +"skip.\n" +" πŸš€ The Sanic mode uses the conventional UNO deck and the bot automatically " +"skips a player if he/she takes too long to play its turn\n" +" πŸ‰ The Wild mode uses a deck with more special cards, less number variety " +"and no auto skip.\n" +"\n" +"To change the game mode, the GAME CREATOR has to type the bot nickname and a " +"space, just like when playing a card, and all gamemode options should appear." +msgstr "" + +#: simple_commands.py:85 +msgid "" +"This bot is Free Software and licensed under the AGPL. The code is available " "here: \n" "https://github.com/jh0ker/mau_mau_bot" msgstr "" -#: bot.py:133 -msgid "Created a new game! Join the game with /join and start the game with /start" +#: simple_commands.py:88 +msgid "" +"Attributions:\n" +"Draw icon by Faithtoken\n" +"Pass icon by Delapouite\n" +"Originals available on http://game-icons.net\n" +"Icons edited by Ι³ick" msgstr "" -#: bot.py -msgid "Send this command in a group to be notified when a new game is started there." -msgstr "" - -#: bot.py -msgid "A new game has been started in {title}" -msgstr "" - -#: bot.py:152 -msgid "The lobby is closed" -msgstr "" - -#: bot.py:156 -msgid "No game is running at the moment. Create a new game with /new" -msgstr "" - -#: bot.py:162 -msgid "You already joined the game. Start the game with /start" -msgstr "" - -#: bot.py:167 -msgid "Joined the game" -msgstr "" - -#: bot.py:179 bot.py:191 -msgid "You are not playing in a game in this group." -msgstr "" - -#: bot.py:197 bot.py:258 bot.py:595 -msgid "Game ended!" -msgstr "" - -#: bot.py:201 -msgid "Okay. Next Player: {name}" -msgstr "" - -#: bot.py:219 -msgid "Game not found." -msgstr "" - -#: bot.py:223 -msgid "Back to last group" -msgstr "" - -#: bot.py:227 -msgid "Please switch to the group you selected!" -msgstr "" - -#: bot.py:233 -#, python-format -msgid "Selected group: {group}\n" -"Make sure that you switch to the correct group!" -msgstr "" - -#: bot.py:260 -#, python-format -msgid "Removing {name} from the game" -msgstr "" - - -#: bot.py:273 -msgid "There is no game running in this chat. Create a new one with /new" -msgstr "" - -#: bot.py:278 -msgid "The game has already started" -msgstr "" - -#: bot.py:281 -msgid "At least two players must /join the game before you can start it" -msgstr "" - - -#: bot.py:297 -#, python-format, fuzzy -msgid "First player: {name}\n" -"Use /close to stop people from joining the game.\n" -"Enable multi-translations with /enable_translations" -msgstr "" - -#: bot.py:321 -msgid "Please select the group you want to play in." -msgstr "" - - -#: bot.py:335 bot.py:361 -msgid "There is no running game in this chat." -msgstr "" - -#: bot.py:342 -msgid "Closed the lobby. No more players can join this game." -msgstr "" - -#: bot.py:348 bot.py:373 -#, python-format -msgid "Only the game creator ({name}) can do that." -msgstr "" - -#: bot.py:349 -#, python-format -msgid "Enabled multi-translations. Disable with /disable_translations" -msgstr "" - -#: bot.py:377 -#, python-format -msgid "Disabled multi-translations. Enable them again with /enable_translations" -msgstr "" - -#: bot.py:368 -msgid "Opened the lobby. New players may /join the game." -msgstr "" - -#: bot.py:386 -msgid "You are not playing in a game in this chat." -msgstr "" - -#: bot.py:400 -#, python-format -msgid "Please wait {time} second" -msgid_plural "Please wait {time} seconds" -msgstr[0] "" -msgstr[1] "" - -#: bot.py:413 -#, python-format -msgid "Waiting time to skip this player has been reduced to {time} second.\n" -"Next player: {name}" -msgid_plural "Waiting time to skip this player has been reduced to {time} seconds.\n" -"Next player: {name}" -msgstr[0] "" -msgstr[1] "" - -#: bot.py:424 -#, python-format -msgid "{name1} was skipped four times in a row and has been removed from the game.\n" -"Next player: {name2}" -msgstr "" - -#: bot.py:432 -#, python-format -msgid "{name} was skipped four times in a row and has been removed from the game.\n" -"The game ended." -msgstr "" - -#: bot.py:455 +#: simple_commands.py:105 msgid "All news here: https://telegram.me/unobotupdates" msgstr "" -#: bot.py:513 -#, python-format -msgid "Current game: {group}" +#: simple_commands.py:115 +msgid "" +"You did not enable statistics. Use /settings in a private chat with the bot " +"to enable them." msgstr "" -#: bot.py:545 -#, python-format -msgid "Cheat attempt by {name}" -msgstr "" - -#: bot.py:562 -msgid "Next player: {name}" -msgstr "" - -#: bot.py:572 -#, python-format -msgid "Waiting time for {name} has been reset to 90 seconds" -msgstr "" - -#: bot.py:585 -msgid "Please choose a color" -msgstr "" - -#: bot.py:591 -#, python-format -msgid "{name} won!" -msgstr "" - -#: bot.py:613 bot.py:635 bot.py:647 -msgid "There are no more cards in the deck." -msgstr "" - -#: bot.py:627 -#, python-format -msgid "Bluff called! Giving 4 cards to {name}" -msgstr "" - -#: bot.py:639 -#, python-format -msgid "{name1} didn't bluff! Giving 6 cards to {name2}" -msgstr "" - -#: results.py:38 -msgid "Choose Color" -msgstr "" - -#: results.py:56 -msgid "Last card (tap for game state):" -msgid_plural "Cards (tap for game state):" -msgstr[0] "" -msgstr[1] "" - -#: results.py:60 results.py:123 results.py:165 -msgid "Current player: {name}" -msgstr "" - -#: results.py:61 results.py:124 results.py:167 -msgid "Last card: {card}" -msgstr "" - -#: results.py:62 results.py:125 results.py:168 -msgid "Player: {player_list}" -msgid_plural "Players: {player_list}" -msgstr[0] "" -msgstr[1] "" - -#: results.py:72 -#, python-format -msgid "{name} ({number} card)" -msgid_plural "{name} ({number} cards)" -msgstr[0] "" -msgstr[1] "" - -#: results.py:81 -msgid "You are not playing" -msgstr "" - -#: results.py:83 -msgid "Not playing right now. Use /new to start a game or /join to join the current " -"game in this group" -msgstr "" - -#: results.py:95 -msgid "The game wasn't started yet" -msgstr "" - -#: results.py:97 -msgid "Start the game with /start" -msgstr "" - -#: results.py:108 -#, python-format -msgid "Drawing {number} card" -msgid_plural "Drawing {number} cards" -msgstr[0] "" -msgstr[1] "" - -#: results.py:136 -msgid "Pass" -msgstr "" - -#: results.py:148 -msgid "I'm calling your bluff!" -msgstr "" - -#: settings.py:39 -msgid "Please edit your settings in a private chat with the bot." -msgstr "" - -#: settings.py:49 -msgid "Enable statistics" -msgstr "" - -#: settings.py:51 -msgid "Delete all statistics" -msgstr "" - -#: settings.py:53 -msgid "Language" -msgstr "" - -#: settings.py:54 -msgid "Settings" -msgstr "" - -#: settings.py:68 -msgid "Enabled statistics!" -msgstr "" - -#: settings.py:70 -msgid "Select locale" -msgstr "" - -#: settings.py:81 -msgid "Deleted and disabled statistics!" -msgstr "" - -#: settings.py:94 -msgid "Set locale!" -msgstr "" - - -#: simple_commands.py -msgid "You did not enable statistics. Use /settings in " -"a private chat with the bot to enable them." -msgstr "" - -#: simple_commands.py +#: simple_commands.py:122 +#, python-brace-format msgid "{number} game played" msgid_plural "{number} games played" msgstr[0] "" msgstr[1] "" -#: simple_commands.py +#: simple_commands.py:129 +#, python-brace-format msgid "{number} first place" msgid_plural "{number} first places" msgstr[0] "" msgstr[1] "" -#: simple_commands.py +#: simple_commands.py:136 +#, python-brace-format msgid "{number} card played" msgid_plural "{number} cards played" msgstr[0] "" msgstr[1] "" - -#: utils.py -msgid "{emoji} Green" -msgstr "" - -#: utils.py +#: utils.py:55 utils.py:67 +#, python-brace-format msgid "{emoji} Red" msgstr "" -#: utils.py +#: utils.py:57 utils.py:70 +#, python-brace-format msgid "{emoji} Blue" msgstr "" -#: utils.py +#: utils.py:59 utils.py:73 +#, python-brace-format +msgid "{emoji} Green" +msgstr "" + +#: utils.py:61 utils.py:76 +#, python-brace-format msgid "{emoji} Yellow" msgstr "" diff --git a/simple_commands.py b/simple_commands.py index 6cc0c23..4e54c95 100644 --- a/simple_commands.py +++ b/simple_commands.py @@ -25,79 +25,76 @@ from utils import send_async from shared_vars import dispatcher from internationalization import _, user_locale -help_text = ("Follow these steps:\n\n" - "1. Add this bot to a group\n" - "2. In the group, start a new game with /new or join an already" - " running game with /join\n" - "3. After at least two players have joined, start the game with" - " /start\n" - "4. Type @unobot into your chat box and hit " - "space, or click the via @unobot text " - "next to messages. You will see your cards (some greyed out), " - "any extra options like drawing, and a ? to see the " - "current game state. The greyed out cards are those you " - "can not play at the moment. Tap an option to execute " - "the selected action.\n" - "Players can join the game at any time. To leave a game, " - "use /leave. If a player takes more than 90 seconds to play, " - "you can use /skip to skip that player. Use /notify_me to " - "receive a private message when a new game is started.\n\n" - "Language and other settings: /settings\n" - "Other commands (only game creator):\n" - "/close - Close lobby\n" - "/open - Open lobby\n" - "/kill - Terminate the game\n" - "/kick - Select a player to kick " - "by replying to him or her\n" - "/enable_translations - Translate relevant texts into all " - "languages spoken in a game\n" - "/disable_translations - Use English for those texts\n\n" - "Experimental: Play in multiple groups at the same time. " - "Press the Current game: ... button and select the " - "group you want to play a card in.\n" - "If you enjoy this bot, " - "" - "rate me, join the " - "update channel" - " and buy an UNO card game.") - -source_text = ("This bot is Free Software and licensed under the AGPL. " - "The code is available here: \n" - "https://github.com/jh0ker/mau_mau_bot") -attributions = ("Attributions:\n" - 'Draw icon by ' - 'Faithtoken\n' - 'Pass icon by ' - 'Delapouite\n' - "Originals available on http://game-icons.net\n" - "Icons edited by Ι³ick") - -modes_explanation = ("This UNO bot has three game modes: Classic, Sanic and Wild.\n\n" - " 🎻 The Classic mode uses the conventional UNO deck and there is no auto skip.\n" - " πŸš€ The Sanic mode uses the conventional UNO deck and the bot automatically skips a player if he/she takes too long to play its turn\n" - " πŸ‰ The Wild mode uses a deck with more special cards, less number variety and no auto skip.\n\n" - "To change the game mode, the GAME CREATOR has to type the bot nickname and a space, just like when playing a card, and all gamemode options should appear.") - - @user_locale def help_handler(bot, update): """Handler for the /help command""" - send_async(bot, update.message.chat_id, text=_(help_text), - parse_mode=ParseMode.HTML, disable_web_page_preview=True) + help_text = _("Follow these steps:\n\n" + "1. Add this bot to a group\n" + "2. In the group, start a new game with /new or join an already" + " running game with /join\n" + "3. After at least two players have joined, start the game with" + " /start\n" + "4. Type @unobot into your chat box and hit " + "space, or click the via @unobot text " + "next to messages. You will see your cards (some greyed out), " + "any extra options like drawing, and a ? to see the " + "current game state. The greyed out cards are those you " + "can not play at the moment. Tap an option to execute " + "the selected action.\n" + "Players can join the game at any time. To leave a game, " + "use /leave. If a player takes more than 90 seconds to play, " + "you can use /skip to skip that player. Use /notify_me to " + "receive a private message when a new game is started.\n\n" + "Language and other settings: /settings\n" + "Other commands (only game creator):\n" + "/close - Close lobby\n" + "/open - Open lobby\n" + "/kill - Terminate the game\n" + "/kick - Select a player to kick " + "by replying to him or her\n" + "/enable_translations - Translate relevant texts into all " + "languages spoken in a game\n" + "/disable_translations - Use English for those texts\n\n" + "Experimental: Play in multiple groups at the same time. " + "Press the Current game: ... button and select the " + "group you want to play a card in.\n" + "If you enjoy this bot, " + "" + "rate me, join the " + "update channel" + " and buy an UNO card game.") + send_async(bot, update.message.chat_id, text=help_text, + parse_mode=ParseMode.HTML, disable_web_page_preview=True) @user_locale def modes(bot, update): """Handler for the /help command""" - send_async(bot, update.message.chat_id, text=_(modes_explanation), + modes_explanation = _("This UNO bot has three game modes: Classic, Sanic and Wild.\n\n" + " 🎻 The Classic mode uses the conventional UNO deck and there is no auto skip.\n" + " πŸš€ The Sanic mode uses the conventional UNO deck and the bot automatically skips a player if he/she takes too long to play its turn\n" + " πŸ‰ The Wild mode uses a deck with more special cards, less number variety and no auto skip.\n\n" + "To change the game mode, the GAME CREATOR has to type the bot nickname and a space, " + "just like when playing a card, and all gamemode options should appear.") + send_async(bot, update.message.chat_id, text=modes_explanation, parse_mode=ParseMode.HTML, disable_web_page_preview=True) - @user_locale def source(bot, update): """Handler for the /help command""" - send_async(bot, update.message.chat_id, text=_(source_text) + '\n' + - _(attributions), + source_text = _("This bot is Free Software and licensed under the AGPL. " + "The code is available here: \n" + "https://github.com/jh0ker/mau_mau_bot") + attributions = _("Attributions:\n" + 'Draw icon by ' + 'Faithtoken\n' + 'Pass icon by ' + 'Delapouite\n' + "Originals available on http://game-icons.net\n" + "Icons edited by Ι³ick") + + send_async(bot, update.message.chat_id, text=source_text + '\n' + + attributions, parse_mode=ParseMode.HTML, disable_web_page_preview=True)