예제 #1
0
def startGame(bot, update):
    chatID = update.message.chat.id
    playerUsername = update.message.from_user.username
    playerID = update.message.from_user.id
    messageID = update.message.message_id
    usersToIDs[playerUsername] = playerID

    try:
        print("log: staring game with:" + repr(chats[chatID]['players']))
        names = list(chats[chatID]['players'])
        update.message.reply_text(repr(names))
        chats[chatID]['game'] = LoveLetter(list(chats[chatID]['players']))
        bot.sendMessage(
            parse_mode='Markdown',
            chat_id=playerID,
            text="I'll be sending your hand information privately from here!")
        print("log: staring game with:" + repr(chats[chatID]['game']))

    except Exception as e:
        print(e)
        bot.sendMessage(parse_mode='Markdown',
                        chat_id=playerID,
                        text="Error starting the game")