Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· OpenAIAi2 WildChat-4.8M (AI2)

hi you gave me this script but our dialog is bugged. i need to test it, how to trigger…

  1. User

    hi you gave me this script but our dialog is bugged. i need to test it, how to trigger it? import requests import time import json

    WEBHOOK_URL = “https://discord.com/api/webhooks/1130786757609267241/I1Dv_QmHX_EwEVUHagrCWqfVmbXk3eqIGrDRhqCIBwaEjql-soQw88IJRMRUz1_amcZD” CHECK_INTERVAL = 1 # Check for new chapters every minute

    def send_notification(chapter_number, chapter_title, manga_cover): data = { “content”: f"Вышла новая Глава {chapter_number} - {chapter_title}!!”, “embeds”: [ { “image”: { “url”: manga_cover } } ] } headers = { “Content-Type”: “application/json” } response = requests.post(WEBHOOK_URL, data=json.dumps(data), headers=headers) if response.status_code != 204: print(“Failed to send notification.”)

    def check_for_new_chapter(): url = “https://mangalib.me/yu-yu-hakusho-digital-colored?section=chapters&ui=6398976” response = requests.get(url) if response.status_code == 200: # Example: Parsing the webpage to find the latest chapter title, number, and manga cover html = response.text start_index = html.index(‘Chapters’) end_index = html.index(‘Comments’) chapter_list_html = html[start_index:end_index] chapters = chapter_list_html.split(‘<a class="tile__name’)

        latest_chapter_title = chapters[1].split(“>”)[1].split(“</a”)[0].strip()
        latest_chapter_number = int(latest_chapter_title.split(“Том”)[1].split(“Глава”)[1].split(“-”)[0].strip())
        
        manga_cover = html.split(‘<img src="’)[1].split(‘" alt="’)[0]
            
        # Check if the latest chapter is different from the last known one (you can store it in a file or database)
        # If it’s different, send a notification
        with open(“last_known_chapter.txt”, “r”) as file:
            last
    
  2. Assistant

    To test the script, you can follow these steps:

    1. Make sure you have the necessary libraries installed. You can install them using pip:
    pip install requests
    
    1. Set up a webhook URL. You can create a webhook in your Discord server and obtain the URL. Replace the WEBHOOK_URL variable in the script with your webhook URL.

    2. Update the URL in the check_for_new_chapter() function. Modify the url variable with the URL of the manga chapter you want to monitor for updates.

    3. Create a file named "last_known_chapter.txt" in the same directory as the script. This file will store the last known chapter number.

    4. Run the script. It will check for new chapters every minute based on the CHECK_INTERVAL variable. If a new chapter is detected, it will send a notification to your Discord server.

    Make sure to provide the correct URL and webhook URL for your specific use case.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.