当前位置: 首页>>代码示例>>Python>>正文


Python Match.remove_player方法代码示例

本文整理汇总了Python中models.match.Match.remove_player方法的典型用法代码示例。如果您正苦于以下问题:Python Match.remove_player方法的具体用法?Python Match.remove_player怎么用?Python Match.remove_player使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.match.Match的用法示例。


在下文中一共展示了Match.remove_player方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: dispatch_message_and_respond

# 需要导入模块: from models.match import Match [as 别名]
# 或者: from models.match.Match import remove_player [as 别名]
def dispatch_message_and_respond(all_users, match, message, player, store):
    if "да матч" in message.text or "да игра" in message.text:
        response = match.annotate()
        if player.telegram_id not in match.players.keys():
            markup = generate_plus_minus_markup()
            bot.send_message(message.chat.id, response, reply_markup=markup)
        else:
            bot.send_message(message.chat.id, response)

    elif message.text == "+" or message.text == "Я +" or message.text == "я +" or message.text == "плюс":
        match.add_player(player)
        send_message_to(match.players.values(), "Нас " + str(match.players_number()) +
                                                "\n" + str(player) + " идет")

    elif message.text == "-" or message.text == "Я -" or message.text == "я -" or message.text == "минус":
        match.remove_player(player)
        response = "("
        bot.send_message(message.chat.id, response)
        if player.telegram_id in match.players.keys() and match.players_number() < 10:
            send_message_to(match.players.values(), "Один -. Нас теперь " + str(match.players_number()))

    elif "мной +" in message.text:
        match.add_guests(player, 1)
        send_message_to(match.players.values(), "Нас " + str(match.players_number())
                                                + "\n" + str(Guest(player)) + " идет")

    elif "мной -" in message.text:
        match.remove_guest(player)
        response = "((("
        bot.send_message(message.chat.id, response)
        if match.players_number() < 10:
            send_message_to(match.players.values(), "Один -. Нас теперь " + str(match.players_number()))

    elif "ы игра" in message.text:
        if match.players_number() >= 10:
            response = "Да \nНас " + str(match.players_number())
        else:
            response = "Нас пока " + str(match.players_number())
        bot.send_message(message.chat.id, response)

    elif "Создать матч" in message.text:
        match = Match("Полет", "Понедельник 20-30")
        store["match"] = match
        response = "Следующий матч: \n" + match.annotate() + "\n\nИдешь?"
        send_message_to(all_users.values(), response, generate_plus_minus_markup())

        bot.send_message(message.chat.id, response)

    elif "то ид" in message.text or "олько на" in message.text:
        response = "Нас " + str(match.players_number()) + "\nТочно идут: \n" + match.annotate_players()
        bot.send_message(message.chat.id, response)

    elif "Прив" in message.text or "Как дела?" in message.text:
        response = "Иди нахуй"
        bot.send_message(message.chat.id, response)

    elif "Позови всех" == message.text:
        response = "Ок. Зову всех, кто пока не поставил + на матч."
        bot.send_message(message.chat.id, response)

        broadcast = "Следующий матч: \n" + match.annotate() + "\n\nИдешь?"
        send_message_to(all_users.values(), broadcast, generate_plus_minus_markup())

    elif "Пошли всем напоминание" in message.text:
        broadcast = "Пацан, ты обещал прийти на матч! \n" + match.annotate()
        send_message_to(match.players.values(), broadcast)

    elif "Напомни всем о матче" == message.text:
        broadcast = "Напоминаю, что игра \n" + match.annotate()
        send_message_to(all_users.values(), broadcast)

    elif "дрес" in message.text:
        response = "ул. Чаадаева, 20А"
        bot.send_message(message.chat.id, response)

    elif "дали меня" in message.text:
        try:
            del all_users[player.telegram_id]
            response = "Больше никаких уведомлений на твой номер."
            if player.telegram_id in match.players.keys():
                match.remove_player(player)
                if match.players_number() < 10:
                    send_message_to(match.players.values(), "Один -. Нас теперь " + str(match.players_number()))
        except:
            traceback.print_exc()
        bot.send_message(message.chat.id, response)

    elif "то подписан" in message.text:
        response = "На уведомления подписаны:\n"
        for user in all_users.values():
            response += user.name + "\n"
        bot.send_message(message.chat.id, response)

    else:
        response = "Я понимаю команды:" \
                   "\nКогда матч?" \
                   "\nКакой адрес?" \
                   "\n+" \
                   "\n-" \
                   "\nСо мной +" \
#.........这里部分代码省略.........
开发者ID:genaforvena,项目名称:FootballPoletBot,代码行数:103,代码来源:bot.py


注:本文中的models.match.Match.remove_player方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。