Files
shaker-bot/faucet.py
Nathan Woodburn 226210ee0c
All checks were successful
Build Docker / Build Image (push) Successful in 2m37s
fix: Cleanup code to follow good practice
Add line in verify mesage mentioning the ability to set the record onchain
2025-10-09 13:28:05 +11:00

25 lines
815 B
Python

import os
from dotenv import load_dotenv
import discord
from discord import app_commands
import json
from email_validator import validate_email, EmailNotValidError
import requests
async def send_domain(user, email):
try:
emailinfo = validate_email(email, check_deliverability=False)
email = emailinfo.normalized
except EmailNotValidError as e:
return "Your email is invalid"
response = requests.post(f"https://faucet.woodburn.au/api?email={email}&name={user}&key={os.getenv('FAUCET_KEY')}")
print(response)
print(response.text)
response = response.json()
if response['success']:
return "Congratulations! We've sent you a domain to your email"
else:
return "Sorry, something went wrong. Please try again later\n" + response['error']