Make me a website where i can simply manage my discord bot. The website requires a discord login to view any information about the bot. Once loged in the user will see normally no information unless they are permitted to. Make the community owner automaticly have the role owner on the dashboard wich has full control over everything. Make the dashboard have: A bot status tab, tickets tab, moderation tab, applications tab and a role management tab for now. Do not make any extra systems just yet. Make the website dark theme with a clean bit of minecraft theme.
Create the Flask Discord OAuth2 dashboard with owner detection and permission-gated modules.
Add the dark Minecraft-inspired dashboard UI with status, tickets, moderation, applications, and role-management tabs.
Add secure configuration, role-management API endpoints, and setup documentation.
Built a Flask-based Discord dashboard with Discord OAuth2 login and session security.
Added automatic community-owner access with full
ownerpermissions.Added role-based dashboard access:
Owner: full access
Admin: status, tickets, moderation, applications
Moderator: status, tickets, moderation
Viewer: bot status only
Unassigned users: no dashboard information
Added dashboard tabs for bot status, tickets, moderation, applications, and role management.
Added Discord API integration, CSRF protection, SQLite role storage, responsive dark Minecraft-inspired styling,
.envconfiguration, and setup documentation.
Run with:
cp .env.example .env
pip install -r requirements.txt
python app.py
Then open http://localhost:5000.
Can you tell me what i need to change and do to view the website? It also gives me a error that it cant find the discord bot.
Make the status page show the actual Discord API failure instead of only “Not connected.”
Make
.envloading reliable even when the app is launched outside its folder.Add the exact Discord setup and troubleshooting steps for the bot, server ID, token, OAuth redirect, and member permissions.
The dashboard does not create or run a Discord bot itself. It connects to an existing bot through Discord’s API, so you must create and invite the bot first.
I also updated the dashboard so the status page displays the actual Discord API error, such as HTTP 401 or 404.
1. Create the .env file
Make sure .env is in the same folder as app.py:
DISCORD_CLIENT_ID=your_application_client_id
DISCORD_CLIENT_SECRET=your_application_client_secret
DISCORD_BOT_TOKEN=your_bot_token
DISCORD_GUILD_ID=your_server_id
DISCORD_REDIRECT_URI=http://localhost:5000/callback
SESSION_SECRET=use-a-long-random-secret
PORT=5000
COOKIE_SECURE=false
Use the values from the Discord Developer Portal:
DISCORD_CLIENT_ID: Application ID from General InformationDISCORD_CLIENT_SECRET: Client Secret from General InformationDISCORD_BOT_TOKEN: Token from the Bot pageDISCORD_GUILD_ID: Your Discord server ID, not the bot ID
Do not put Bot before the bot token.
2. Configure Discord OAuth
In the Discord Developer Portal:
Open your application.
Go to OAuth2 → General.
Add this exact redirect URL:
http://localhost:5000/callback
The URL in Discord must exactly match:
DISCORD_REDIRECT_URI=http://localhost:5000/callback
3. Configure and invite the bot
In the application’s Bot section:
Create the bot if one does not exist.
Click Reset Token and copy the new token into
.env.Enable Server Members Intent.
Go to OAuth2 → URL Generator.
Select the
botscope.Give the bot at least:
View Channels
Send Messages
Read Message History
Use the generated URL to invite the bot to the server you want to manage.
The bot must be inside the server specified by DISCORD_GUILD_ID.
4. Find your server ID
In Discord:
Open User Settings → Advanced.
Enable Developer Mode.
Right-click your server.
Click Copy Server ID.
Paste that value into:
DISCORD_GUILD_ID=...
5. Install and start the website
From the project folder, run:
Windows
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python app.py
macOS/Linux
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python app.py
Then open:
http://localhost:5000
Sign in using a Discord account that belongs to the configured server.
If it still says the bot cannot be found
Check the status message on the dashboard:
HTTP 401: The bot token is invalid, expired, or copied incorrectly. Reset the token and update
.env.HTTP 404: The server ID is wrong, or the bot has not been invited to that server.
HTTP 403: The bot lacks access or the required intent is disabled.
Members cannot be loaded: Enable Server Members Intent, then restart the website.
Always restart the website after changing .env:
python app.py
Also make sure the file is named exactly .env, not .env.txt.
in the web console i get this error
The generation was stopped before any content could be produced.
In the web console i get this error: Bot failed: No Discord token found. Make sure your bot has a .env file with DISCORD_TOKEN
Fix token compatibility: accept the console’s
DISCORD_TOKENname while preservingDISCORD_BOT_TOKEN.Update the example environment file and setup instructions so the required variable is unambiguous.
The website was looking only for DISCORD_BOT_TOKEN, while your hosting console requires DISCORD_TOKEN. I updated it to support both names.
In your .env file, use:
DISCORD_TOKEN=your_actual_discord_bot_token
Do not include:
DISCORD_TOKEN=Bot your_token
Use only the token itself after =.
Then:
Open the Discord Developer Portal.
Select your application.
Go to Bot.
Click Reset Token or Copy Token.
Paste the new token into
.env.Save the file.
Restart or redeploy the website.
Your .env should also contain:
DISCORD_CLIENT_ID=your_application_client_id
DISCORD_CLIENT_SECRET=your_application_client_secret
DISCORD_TOKEN=your_bot_token
DISCORD_GUILD_ID=your_server_id
DISCORD_REDIRECT_URI=http://localhost:5000/callback
SESSION_SECRET=your_long_random_secret
PORT=5000
COOKIE_SECURE=false
The bot token is different from the client ID and server ID. If the error continues, make sure the variable is named exactly DISCORD_TOKEN and that your hosting platform has been restarted after adding it.
Now the web console says this: Bot failed: No valid bot file found. Expected: Python: bot.py, main.py, discord_bot.py | Javascript: bot.js, index.js, main.js | Typescript: bot.ts, index.ts, main.ts | Csharp: Program.cs, Bot.cs, Main.cs | Cpp: bot.cpp, main.cpp | Ruby: bot.rb, main.rb, discord_bot.rb | Php: bot.php, index.php, main.php
Add the expected
bot.pyentrypoint so the host can start the project.Run the dashboard web server alongside a minimal Discord bot process.
Add
discord.pyto the dependencies and document which file to launch.
The console is looking for a Discord bot entry file. I added bot.py, which starts both:
The Discord bot
The Flask website dashboard
I also added discord.py to requirements.txt.
Use this startup command in your web console:
python bot.py
Make sure your environment variables include:
DISCORD_TOKEN=your_actual_bot_token
DISCORD_CLIENT_ID=your_application_id
DISCORD_CLIENT_SECRET=your_client_secret
DISCORD_GUILD_ID=your_server_id
DISCORD_REDIRECT_URI=https://your-domain.com/callback
SESSION_SECRET=your_long_random_secret
PORT=5000
Then restart or redeploy the project.
Important:
Do not include
Botbefore the token.The token must be from Discord Developer Portal → Bot.
DISCORD_GUILD_IDmust be your Discord server ID.The bot must already be invited to that server.
Your OAuth redirect URL in Discord must exactly match
DISCORD_REDIRECT_URI.The console must install dependencies from
requirements.txt.
The expected entry file now exists:
bot.py
For local testing, run:
pip install -r requirements.txt
python bot.py
Then visit:
http://localhost:5000
Great now how can i view the website? The project is ONLY on this website. Can you tell me step by step how i can view the website?
The project files are not automatically published to the internet. You need to run the web server through the online console, then open the platform’s web preview or generated URL.
Step 1: Open the project console
Open the website where your project files are stored and confirm these files exist:
app.py
bot.py
requirements.txt
templates/
static/
Step 2: Add the environment variables
Open the platform’s Environment Variables, Secrets, or .env section and add:
DISCORD_TOKEN=your_bot_token
DISCORD_CLIENT_ID=your_application_id
DISCORD_CLIENT_SECRET=your_client_secret
DISCORD_GUILD_ID=your_discord_server_id
DISCORD_REDIRECT_URI=https://YOUR_PUBLIC_URL/callback
SESSION_SECRET=make_a_long_random_value
PORT=5000
COOKIE_SECURE=false
For initial testing, if you do not have a public URL yet, use:
DISCORD_REDIRECT_URI=http://localhost:5000/callback
Do not add Bot before the token.
Step 3: Install the dependencies
In the web console terminal, run:
pip install -r requirements.txt
If the platform automatically installs requirements.txt, you can skip this step.
Step 4: Start the project
Set the platform’s Start Command, Run Command, or Startup Command to:
python bot.py
Then click Run, Start, or Deploy.
You should see output similar to:
Running on http://0.0.0.0:5000
Keep this process running. Do not close the console or stop the process.
Step 5: Open the website
Look around the console for one of these buttons:
Open Web Preview
Web Preview
Open Port
View Website
Open App
Public URL
An icon that looks like a globe or external link
Open port:
5000
The platform should open the dashboard in a new browser tab. You should see the Discord login page.
If the platform gives you a URL such as:
https://your-project.example.com
visit that URL directly.
Step 6: Configure the Discord redirect URL
Once you know the website’s real URL, update your environment variable:
DISCORD_REDIRECT_URI=https://your-project.example.com/callback
Then go to:
Discord Developer Portal → Your Application → OAuth2 → General
Add the exact same URL:
https://your-project.example.com/callback
The URLs must match exactly, including:
httpsthe domain
/callbackany port number
no extra trailing slash
Restart the project after changing the variable.
Step 7: Log in
Open the website URL and click the Discord login button.
Log in with a Discord account that belongs to the server configured in:
DISCORD_GUILD_ID=your_server_id
The server owner should automatically receive the owner role and have access to every dashboard tab.
If there is no “Web Preview” or public URL
Some Discord bot hosting websites only run bot processes. They do not host websites or expose HTTP ports. In that case, the console may accept bot.py, but it still cannot display the Flask website.
You need a hosting platform that supports a web service and exposes port 5000. Look for an option named:
Web App
Web Service
HTTP Server
Expose Port
Port Forwarding
If the platform only offers Bot, Worker, or Background Process, it cannot host this dashboard there. You would need to deploy the website portion to a web-service host and keep the Discord bot configured with the same environment variables.
I dont have access to the terminal i can only view logs on the website.
Logs only show what is happening; they are not a webpage preview. The project files are not automatically published just because they exist on the website.
You need to check whether the platform supports web applications, not only Discord bot hosting.
If the platform has a web preview
Look for buttons or settings named:
Deploy
Run
Start
Preview
Open App
Public URL
Expose Port
Web Service
Configure it with:
Start file: bot.py
Port: 5000
Add the environment variables through the platform’s Settings, Environment, or Secrets page:
DISCORD_TOKEN=your_bot_token
DISCORD_CLIENT_ID=your_application_id
DISCORD_CLIENT_SECRET=your_client_secret
DISCORD_GUILD_ID=your_server_id
DISCORD_REDIRECT_URI=https://your-public-url/callback
SESSION_SECRET=a-long-random-secret
PORT=5000
COOKIE_SECURE=true
After deploying, the platform should provide a URL such as:
https://your-project.example.com
That URL is where you view the website.
Then add this exact callback URL in the Discord Developer Portal:
https://your-project.example.com/callback
Go to:
Discord Developer Portal → Your Application → OAuth2 → Redirects
If you can only view logs
If the website gives you only logs and does not provide a Run, Deploy, Preview, Public URL, or Port option, it is probably a Discord-bot-only host. It can run bot.py, but it cannot display the Flask dashboard.
In that case, no change to the Python files can make the website accessible from that host. You need either:
A hosting plan that supports a web app/HTTP port, or
A separate web hosting service for the dashboard.
The Discord bot can remain on the current platform, while the Flask website runs on a web-service host. The website host must provide a public URL because Discord OAuth requires a callback URL.
Also, the previous bot.py file only gives the host a valid bot entry file—it does not automatically publish the Flask website. Look in the platform’s project settings for its hosting type. If you send the platform’s name or a screenshot of the project page, I can give you the exact buttons and settings to use.
import os
import threading
import discord
from dotenv import load_dotenv
from app import app, init_database
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN") or os.getenv("DISCORD_BOT_TOKEN", "")
PORT = int(os.getenv("PORT", "5000"))
if not TOKEN:
raise RuntimeError("No Discord token found. Set DISCORD_TOKEN in .env or your host's environment variables.")
def run_dashboard():
init_database()
app.run(host="0.0.0.0", port=PORT, debug=False, use_reloader=False)
intents = discord.Intents.none()
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f"Discord bot is online as {client.user}")
if __name__ == "__main__":
threading.Thread(target=run_dashboard, daemon=True).start()
client.run(TOKEN)