Ejemplo n.º 1
0
def remove_fvrtsticker(update, context): 
    message = update.effective_message  
    chat = update.effective_chat 
    user = update.effective_user 
    args = context.args
    del_stick = " ".join(args)
    if not del_stick:
        message.reply_text("Please give a your favorite sticker pack name to remove from your list.")
        return
    del_check = REDIS.hexists(f'fvrt_stickers2_{user.id}', del_stick)
    if not del_check is False:
        REDIS.hdel(f'fvrt_stickers2_{user.id}',del_stick)
        message.reply_text(
            f"<code>{del_stick}</code> has been succesfully deleted from your list.",
            parse_mode=ParseMode.HTML
        )
    else:
        message.reply_text(
            f"<code>{del_stick}</code> doesn't exist in your favorite sticker pack list.",
            parse_mode=ParseMode.HTML
        )
Ejemplo n.º 2
0
def add_fvrtsticker(update, context):
    bot = context.bot
    message = update.effective_message  
    chat = update.effective_chat 
    user = update.effective_user 
    args = context.args
    query = " ".join(args)
    if message.reply_to_message and message.reply_to_message.sticker:
        get_s_name = message.reply_to_message.sticker.set_name
        if not query:
            get_s_name_title = get_s_name
        else:
            get_s_name_title = query
        if get_s_name is None:
            message.reply_text(
                "Sticker is invalid!"
            )
        sticker_url = f"https://t.me/addstickers/{get_s_name}"
        sticker_m = "<a href='{}'>{}</a>".format(sticker_url, get_s_name_title)
        check_pack = REDIS.hexists(f'fvrt_stickers2_{user.id}', get_s_name_title)
        if check_pack is False:
            REDIS.hset(f'fvrt_stickers2_{user.id}', get_s_name_title, sticker_m)
            message.reply_text(
                f"<code>{sticker_m}</code> has been succesfully added into your favorite sticker packs list!",
                parse_mode=ParseMode.HTML
            )
        else:
            message.reply_text(
                f"<code>{sticker_m}</code> is already exist in your favorite sticker packs list!",
                parse_mode=ParseMode.HTML
            )
        
    else:
        message.reply_text(
            'Reply to any sticker!'
        )