コード例 #1
0
def add_url(bot, update, args):
    if len(args) >= 1:
        chat = update.effective_chat

        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        # check if link is a valid RSS Feed link
        if link_processed.bozo == 0:
            if len(link_processed.entries[0]) >= 1:
                tg_old_entry_link = link_processed.entries[0].link
            else:
                tg_old_entry_link = ""

            # gather the row which contains exactly that telegram group ID and link for later comparison
            row = sql.check_url_availability(tg_chat_id, tg_feed_link)

            # check if there's an entry already added to DB by the same user in the same group with the same link
            if row:
                update.effective_message.reply_text("මෙම URL දැනටමත් එකතු කර ඇත")
            else:
                sql.add_url(tg_chat_id, tg_feed_link, tg_old_entry_link)

                update.effective_message.reply_text("දායකත්වයට URL එක් කරන ලදි")
        else:
            update.effective_message.reply_text("මෙම සබැඳිය RSS සංග්‍රහ සම්බන්ධකයක් නොවේ")
    else:
        update.effective_message.reply_text("URL අස්ථානගත වී ඇත")
コード例 #2
0
def add_url(update, context: CallbackContext):
    args = context.args
    if len(args) >= 1:
        chat = update.effective_chat

        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        # check if link is a valid RSS Feed link
        if link_processed.bozo == 0:
            if len(link_processed.entries[0]) >= 1:
                tg_old_entry_link = link_processed.entries[0].link
            else:
                tg_old_entry_link = ""

            # gather the row which contains exactly that telegram group ID and link for later comparison
            row = sql.check_url_availability(tg_chat_id, tg_feed_link)

            # check if there's an entry already added to DB by the same user in the same group with the same link
            if row:
                update.effective_message.reply_text("이 URL은 이미 추가되어 있어요.")
            else:
                sql.add_url(tg_chat_id, tg_feed_link, tg_old_entry_link)

                update.effective_message.reply_text("구독에 URL 을(를) 추가했어요.")
        else:
            update.effective_message.reply_text("이 링크는 RSS 피드 링크가 아니에요.")
    else:
        update.effective_message.reply_text("URL 누락")
コード例 #3
0
ファイル: rss.py プロジェクト: MainTeraHer0/MissLilly
def add_url(bot, update, args):
    if len(args) >= 1:
        chat = update.effective_chat

        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        # check if link is a valid RSS Feed link
        if link_processed.bozo == 0:
            if len(link_processed.entries[0]) >= 1:
                tg_old_entry_link = link_processed.entries[0].link
            else:
                tg_old_entry_link = ""

            # gather the row which contains exactly that telegram group ID and link for later comparison
            row = sql.check_url_availability(tg_chat_id, tg_feed_link)

            # check if there's an entry already added to DB by the same user in the same group with the same link
            if row:
                update.effective_message.reply_text(
                    "This URL has already been added")
            else:
                sql.add_url(tg_chat_id, tg_feed_link, tg_old_entry_link)

                update.effective_message.reply_text(
                    "Added URL to subscription")
        else:
            update.effective_message.reply_text(
                "This link is not an RSS Feed link")
    else:
        update.effective_message.reply_text("URL missing")
コード例 #4
0
ファイル: rss.py プロジェクト: LexisTheManokit/FurBOT-Polish
def add_url(bot, update, args):
    if len(args) >= 1:
        chat = update.effective_chat

        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        # check if link is a valid RSS Feed link
        if link_processed.bozo == 0:
            if len(link_processed.entries[0]) >= 1:
                tg_old_entry_link = link_processed.entries[0].link
            else:
                tg_old_entry_link = ""

            # gather the row which contains exactly that telegram group ID and link for later comparison
            row = sql.check_url_availability(tg_chat_id, tg_feed_link)

            # check if there's an entry already added to DB by the same user in the same group with the same link
            if row:
                update.effective_message.reply_text("Ten adres URL został już dodany")
            else:
                sql.add_url(tg_chat_id, tg_feed_link, tg_old_entry_link)

                update.effective_message.reply_text("Dodano adres URL do subskrypcji")
        else:
            update.effective_message.reply_text("Ten link nie jest linkiem do kanału RSS")
    else:
        update.effective_message.reply_text("Brak adresu URL")
コード例 #5
0
def remove_url(update: Update, context: CallbackContext):
    args = context.args
    if len(args) >= 1:
        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        if link_processed.bozo == 0:
            user_data = sql.check_url_availability(tg_chat_id, tg_feed_link)

            if user_data:
                sql.remove_url(tg_chat_id, tg_feed_link)

                update.effective_message.reply_text(
                    "Removed URL from subscription")
            else:
                update.effective_message.reply_text(
                    "You haven't subscribed to this URL yet")
        else:
            update.effective_message.reply_text(
                "This link is not an RSS Feed link")
    else:
        update.effective_message.reply_text("URL missing")
