Replit python discord bot flask brower

I’m developing a python discord bot at replit
And by adding flask, I want to be able to go online just by turning on the browser.If you just leave the browser running, the bot will turn off after about 3 minutes.I am currently using nextcord, not do I keep the browser running even when I turn it on?

This is my code

main code

import nextcord
from nextcord.ext import commands
from webdriver import keep_alive

bot = commands.Bot(command_prefix=commands.when_mentioned_or(",") and "," ,  intents=nextcord.Intents.all())

async def on_ready():
    print(f'봇이 실행되었습니다{bot.user}')
    await bot.change_presence(activity=nextcord.Game(name="/도움말"))


from flask import Flask
from threading import Thread

app = Flask(__name__)

def index():
  return "Alive"

def run():'', port=8080)

def keep_alive():
    t = Thread(target=run)

please help me

Hey, welcome to the Replit Ask community @whitewaffles!

Unfortunately, this isn’t quite how it works, at least not on Replit. Replit creates an isolated environment on the web, and any websites hosted there are hosted on Replit’s IP, not yours, meaning you can’t open in your browser for it to run.

Additionally, after the recent changes on Replit regarding hosting, you can’t access the website URL unless you’re in the editor of your Repl. Even then, it will shut down when you leave, and a different URL will be generated when you open it again.

If you want to leave your bot running on Replit 24/7, you will need to launch a (paid) Replit Deployment.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.