Esempio n. 1
0
 def wrapped(bot, update, *args, **kwargs):
     if w_man.get_wave_in_state(wave_state):
         StatusHandler.handle_status(bot,
                                     update,
                                     Status.WaveStateAlreadyPresent,
                                     state=wave_state)
         return
     return func(bot, update, *args, **kwargs)
Esempio n. 2
0
 def wrapped(bot, update, *args, **kwargs):
     splitted_text = update.message.text.split()
     if len(splitted_text) != count + 1:
         StatusHandler.handle_status(bot,
                                     update,
                                     Status.NotCorrectParametersPassed
                                     )
         return
     return func(bot, update, *args, **kwargs)
Esempio n. 3
0
def assuring_step_handler(bot, update):
    StatusHandler.handle_status(bot, update, WaveService.start_assuring_step())
    try:
        state, summary = WaveService.finish_wave()
        StatusHandler.handle_status(bot, update, state, summary=summary)
    except:
        StatusHandler.handle_status(bot, update, WaveService.rollback_from_assuring_to_bidding())
Esempio n. 4
0
 def wrapped(bot, update, *args, **kwargs):
     username = update.effective_user.username
     if username is None:
         StatusHandler.handle_status(bot, update, Status.UsernameIsNeeded)
         return
     return func(bot, update, *args, **kwargs)
Esempio n. 5
0
def remove_warn_handler(bot, update):
    username = update.message.text.split()[1]
    StatusHandler.handle_status(bot, update, UserService.remove_warn_from_user(username), username=username)
Esempio n. 6
0
def warn_user_handler(bot, update):
    username = update.message.text.split()[1]
    StatusHandler.handle_status(bot, update, UserService.warn_user(username), username=username)
Esempio n. 7
0
def unprivilege_handler(bot, update):
    username = update.message.text.split()[1]
    StatusHandler.handle_status(bot, update, UserService.take_privilege_from_user(username), username=username)
Esempio n. 8
0
def give_privilege_handler(bot, update):
    username = update.message.text.split()[1]
    StatusHandler.handle_status(bot, update, UserService.give_user_privilege(username), username=username)
Esempio n. 9
0
def start_bidding_handler(bot, update):
    status, links = WaveService.start_bidding()
    StatusHandler.handle_status(bot, update, status, links=links)
Esempio n. 10
0
def create_wave_handler(bot, update):
    StatusHandler.handle_status(bot, update, WaveService.create_wave())
Esempio n. 11
0
 def wrapped(bot, update, *args, **kwargs):
     user_id = update.effective_user.id
     if is_user_banned(user_id):
         StatusHandler.handle_status(bot, update, Status.Banned)
         return
     return func(bot, update, *args, **kwargs)
Esempio n. 12
0
 def wrapped(bot, update, *args, **kwargs):
     user_id = update.effective_user.id
     if user_id not in LIST_OF_ADMINS:
         StatusHandler.handle_status(bot, update, Status.Unauthorized)
         return
     return func(bot, update, *args, **kwargs)