Esempio n. 1
0
def reset_user_condition(call):
    if call.message.chat.type == "supergroup":
        postgres.set_user_condition(call.from_user.id, 0, 0)
    else:
        postgres.set_user_condition(call.message.chat.id, 0, 0)

    bot.delete_message(chat_id=call.message.chat.id,
                       message_id=call.message.message_id)
    bot.send_message(call.message.chat.id, "Adding meme rejected.")
Esempio n. 2
0
def handle_start_add_memes(message):
    postgres.set_user_condition(message.from_user.id, config.S_ADD_MEMES,
                                config.S_ENTER_NAME)
    keyboard = types.InlineKeyboardMarkup()
    callback_button = types.InlineKeyboardButton(text="Reject",
                                                 callback_data="reset")
    keyboard.add(callback_button)
    bot.send_message(message.chat.id,
                     "Enter meme name: ",
                     reply_markup=keyboard)
Esempio n. 3
0
def user_send_pic(message):
    tmp_file_id = message.photo[-1].file_id
    postgres.set_user_condition(message.chat.id, 0, 0)
    postgres.insert_memes(tmp_name, tmp_file_id, tmp_tags)
    keyboard = types.InlineKeyboardMarkup()
    switch_button = types.InlineKeyboardButton(
        text="Show on!", switch_inline_query_current_chat=tmp_name)
    keyboard.add(switch_button)
    bot.send_message(message.chat.id,
                     "The meme is in ur base killin ur d00dz",
                     reply_markup=keyboard)
Esempio n. 4
0
def user_entering_name(message):
    postgres.set_user_condition(message.chat.id, config.S_ADD_MEMES,
                                config.S_ENTER_TAGS)
    global tmp_name
    tmp_name = message.text
    keyboard = types.InlineKeyboardMarkup()
    callback_button = types.InlineKeyboardButton(text="Reject",
                                                 callback_data="reset")
    keyboard.add(callback_button)
    bot.send_message(message.chat.id,
                     "Enter key words for your meme, separated by commas: ",
                     reply_markup=keyboard)
Esempio n. 5
0
def user_entering_tags(message):
    global tmp_tags
    tmp_tags = []
    tags = message.text.split(",")
    for tag in tags:
        tmp_tags.append(tag.strip())

    postgres.set_user_condition(message.chat.id, config.S_ADD_MEMES,
                                config.S_SEND_PIC)
    keyboard = types.InlineKeyboardMarkup()
    callback_button = types.InlineKeyboardButton(text="Reject",
                                                 callback_data="reset")
    keyboard.add(callback_button)
    bot.send_message(message.chat.id,
                     "Nice, and now send me the picture: ",
                     reply_markup=keyboard)