#๐Ÿ”’ My webhook isn't sending messages whenever it's available.

4 messages ยท Page 1 of 1 (latest)

steep zincBOT
#

@chilly wasp

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.

#

Hey @chilly wasp!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
chilly wasp
#

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()
steep zincBOT
#

@chilly wasp

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.