コード例 #6
0
ファイル: rss.py プロジェクト: colonel294/finnaltb
def add_url(bot, update, args):
    if len(args) >= 1:
        chat = update.effective_chat

        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        # check if link is a valid RSS Feed link
        if link_processed.bozo == 0:
            if len(link_processed.entries[0]) >= 1:
                tg_old_entry_link = link_processed.entries[0].link
            else:
                tg_old_entry_link = ""

            # gather the row which contains exactly that telegram group ID and link for later comparison
            row = sql.check_url_availability(tg_chat_id, tg_feed_link)

            # check if there's an entry already added to DB by the same user in the same group with the same link
            if row:
                update.effective_message.reply_text("این آدرس قبلا اضافه شده!")
            else:
                sql.add_url(tg_chat_id, tg_feed_link, tg_old_entry_link)

                update.effective_message.reply_text(
                    "آدرس به لیست اشتراکتون اضافه شد!")
        else:
            update.effective_message.reply_text(
                "این لینک یک خوراک اینترنتی نیست عزیزم!")
    else:
        update.effective_message.reply_text("نمیتونم پیداش کنم!!")
コード例 #7
0
def remove_url(bot, update, args):
    if len(args) >= 1:
        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        if link_processed.bozo == 0:
            user_data = sql.check_url_availability(tg_chat_id, tg_feed_link)

            if user_data:
                sql.remove_url(tg_chat_id, tg_feed_link)

                update.effective_message.reply_text("URL දායකත්වයෙන් ඉවත් කරන ලදි")
            else:
                update.effective_message.reply_text("ඔබ තවමත් මෙම URL වෙත දායක වී නොමැත")
        else:
            update.effective_message.reply_text("මෙම සබැඳිය RSS සංග්‍රහ සම්බන්ධකයක් නොවේ")
    else:
        update.effective_message.reply_text("URL අස්ථානගත වී ඇත")
コード例 #8
0
ファイル: rss.py プロジェクト: marie-kor-pj/tgbot-kor-pj
def remove_url(bot, update, args):
    if len(args) >= 1:
        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        if link_processed.bozo == 0:
            user_data = sql.check_url_availability(tg_chat_id, tg_feed_link)

            if user_data:
                sql.remove_url(tg_chat_id, tg_feed_link)

                update.effective_message.reply_text("구독에서 URL 이 제거되었어요.")
            else:
                update.effective_message.reply_text("아직 이 URL 을(를) 구독하지 않았어요.")
        else:
            update.effective_message.reply_text("이 링크는 RSS 피드 링크가 아니에요.")
    else:
        update.effective_message.reply_text("URL 누락")
コード例 #9
0
ファイル: rss.py プロジェクト: LexisTheManokit/FurBOT-Polish
def remove_url(bot, update, args):
    if len(args) >= 1:
        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        if link_processed.bozo == 0:
            user_data = sql.check_url_availability(tg_chat_id, tg_feed_link)

            if user_data:
                sql.remove_url(tg_chat_id, tg_feed_link)

                update.effective_message.reply_text("Usunięto adres URL z subskrypcji")
            else:
                update.effective_message.reply_text("Nie subskrybowałeś jeszcze tego adresu URL")
        else:
            update.effective_message.reply_text("Ten link nie jest linkiem do kanału RSS")
    else:
        update.effective_message.reply_text("Brak adresu URL")
コード例 #10
0
ファイル: rss.py プロジェクト: colonel294/finnaltb
def remove_url(bot, update, args):
    if len(args) >= 1:
        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        if link_processed.bozo == 0:
            user_data = sql.check_url_availability(tg_chat_id, tg_feed_link)

            if user_data:
                sql.remove_url(tg_chat_id, tg_feed_link)

                update.effective_message.reply_text("آدرس ازز لیستتون پاک شد")
            else:
                update.effective_message.reply_text(
                    "شما که هنوز این پادرسو به لینک اشتراکتون اضافه نکردی")
        else:
            update.effective_message.reply_text(
                "این یه خوراک اینترنتی نیست عزیزم!")
    else:
        update.effective_message.reply_text("نمیتونم پیداش کنم!!")
コード例 #11
0
def remove_url(bot, update, args):
    if len(args) >= 1:
        tg_chat_id = str(update.effective_chat.id)

        tg_feed_link = args[0]

        link_processed = parse(tg_feed_link)

        if link_processed.bozo == 0:
            user_data = sql.check_url_availability(tg_chat_id, tg_feed_link)

            if user_data:
                sql.remove_url(tg_chat_id, tg_feed_link)

                update.effective_message.reply_text(
                    "Imeondolewa URL kutoka kwenye usajili")
            else:
                update.effective_message.reply_text(
                    "You haven't subscribed to this URL yet")
        else:
            update.effective_message.reply_text(
                "Link hii sio kiunganisho cha RSS")
    else:
        update.effective_message.reply_text("URL missing")