#๐Ÿ”’ Webhook not sending messages

4 messages ยท Page 1 of 1 (latest)

bold kelp
#

import requests
import time

WEBHOOK_URL = "WBHK"

def send_discord_message(message):
    payload = {
        "content": message
    }
    headers = {
        "Content-Type": "application/json"
    }
    requests.post(WEBHOOK_URL, json=payload, headers=headers)

def check_username_availability(username):
    url = f"https://auth.roblox.com/v1/usernames/validate?birthday=1970-01-01T00:00:00.000Z&context=UsernameValidationContext&username={username}"
    response = requests.get(url)
    data = response.json()
    if data.get("valid") == False:
        pass  # Username is taken or inappropriate
    elif data.get("valid") == True:
        send_discord_message(f"@everyone {username} is available!")
    elif data.get("error"):
        if data["error"]["message"] == "Inappropriate":
            pass  # Username is inappropriate
        else:
            print("Unexpected error occurred:", data["error"])
    else:
        print("Unexpected response:", data)

def main():
    username = "USERNAMEHERE"
    while True:
        check_username_availability(username)
        time.sleep(0.01)

if __name__ == "__main__":
    main()
cerulean ploverBOT
#

@bold kelp

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

cerulean ploverBOT
#

@bold kelp

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.