part of templates/index.html
<script type="text/javascript">
var seconds = 0;
var el = document.getElementById('seconds-counter');
function incrementSeconds() {
seconds += 1;
el.innerText = "Online for " + seconds + " seconds.";
}
window.onload = function(){
alert("Bot Online");
setInterval(incrementSeconds, 1000);
}
</script>
<body>
<div id='seconds-counter'>0</div>
</body>
keep_alive.py
from flask import Flask, render_template
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return render_template('index.html')
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start()
the window alerts but doesn't start the counter.
for context, this is a discord bot being hosted on replit.
any reason why this doesn't work?