Exemplo n.º 1
0
def start_post(update: Update, context: CallbackContext):
    chat_id = update.message.chat_id

    mouse = repository.get_mouse_by_id(chat_id)
    if mouse is not None:
        update.message.reply_text("You're Mouse!")
        return ConversationHandler.END

    update.message.reply_text('Enter message')

    return POST_INFORMATION
Exemplo n.º 2
0
def start_subscribe(update: Update, context: CallbackContext):
    chat_id = update.message.chat_id

    mouse = repository.get_mouse_by_id(chat_id)

    if mouse is None:
        update.message.reply_text("You're are not mouse!")
        return ConversationHandler.END

    update.message.reply_text("Enter name of Owl")

    return NAME_OF_OBSERVER
Exemplo n.º 3
0
def about_me(update: Update, context: CallbackContext):
    chat_id = update.message.chat_id

    owl = repository.get_owl_by_id(chat_id)

    if owl is not None:
        update.message.reply_text(f"You're Owl\nSubscribers: {owl.observers_to_str()}")
        return

    mouse = repository.get_mouse_by_id(chat_id)
    if mouse is not None:
        update.message.reply_text("You're Mouse")
        return

    update.message.reply_text("You're not registered")
Exemplo n.º 4
0
def get_name_of_observer(update: Update, context: CallbackContext):
    chat_id = update.message.chat_id

    mouse = repository.get_mouse_by_id(chat_id)

    message = update.message.text

    owl = repository.get_owl_by_username(message)

    if owl is None:
        update.message.reply_text("Thi Owl isn't exist! Enter another name!")
        return ConversationHandler.END

    owl.register_observer(mouse)

    update.message.reply_text("Successful subscribe")
Exemplo n.º 5
0
def start_register(update: Update, context: CallbackContext):
    chat_id = update.message.chat_id

    owl = repository.get_owl_by_id(chat_id)
    if owl is not None:
        update.message.reply_text('You are already registered as Owl')
        return ConversationHandler.END

    mouse = repository.get_mouse_by_id(chat_id)
    if mouse is not None:
        update.message.reply_text('You are already registered as Mouse')
        return ConversationHandler.END

    update.message.reply_text('Enter username')

    return USERNAME
Exemplo n.º 6
0
def like(update: Update, callback_query: CallbackQuery):
    print('LIKE')

    mouse_id = update.callback_query.message.chat_id

    mouse = repository.get_mouse_by_id(mouse_id)

    query = update.callback_query

    query.answer()

    string = update.callback_query.data[len(basic_elements.LIKE_BUTTON)]
    post_id = int(string)

    post = repository.get_post_by_id(post_id)

    post.like(mouse)