File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 "owner_id" : " "
44 },
55 "auth" : {
6- "token" : " " ,
6+ "token" : null ,
77 "public_key" : " "
88 }
99}
Original file line number Diff line number Diff line change 44import time
55import os , os .path
66import utils .auth
7+ import utils .ping
78from random import choice
89from discord import ApplicationContext , option
910from discord .ext import commands
2425async def on_ready ():
2526 print (f"[client] Bot client successfully signed into API. ({ round (time .time ()) - start_time } ms)" )
2627 print (f"[client] Logged in as \" { client .user .name } \" ." )
28+ print ("[utils/ping] Starting web pinging server..." )
29+ utils .ping .host ()
2730
2831# Functions
2932@client .slash_command (
Original file line number Diff line number Diff line change 1515# Functions
1616def get_token () -> str :
1717 """Returns the bot token, if provided in the `startup.json` file."""
18+ if config ["auth" ]["token" ] == None : return os .environ ["TOKEN" ]
1819 return config ["auth" ]["token" ]
1920
2021def get_public_key () -> str :
Original file line number Diff line number Diff line change 1+ from flask import Flask
2+ from threading import Thread
3+
4+ app = Flask ('' )
5+
6+ @app .route ('/' )
7+ def main ():
8+ return """
9+ YAToDB is online.
10+ """ , 200
11+
12+ def run ():
13+ app .run (host = "0.0.0.0" , port = "8080" )
14+
15+ def host (* , no_thread : bool = False ):
16+ if no_thread : run ()
17+ else :
18+ server = Thread (target = run )
19+ server .daemon = True
20+ server .start ()
You can’t perform that action at this time.
0 commit comments