Esempio n. 1
0
def new_game(bot, update):
    """Handler for the /new command"""
    chat_id = update.message.chat_id

    if update.message.chat.type == 'private':
        help_handler(bot, update)

    else:

        if update.message.chat_id in gm.remind_dict:
            for user in gm.remind_dict[update.message.chat_id]:
                send_async(
                    bot,
                    user,
                    text=_("A new game has been started in {title}").format(
                        title=update.message.chat.title))

            del gm.remind_dict[update.message.chat_id]

        game = gm.new_game(update.message.chat)
        game.starter = update.message.from_user
        game.owner.append(update.message.from_user.id)
        game.mode = DEFAULT_GAMEMODE
        send_async(bot,
                   chat_id,
                   text=_("Created a new game! Join the game with /join "
                          "and start the game with /start"))
Esempio n. 2
0
def new_game(bot, update):
    """Handler for the /new command"""
    chat_id = update.message.chat_id

    if update.message.chat.type == 'private':
        help_handler(bot, update)

    else:
        if not chat_id in ALLOWED_GROUPS:
            send_async(bot,
                       chat_id,
                       text=_("Silakan main di @sumbarmaota! Bye 💋"))
            time.sleep(3)
            bot.leave_chat(chat_id)

        else:
            if update.message.chat_id in gm.remind_dict:
                for user in gm.remind_dict[update.message.chat_id]:
                    send_async(
                        bot,
                        user,
                        text=_("A new game has been started in {title}"
                               ).format(title=update.message.chat.title))

                del gm.remind_dict[update.message.chat_id]

            game = gm.new_game(update.message.chat)
            game.starter = update.message.from_user
            game.owner.append(update.message.from_user.id)
            game.mode = DEFAULT_GAMEMODE
            send_async(bot,
                       chat_id,
                       text=_("Created a new game! Join the game with /join "
                              "and start the game with /start"))
Esempio n. 3
0
def new_game(bot, update):
    """Handler for the /new command"""
    chat_id = update.message.chat_id

    if update.message.chat.type == 'private':
        help(bot, update)

    else:

        if update.message.chat_id in gm.remind_dict:
            for user in gm.remind_dict[update.message.chat_id]:
                send_async(
                    bot,
                    user,
                    text=_("A new game has been started in {title}").format(
                        title=update.message.chat.title))

            del gm.remind_dict[update.message.chat_id]

        game = gm.new_game(update.message.chat)
        game.owner = update.message.from_user
        send_async(bot,
                   chat_id,
                   text=_("Created a new game! Join the game with /join "
                          "and start the game with /start"))

        if botan:
            botan.track(update.message, 'New games')
Esempio n. 4
0
def new_game(bot, update):
    """Handler for the /new command"""
    chat_id = update.message.chat_id

    if update.message.chat.type == 'private':
        help(bot, update)

    else:

        if update.message.chat_id in gm.remind_dict:
            for user in gm.remind_dict[update.message.chat_id]:
                send_async(bot,
                           user,
                           text=_("A new game has been started in {title}").format(
                                title=update.message.chat.title))

            del gm.remind_dict[update.message.chat_id]

        game = gm.new_game(update.message.chat)
        game.owner = update.message.from_user
        send_async(bot, chat_id,
                   text=_("Created a new game! Join the game with /join "
                          "and start the game with /start"))

        if botan:
            botan.track(update.message, 'New games')
Esempio n. 5
0
def new_game(bot, update):
    """Handler for the /new command"""
    chat_id = update.message.chat_id

    if update.message.chat.type == 'private':
        help(bot, update)

    else:
        game = gm.new_game(update.message.chat)
        game.owner = update.message.from_user
        send_async(bot, chat_id,
                   text=_("Created a new game! Join the game with /join "
                          "and start the game with /start"))

        if botan:
            botan.track(update.message, 'New games')
Esempio n. 6
0
def new_game(bot, update):
    """Handler for the /new command"""
    chat_id = update.message.chat_id

    if update.message.chat.type == 'private':
        help(bot, update)

    else:
        game = gm.new_game(update.message.chat)
        game.owner = update.message.from_user
        send_async(bot, chat_id,
                   text=_("Created a new game! Join the game with /join "
                          "and start the game with /start"))

        if botan:
            botan.track(update.message, 'New games')