fix: Cleanup code to follow good practice
All checks were successful
Build Docker / Build Image (push) Successful in 2m37s
All checks were successful
Build Docker / Build Image (push) Successful in 2m37s
Add line in verify mesage mentioning the ability to set the record onchain
This commit is contained in:
11
bot.py
11
bot.py
@@ -148,6 +148,7 @@ async def verify(ctx, domain:str):
|
|||||||
message += f"If you use Namebase, you can do this automatically by visiting the following link:\n"
|
message += f"If you use Namebase, you can do this automatically by visiting the following link:\n"
|
||||||
message += f"<https://namebase.io/next/domain-manager/{parts[-1]}/records?records={records}>\n\n"
|
message += f"<https://namebase.io/next/domain-manager/{parts[-1]}/records?records={records}>\n\n"
|
||||||
message += f"Once the record is set (this may take a few minutes) you can run this command again or manually set your nickname to `{name_rendered}/`."
|
message += f"Once the record is set (this may take a few minutes) you can run this command again or manually set your nickname to `{name_rendered}/`."
|
||||||
|
message += f"\n\nAlternatively, you can set the TXT record onchain, this will take longer to propagate.\n\n"
|
||||||
|
|
||||||
await ctx.response.send_message(message,ephemeral=True)
|
await ctx.response.send_message(message,ephemeral=True)
|
||||||
|
|
||||||
@@ -157,6 +158,8 @@ async def verify(ctx, domain:str):
|
|||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
global ADMINID
|
global ADMINID
|
||||||
|
if not client.application:
|
||||||
|
return # not fully ready yet
|
||||||
ADMINID = client.application.owner.id
|
ADMINID = client.application.owner.id
|
||||||
await tree.sync()
|
await tree.sync()
|
||||||
|
|
||||||
@@ -227,5 +230,9 @@ async def on_reaction_add(reaction, user):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
client.run(TOKEN)
|
if not TOKEN:
|
||||||
|
print("No token found")
|
||||||
|
exit(1)
|
||||||
|
print("Starting bot")
|
||||||
|
client.run(TOKEN)
|
||||||
@@ -13,7 +13,7 @@ async def send_domain(user, email):
|
|||||||
except EmailNotValidError as e:
|
except EmailNotValidError as e:
|
||||||
return "Your email is invalid"
|
return "Your email is invalid"
|
||||||
|
|
||||||
response = requests.post("https://faucet.woodburn.au/api?email=" + email+"&name="+str(user) + "&key=" + os.getenv('FAUCET_KEY'))
|
response = requests.post(f"https://faucet.woodburn.au/api?email={email}&name={user}&key={os.getenv('FAUCET_KEY')}")
|
||||||
print(response)
|
print(response)
|
||||||
print(response.text)
|
print(response.text)
|
||||||
response = response.json()
|
response = response.json()
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ load_dotenv()
|
|||||||
|
|
||||||
resolver = dns.resolver.Resolver()
|
resolver = dns.resolver.Resolver()
|
||||||
serverIP = os.getenv('DNS_SERVER')
|
serverIP = os.getenv('DNS_SERVER')
|
||||||
|
if not serverIP:
|
||||||
|
print("No DNS_SERVER found in .env")
|
||||||
|
exit(1)
|
||||||
resolver.nameservers = [serverIP]
|
resolver.nameservers = [serverIP]
|
||||||
resolver.port = int(os.getenv('DNS_PORT'))
|
resolver.port = int(os.getenv('DNS_PORT',"53"))
|
||||||
|
|
||||||
LOCAL = False
|
LOCAL = False
|
||||||
if os.getenv('LOCAL') == "True":
|
if os.getenv('LOCAL') == "True":
|
||||||
|
|||||||
Reference in New Issue
Block a user