Skip to content

Commit 83ab496

Browse files
authored
Merge pull request #58 from PyAr/VotingCount&Raffle
Contador de votos y rifa
2 parents 1338904 + 7f15d41 commit 83ab496

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

src/pycamp_bot/commands/manage_pycamp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,5 @@ def set_handlers(application):
176176
CommandHandler('voy_al_pycamp', add_pycampista_to_pycamp))
177177
application.add_handler(
178178
CommandHandler('pycampistas', list_pycampistas))
179+
180+

src/pycamp_bot/commands/raffle.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,13 @@
55

66

77
@admin_needed
8-
async def raffle(update, context):
9-
await context.bot.send_message(
10-
chat_id=update.message.chat_id,
11-
text="Voy a sortear algo entre todxs lxs Pycampistas!"
12-
)
13-
await context.bot.send_message(
14-
chat_id=update.message.chat_id,
15-
text="Y la persona ganadora eeeeeeeeeeeeessss...."
16-
)
17-
pycampistas = Pycampista.select(Pycampista.username)
18-
lista_pycampistas = [persona.username for persona in pycampistas]
19-
persona_ganadora = random.choice(lista_pycampistas)
20-
await context.bot.send_message(
21-
chat_id=update.message.chat_id,
22-
text="@{}".format(persona_ganadora)
23-
)
24-
8+
async def get_random_user(update, context):
9+
cantidad_campistas = Pycampista.select().count()
10+
index_random = random.randint(1,cantidad_campistas)
11+
user_name = Pycampista.get_by_id(index_random).username
12+
await update.message.reply_text(user_name)
2513

2614
def set_handlers(application):
27-
application.add_handler(CommandHandler('sorteo', raffle))
15+
application.add_handler(
16+
CommandHandler('rifar', get_random_user))
17+

src/pycamp_bot/commands/voting.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ async def end_voting(update, context):
118118
await update.message.reply_text("Selección cerrada")
119119
await msg_to_active_pycamp_chat(context.bot, "La selección de proyectos ha finalizado.")
120120

121+
#def vote_count(update, context):
122+
123+
121124

122125
def set_handlers(application):
123126
application.add_handler(
@@ -128,3 +131,5 @@ def set_handlers(application):
128131
CommandHandler('votar', vote))
129132
application.add_handler(
130133
CommandHandler('terminar_votacion_proyectos', end_voting))
134+
# application.add_handler(
135+
# CommandHandler('contar_votos', vote_count))

0 commit comments

Comments
 (0)