Example #1
0
def end_project_load(bot, update):
    """Prevent people for keep uploading projects"""
    if not is_auth(bot, update.message.from_user.username):
        return

    ping_PyCamp_group(bot, "La carga de projectos esta Cerrada")
    update.message.reply_text(
        "Autorizadx \nInformación Cargada, carga de proyectos cerrada")
Example #2
0
def start_project_load(bot, update):
    """Allow people to upload projects"""
    global project_auth
    if not is_auth(bot, update.message.from_user.username):
        return

    if not project_auth:
        update.message.reply_text("Autorizadx \nCarga de proyectos Abierta")
        ping_PyCamp_group(bot, "Carga de proyectos Abierta")
        project_auth = True
    else:
        update.message.reply_text("La carga de proyectos ya estaba abierta")
Example #3
0
def raffle(bot, update):
    if not is_auth(bot, update.message.from_user.username):
        return
    bot.send_message(chat_id=update.message.chat_id,
                     text="Voy a sortear algo entre todxs lxs Pycampistas!")
    bot.send_message(chat_id=update.message.chat_id,
                     text="Y la persona ganadora eeeeeeeeeeeeessss....")
    pycampistas = Pycampista.select(Pycampista.username)
    lista_pycampistas = [persona.username for persona in pycampistas]
    persona_ganadora = random.choice(lista_pycampistas)
    bot.send_message(chat_id=update.message.chat_id,
                     text="@{}".format(persona_ganadora))
Example #4
0
def end_voting(bot, update):
    """Ends voting mode, sets variable vote_auth to False"""

    if not is_auth(bot, update.message.from_user.username):
        return

    global vote_auth

    if vote_auth:
        vote_auth = False
        # ping_PyCamp_group(bot,"La Votaci贸n esta cerrada")
        update.message.reply_text("Autorizadx \nVotaci贸n cerrada")
    else:
        update.message.reply_text("La votaci贸n ya estaba cerrada")
Example #5
0
def start_voting(bot, update):
    logger.info("Empezando la votacion")
    global vote_auth

    if not is_auth(bot, update.message.from_user.username):
        logging.info("Usuario no autorizado")
        return

    if not vote_auth:
        # ping_PyCamp_group(bot, "La Votaci贸n esta abierta")
        update.message.reply_text("Autorizadx \nVotaci贸n Abierta")
        vote_auth = True
    else:
        update.message.reply_text("La votacion ya estaba abierta")
Example #6
0
def merge(bot, update):
    if not is_auth(bot, update.message.from_user.username):
        return

    lista_proyectos = [p.name for p in Project.select()]
    dic_proyectos = dict(enumerate(lista_proyectos))

    # Asks for user input regarding first project
    bot.send_message(
        chat_id=update.message.chat_id,
        text="Decime el primer proyecto que querés combinar (En número)")
    for k, v in dic_proyectos.items():
        bot.send_message(chat_id=update.message.chat_id,
                         text="{}: {}".format(k, v))
    bot.send_message(chat_id=update.message.chat_id, text="-" * 77)

    return PRIMER_PROYECTO