Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Commit

Permalink
Added keep_alive
Browse files Browse the repository at this point in the history
  • Loading branch information
XnonXte committed Jun 21, 2023
1 parent ab152a2 commit ba0f12d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions PortalGuessr.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import const
from components.guessr import Guessr, GuessrUsersStatistics
from components.buttons import HelpButtonsLink
from components.keep_alive import keep_alive
from os import environ
from dotenv import load_dotenv

Expand Down Expand Up @@ -307,4 +308,5 @@ async def on_app_command_error(
raise error


keep_alive()
bot.run(discord_bot_token)
18 changes: 18 additions & 0 deletions components/keep_alive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from flask import Flask
from threading import Thread

app = Flask("")


@app.route("/")
def main():
return "Your bot is alive!"


def run():
app.run(host="0.0.0.0", port=8080)


def keep_alive():
server = Thread(target=run)
server.start()

0 comments on commit ba0f12d

Please sign in to comment.