Skip to content

Commit 3b251fa

Browse files
committed
Decorador asincrono
1 parent 8792918 commit 3b251fa

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/pycamp_bot/commands/voting.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import functools
12
import peewee
23
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
34
from telegram.ext import CommandHandler, CallbackQueryHandler
@@ -8,19 +9,19 @@
89
from pycamp_bot.logger import logger
910

1011

11-
def vote_authorized(f):
12-
def wrap(*args, **kargs):
12+
def vote_authorized(func):
13+
@functools.wraps(func)
14+
async def wrap(*args):
1315
logger.info('Vote authorized wrapper')
1416

1517
update, context = args
1618
is_active, pycamp = get_active_pycamp()
1719
if pycamp.vote_authorized:
18-
f(*args)
20+
await func(update, context)
1921
else:
2022
context.bot.send_message(
2123
chat_id=update.message.chat_id,
22-
text="La eleccion no está autorizada. Avisale a un admin\
23-
(/admins)!")
24+
text="La eleccion no está autorizada. Avisale a un admin (/admins)!")
2425
return wrap
2526

2627

0 commit comments

Comments
 (0)