First Commit

This commit is contained in:
2025-09-16 15:00:16 +02:00
commit c8980f785f
188 changed files with 43407 additions and 0 deletions
Executable
+28
View File
@@ -0,0 +1,28 @@
TOKEN=ODA2Mjg0OTY2NzQ0NTU1NjAw.GFQoZn.Jh0OJ7KczDOfRxFFESnAPOiodUAkjSyjQ-ClGg
SQLHOST=100.67.238.21
SQLUSER=DiscordBot
SQLPASS=rD8/ow@c*F
SQLDB=dbDiscord
TENORAPI=AIzaSyDD0It7s29SWo-8otS93uWC5t135eodng4
EMAILPASS=gsjqdupoeycgjtrr
EMAILUSER=niels.labbe.bot@gmail.com
EMAILSERVER=smtp.gmail.com # Address of the mail server, change it to yours if you need to
EMAILPORT=587 # Port of the mail server, change it to yours if you need to
FEEDBACKRECEIVER=niels.labbe@outlook.com # Sets the receiver's email address
DISCORD_CLIENT_ID=806284966744555600
DISCORD_CLIENT_SECRET=ZGol0RGi3sKmrSt6m0EwWvKMH7-AkR1K
DISCORD_REDIRECT_URI=http://127.0.0.1:5000/callback
SECRET_KEY="123456"
DB_USERNAME=DiscordBot
DB_PASSWORD=rD8/ow@c*F
DB_HOST=192.168.1.16
DB_PORT=3306
DB_NAME=dbDiscord
Executable
+102
View File
@@ -0,0 +1,102 @@
### 1. **Enhanced User Profile Page**
- Create a `/profile` route where users can see their account details, AFK status, balance, and recent activity.
- This can include details like their current roles in Discord, last login date, and economy transactions.
```python
@app.route("/profile")
def profile():
user = session.get("user")
if user:
# Fetch user-specific data from the database, such as AFK status and balance
user_data = mydb.get_user_data(user["id"])
return render_template("profile.html", user=user, user_data=user_data)
else:
flash("Please log in to view your profile.")
return redirect(url_for("login"))
```
### 2. **Real-Time Notifications with WebSockets (Socket.IO)**
- Integrate Flask-SocketIO to send real-time notifications to users. For instance:
- Notify users when someone mentions their AFK status.
- Update user balances dynamically after economy commands.
- This adds an interactive layer, improving engagement.
### 3. **AFK Status History**
- Save AFK statuses and reasons in the database so that users can review their AFK history. You could display this on their profile or in the `afk` route.
```python
@app.route("/afk-history")
def afk_history():
user = session.get("user")
if user:
afk_history = mydb.get_afk_history(user["id"]) # Fetch history from database
return render_template("afk_history.html", afk_history=afk_history)
else:
flash("Please log in to view your AFK history.")
return redirect(url_for("login"))
```
### 4. **Activity Logs and Command Usage History**
- Track command usage for each user and provide a history view on their profile or in an `/activity` route. This could be useful for economy commands or admin actions, showing users an audit trail.
### 5. **Leaderboard for Economy System**
- Add a leaderboard for the economy system, showing top users based on their balance or completed tasks.
- This could be accessible at a `/leaderboard` route.
```python
@app.route("/leaderboard")
def leaderboard():
leaderboard_data = mydb.get_leaderboard() # Assume this gets top users by balance
return render_template("leaderboard.html", leaderboard=leaderboard_data)
```
### 6. **Admin Dashboard with Server Analytics**
- For admins, create a detailed dashboard at `/admin-dashboard` with:
- Analytics on user activity (e.g., active users, messages sent).
- Economy statistics (e.g., total economy transactions).
- User roles and permissions management.
- Add controls to manage bot-specific settings, like prefix or default roles.
### 7. **User Settings and Preferences**
- Expand the `/settings` page to include user-specific preferences, like:
- Notification settings.
- AFK auto-response customization.
- Default economy actions, such as daily rewards.
### 8. **Invite Tracking and Rewards**
- Create a system to track user invites. Users could earn points for each invite, which can be spent in the economy system.
- Show this on the profile or leaderboard page.
### 9. **Friend System or Team Creation**
- Let users add friends or create teams within the app. Each user could form small groups for competitions, teamwork, or earning bonuses.
### 10. **User-Triggered Email Notifications**
- Implement email notifications (using `EMAILUSER` and `EMAILPASS`), allowing users to receive alerts for important events, such as:
- Mentioned while AFK.
- Weekly economy summary.
- Admin notifications.
### 11. **Bot Status Page**
- Add a `/bot-status` route that shows the bots current uptime, connected servers, and other relevant metrics. This can be helpful for troubleshooting and visibility into the bots operational status.
### 12. **Feedback and Support System**
- Add a feedback form where users can submit issues or suggestions directly to the bot support team, which can be managed with `FEEDBACKRECEIVER`.
```python
@app.route("/feedback", methods=["GET", "POST"])
def feedback():
if request.method == "POST":
feedback_text = request.form.get("feedback")
# Logic to send email or save feedback in the database
flash("Your feedback has been submitted. Thank you!")
return redirect(url_for("home"))
return render_template("feedback.html")
```
### 13. **Automatic Role Management Based on Activity**
- Set up a system to award roles based on user activity or economy balance, such as:
- A `VIP` role for top economy earners.
- Levels or ranks based on activity, displayed in their profile.
### 14. **Bot Command Documentation or Help Page**
- Create a `/help` route to serve as a central location for command documentation. You could list commands, descriptions, and examples, making it easy for users to get the most out of the bot.
View File
Binary file not shown.
Binary file not shown.
Executable
+363
View File
@@ -0,0 +1,363 @@
import sys
import os
if __package__ is None or __package__ == "":
# Running as __main__ (e.g. python web/app.py)
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from utils.sql_commands import DatabaseManager
else:
# Imported as a module (e.g. from bot.py)
from utils.sql_commands import DatabaseManager
import os
import requests
from flask import Flask, redirect, url_for, session, request, render_template, flash
from dotenv import load_dotenv
from collections import defaultdict
import datetime
import json
load_dotenv()
app = Flask(__name__)
app.secret_key = os.getenv("SECRET_KEY")
db = DatabaseManager()
# Ensure required environment variables are loaded
DISCORD_CLIENT_ID = os.getenv("DISCORD_CLIENT_ID")
DISCORD_CLIENT_SECRET = os.getenv("DISCORD_CLIENT_SECRET")
DISCORD_REDIRECT_URI = os.getenv("DISCORD_REDIRECT_URI")
DISCORD_API_BASE_URL = "https://discord.com/api"
DISCORD_BOT_TOKEN = os.getenv("TOKEN")
# Check for missing environment variables
if not all([DISCORD_CLIENT_ID, DISCORD_CLIENT_SECRET, DISCORD_REDIRECT_URI]):
raise EnvironmentError("One or more required environment variables are missing.")
# OAuth2 login route
@app.route("/login")
def login():
discord_auth_url = (
f"{DISCORD_API_BASE_URL}/oauth2/authorize"
f"?client_id={DISCORD_CLIENT_ID}&redirect_uri={DISCORD_REDIRECT_URI}"
f"&response_type=code&scope=identify%20guilds%20applications.commands%20bot"
)
return redirect(discord_auth_url)
def can_add_bot(guild):
# Check if the user has permission to manage the bot
permissions = guild.get(
"permissions", 0
) # Ensure permissions are included in the guild data
# Bitwise operation for managing server (assuming manage_server is 0x20)
return (permissions & 0x20) != 0
# OAuth2 callback route
@app.route("/callback")
def callback():
code = request.args.get("code")
if not code:
flash("Authorization code was not provided.")
return redirect(url_for("home"))
data = {
"client_id": DISCORD_CLIENT_ID,
"client_secret": DISCORD_CLIENT_SECRET,
"grant_type": "authorization_code",
"code": code,
"redirect_uri": DISCORD_REDIRECT_URI,
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(
f"{DISCORD_API_BASE_URL}/oauth2/token", data=data, headers=headers
)
if response.status_code != 200:
flash("Failed to retrieve access token from Discord.")
return redirect(url_for("home"))
access_token = response.json().get("access_token")
if not access_token:
flash("Access token missing in the response.")
return redirect(url_for("home"))
# Store access token in session for later use
session["access_token"] = access_token
# Fetch user info
user_data = requests.get(
f"{DISCORD_API_BASE_URL}/users/@me",
headers={"Authorization": f"Bearer {access_token}"},
).json()
# Store user information in session
session["user"] = user_data
# Fetch guilds the user is in
guilds_response = requests.get(
f"{DISCORD_API_BASE_URL}/users/@me/guilds",
headers={"Authorization": f"Bearer {access_token}"},
)
if guilds_response.status_code == 200:
guilds = guilds_response.json() # Store guilds in a variable
session["guilds"] = guilds # Store guilds in session
# Fetch member count and permissions for each guild
for guild in guilds:
guild_id = guild["id"]
guild_info_response = requests.get(
f"{DISCORD_API_BASE_URL}/guilds/{guild_id}",
headers={"Authorization": f"Bearer {access_token}"},
)
if guild_info_response.status_code == 200:
guild_info = guild_info_response.json()
guild["approx_member_count"] = guild_info.get("member_count", "N/A")
guild["permissions"] = guild_info.get(
"permissions", 0
) # Store permissions
else:
guild["approx_member_count"] = "N/A" # Fallback if unable to fetch
# Filter guilds where user can add bots
guilds_with_bot_permission = [guild for guild in guilds if can_add_bot(guild)]
session["guilds_with_bot_permission"] = guilds_with_bot_permission
else:
flash("Failed to retrieve guilds from Discord.")
return redirect(url_for("home"))
# Logout route
@app.route("/logout")
def logout():
session.pop("user", None)
session.pop("guilds", None)
session.pop("access_token", None) # Ensure access token is also cleared
session.pop("guilds_with_bot_permission", None)
flash("You have been logged out.")
return redirect(url_for("home"))
@app.route("/main")
def main_page():
return render_template("main.html")
# Update home route to display user info
@app.route("/")
def home():
user = session.get("user")
if not user:
return redirect(
url_for("main_page")
) # Redirect to the main page if not logged in
guilds_with_permission = session.get("guilds_with_bot_permission", [])
user_info = {
"id": user.get("id", "N/A"),
"username": user.get("username", "Unknown"),
"discriminator": user.get("discriminator", "0000"),
"avatar": user.get("avatar", None),
"servers": len(guilds_with_permission),
}
return render_template(
"home.html", user=user_info, stats=user_info, guilds=guilds_with_permission
)
def get_user_balance(user_id):
result = db.fetch_one("SELECT BANK, WALLET FROM economy WHERE ID = %s", (user_id,))
print(result)
bank_balance = result.get("BANK", 0) if result else 0
wallet_balance = result.get("WALLET", 0) if result else 0
return {
"bank": bank_balance,
"wallet": wallet_balance,
}
@app.route("/wallet")
def wallet():
user = session.get("user")
if not user:
flash("You are not logged in.")
return redirect(url_for("login"))
user_balance = get_user_balance(user["id"])
return render_template("wallet.html", user=user, balance=user_balance)
def get_user_transactions(user_id, sort_by="date", order="asc"):
valid_sort_fields = {
"date": "TIME",
"amount": "amount",
}
sort_column = valid_sort_fields.get(sort_by, "TIME")
sort_order = "ASC" if order == "asc" else "DESC"
query = f"SELECT * FROM transactions WHERE USERID = %s ORDER BY {sort_column} {sort_order}"
transactions = db.fetch_all(query, (user_id,))
return transactions if transactions else []
@app.route("/transactions")
def transactions():
user = session.get("user")
if not user:
flash("You are not logged in.")
return redirect(url_for("login"))
sort_by = request.args.get("sort", "date")
order = request.args.get("order", "asc")
user_transactions = get_user_transactions(str(user["id"]), sort_by, order)
daily_totals = defaultdict(float)
for transaction in user_transactions:
time_value = transaction["TIME"]
if isinstance(time_value, str):
try:
time_value = datetime.datetime.fromisoformat(time_value)
except Exception:
try:
time_value = datetime.datetime.strptime(
time_value, "%Y-%m-%d %H:%M:%S"
)
except Exception:
continue # skip if can't parse
date = time_value.date()
amount = transaction["amount"]
daily_totals[date] += float(amount)
dates = list(daily_totals.keys())
totals = list(daily_totals.values())
return render_template(
"transactions.html",
user=user,
transactions=user_transactions,
dates=dates,
totals=totals,
sort_by=sort_by,
order=order,
)
@app.route("/add_command", methods=["GET", "POST"])
def add_command():
user = session.get("user")
if not user:
flash("You are not logged in.")
return redirect(url_for("login"))
if request.method == "POST":
guild_id = request.form.get("guild_id")
command_name = request.form.get("command_name")
response_text = request.form.get("response")
# Save command to the database
db.execute_query(
"INSERT INTO custom_commands (GUILDID, COMMANDNAME, RESPONSE) VALUES (%s, %s, %s)",
(guild_id, command_name, response_text),
)
flash("Custom command created successfully!")
return redirect(url_for("home"))
return render_template("add_command.html")
@app.route("/commands")
def list_commands():
user = session.get("user")
if not user:
flash("You are not logged in.")
return redirect(url_for("login"))
guild_id = request.args.get("guild_id")
commands = []
if guild_id:
commands = db.fetch_all(
"SELECT * FROM custom_commands WHERE GUILDID = %s", (guild_id,)
)
return render_template("list_commands.html", commands=commands)
@app.route("/delete_command/<int:command_id>", methods=["POST"])
def delete_command(command_id):
user = session.get("user")
if not user:
flash("You are not logged in.")
return redirect(url_for("login"))
db.execute_query("DELETE FROM custom_commands WHERE ID = %s", (command_id,))
flash("Custom command deleted successfully!")
return redirect(url_for("list_commands"))
@app.route("/guild/<guild_id>/settings", methods=["GET", "POST"])
def guild_settings(guild_id):
user = session.get("user")
if not user:
flash("You are not logged in.")
return redirect(url_for("login"))
bot_headers = {"Authorization": f"Bot {DISCORD_BOT_TOKEN}"}
guild_info_response = requests.get(
f"{DISCORD_API_BASE_URL}/guilds/{guild_id}?with_counts=true",
headers=bot_headers,
)
if guild_info_response.status_code != 200:
flash("Failed to retrieve guild information (bot may not be in this guild).")
return redirect(url_for("home"))
guild_info = guild_info_response.json()
owner_id = guild_info.get("owner_id", "N/A")
member_count = guild_info.get("approximate_member_count", "N/A")
# Fetch owner's username using the bot token
owner_name = "Unknown"
if owner_id != "N/A":
owner_response = requests.get(
f"{DISCORD_API_BASE_URL}/users/{owner_id}",
headers=bot_headers,
)
if owner_response.status_code == 200:
owner_data = owner_response.json()
owner_name = f"{owner_data.get('username', 'Unknown')}#{owner_data.get('discriminator', '0000')}"
else:
owner_name = owner_id # fallback to ID if fetch fails
json_formatted_str = json.dumps(guild_info, indent=2)
print(json_formatted_str)
return render_template(
"guild_settings.html",
user=user,
guild=guild_info,
owner_name=owner_name,
member_count=member_count,
)
@app.route("/profile")
def profile():
user = session.get("user")
if not user:
flash("Please log in to view your profile.")
return redirect(url_for("login"))
# Example: Fetch more user data if needed
# user_data = db.fetch_one("SELECT ... FROM ... WHERE ID = %s", (user["id"],))
return render_template("profile.html", user=user)
if __name__ == "__main__":
app.run(debug=True, port=5000, host="0.0.0.0")
+412
View File
@@ -0,0 +1,412 @@
2025-02-17 16:26:08,920 - INFO - Loaded environment variables from .env
2025-02-18 00:09:50,235 - INFO - Loaded environment variables from .env
2025-02-18 00:09:51,508 - INFO - Database connection pool created.
2025-02-18 00:09:51,823 - INFO - logging in using static token
2025-02-18 00:09:54,326 - INFO - Loaded environment variables from .env
2025-02-18 00:09:55,500 - INFO - Database connection pool created.
2025-02-18 00:09:57,630 - INFO - Loaded environment variables from .env
2025-02-18 00:09:59,757 - INFO - Database connection pool created.
2025-02-18 00:09:59,973 - INFO - Loaded environment variables from .env
2025-02-18 00:10:01,082 - INFO - Database connection pool created.
2025-02-18 00:10:05,273 - INFO - Loaded environment variables from .env
2025-02-18 00:10:06,402 - INFO - Database connection pool created.
2025-02-18 00:10:07,284 - INFO - Shard ID None has connected to Gateway (Session ID: 98509db157a6433f4c890382e115ecc3).
2025-02-18 00:10:39,285 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://10.2.71.101:5000
2025-02-18 00:10:39,331 - INFO - Press CTRL+C to quit
2025-02-18 00:10:57,572 - INFO - 127.0.0.1 - - [18/Feb/2025 00:10:57] "GET /main HTTP/1.1" 200 -
2025-02-18 00:10:57,923 - INFO - 127.0.0.1 - - [18/Feb/2025 00:10:57] "GET /favicon.ico HTTP/1.1" 404 -
2025-02-18 00:10:59,144 - INFO - 127.0.0.1 - - [18/Feb/2025 00:10:59] "GET /login HTTP/1.1" 302 -
2025-02-18 00:11:15,779 - INFO - 127.0.0.1 - - [18/Feb/2025 00:11:15] "GET /callback?code=1NAa8zBPFT3nRR70n9rNTCpPsWIjhV&guild_id=1193182989211926558&permissions=0 HTTP/1.1" 302 -
2025-02-18 00:11:16,414 - INFO - 127.0.0.1 - - [18/Feb/2025 00:11:16] "GET / HTTP/1.1" 200 -
2025-02-18 00:11:17,123 - INFO - 127.0.0.1 - - [18/Feb/2025 00:11:17] "GET /favicon.ico HTTP/1.1" 404 -
2025-02-18 00:13:59,449 - ERROR - Exception on /guild/1193182989211926558/settings [GET]
Traceback (most recent call last):
File "C:\Python312\Lib\site-packages\flask\app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "h:\Discord_Bot\web\app.py", line 305, in guild_settings
return render_template("guild_settings.html", user=user, guild=guild_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\templating.py", line 149, in render_template
template = app.jinja_env.get_or_select_template(template_name_or_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 1081, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 1010, in get_template
return self._load_template(name, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 969, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\loaders.py", line 137, in load
code = environment.compile(source, name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 768, in compile
self.handle_exception(source=source_hint)
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "h:\Discord_Bot\web\templates\guild_settings.html", line 14, in template
<img src="{{ guild.icon ? 'https://cdn.discordapp.com/icons/' + guild.id + '/' + guild.icon + '.png' : '/static/default_guild_icon.png' }}"
^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.TemplateSyntaxError: unexpected char '?' at 449
2025-02-18 00:14:00,215 - INFO - 127.0.0.1 - - [18/Feb/2025 00:14:00] "GET /guild/1193182989211926558/settings HTTP/1.1" 500 -
2025-02-18 00:14:49,675 - INFO - Loaded environment variables from .env
2025-02-18 00:14:50,854 - INFO - Database connection pool created.
2025-02-18 00:14:51,186 - INFO - logging in using static token
2025-02-18 00:14:54,529 - INFO - Loaded environment variables from .env
2025-02-18 00:14:55,700 - INFO - Database connection pool created.
2025-02-18 00:14:55,888 - INFO - Loaded environment variables from .env
2025-02-18 00:14:57,165 - INFO - Database connection pool created.
2025-02-18 00:15:03,092 - INFO - Loaded environment variables from .env
2025-02-18 00:15:04,292 - INFO - Database connection pool created.
2025-02-18 00:15:05,292 - INFO - Loaded environment variables from .env
2025-02-18 00:15:06,618 - INFO - Database connection pool created.
2025-02-18 00:15:07,459 - INFO - Shard ID None has connected to Gateway (Session ID: 99312eb2b01111152db88ab221503bcd).
2025-02-18 00:15:28,383 - INFO - Executed query: SELECT * FROM economy WHERE ID = %s with params: (601579326714019840,)
2025-02-18 00:15:28,698 - INFO - Executed query: SELECT XP, LEVEL FROM users WHERE ID = %s with params: (601579326714019840,)
2025-02-18 00:15:28,967 - INFO - Executed query: INSERT INTO users (ID, XP, LEVEL) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), XP = VALUES(XP), LEVEL = VALUES(LEVEL) with params: (601579326714019840, 804, 131)
2025-02-18 00:15:29,099 - INFO - Insert completed with query: INSERT INTO users (ID, XP, LEVEL) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), XP = VALUES(XP), LEVEL = VALUES(LEVEL).
2025-02-18 00:15:29,360 - INFO - Executed query: SELECT * FROM custom_commands WHERE GUILDID = %s with params: ('1193182989211926558',)
2025-02-18 00:15:34,354 - INFO - Executed query: SELECT XP, LEVEL FROM users WHERE ID = %s with params: (601579326714019840,)
2025-02-18 00:15:34,658 - INFO - Executed query: INSERT INTO users (ID, XP, LEVEL) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), XP = VALUES(XP), LEVEL = VALUES(LEVEL) with params: (601579326714019840, 846, 131)
2025-02-18 00:15:35,000 - INFO - Insert completed with query: INSERT INTO users (ID, XP, LEVEL) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), XP = VALUES(XP), LEVEL = VALUES(LEVEL).
2025-02-18 00:15:35,264 - INFO - Executed query: SELECT * FROM custom_commands WHERE GUILDID = %s with params: ('1193182989211926558',)
2025-02-18 00:23:15,116 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://10.2.71.101:5000
2025-02-18 00:23:15,184 - INFO - Press CTRL+C to quit
2025-02-18 00:23:15,364 - INFO - * Restarting with stat
2025-02-18 00:23:57,029 - INFO - Loaded environment variables from .env
2025-02-18 00:23:58,097 - INFO - Database connection pool created.
2025-02-18 00:27:05,253 - INFO - Loaded environment variables from .env
2025-02-18 00:27:06,369 - INFO - Database connection pool created.
2025-02-18 00:27:07,690 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://10.2.71.101:5000
2025-02-18 00:27:07,728 - INFO - Press CTRL+C to quit
2025-02-18 00:27:07,889 - INFO - * Restarting with stat
2025-02-18 00:27:38,810 - INFO - Loaded environment variables from .env
2025-02-18 00:27:39,985 - INFO - Database connection pool created.
2025-02-18 00:27:41,103 - WARNING - * Debugger is active!
2025-02-18 00:27:42,642 - INFO - * Debugger PIN: 140-880-646
2025-02-18 00:27:49,253 - INFO - 127.0.0.1 - - [18/Feb/2025 00:27:49] "GET / HTTP/1.1" 200 -
2025-02-18 00:27:49,437 - INFO - 127.0.0.1 - - [18/Feb/2025 00:27:49] "GET / HTTP/1.1" 302 -
2025-02-18 00:27:49,993 - INFO - 127.0.0.1 - - [18/Feb/2025 00:27:49] "GET /main HTTP/1.1" 200 -
2025-02-18 00:27:50,355 - INFO - 127.0.0.1 - - [18/Feb/2025 00:27:50] "GET /guild/1193182989211926558/settings HTTP/1.1" 500 -
2025-02-18 00:27:51,537 - INFO - 127.0.0.1 - - [18/Feb/2025 00:27:51] "GET /login HTTP/1.1" 302 -
2025-02-18 00:28:19,573 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:19] "GET /callback?code=iC2CzSoUy1wDBmihtmo29yqSnSCngG&guild_id=1193182989211926558&permissions=0 HTTP/1.1" 302 -
2025-02-18 00:28:19,765 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:19] "GET / HTTP/1.1" 200 -
2025-02-18 00:28:28,539 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:28] "GET /guild/1193182989211926558/settings HTTP/1.1" 500 -
2025-02-18 00:28:29,067 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:29] "GET /guild/1193182989211926558/settings?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
2025-02-18 00:28:29,067 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:29] "GET /guild/1193182989211926558/settings?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
2025-02-18 00:28:29,210 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:29] "GET /guild/1193182989211926558/settings?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
2025-02-18 00:28:29,283 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:29] "GET /guild/1193182989211926558/settings?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 304 -
2025-02-18 00:28:35,271 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:35] "GET /guild/1158025725060862093/settings HTTP/1.1" 500 -
2025-02-18 00:28:35,384 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:35] "GET /guild/1158025725060862093/settings?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
2025-02-18 00:28:35,396 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:35] "GET /guild/1158025725060862093/settings?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
2025-02-18 00:28:35,494 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:35] "GET /guild/1158025725060862093/settings?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
2025-02-18 00:28:35,552 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:35] "GET /guild/1158025725060862093/settings?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 304 -
2025-02-18 00:28:38,488 - INFO - Executed query: SELECT BANK, WALLET FROM economy WHERE ID = %s with params: ('601579326714019840',)
2025-02-18 00:28:39,009 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:39] "GET /wallet HTTP/1.1" 200 -
2025-02-18 00:28:45,186 - INFO - Executed query: SELECT * FROM transactions WHERE USERID = %s ORDER BY TIME ASC with params: ('601579326714019840',)
2025-02-18 00:28:45,737 - INFO - 127.0.0.1 - - [18/Feb/2025 00:28:45] "GET /transactions HTTP/1.1" 200 -
2025-02-18 00:29:00,444 - INFO - Executed query: SELECT BANK, WALLET FROM economy WHERE ID = %s with params: ('601579326714019840',)
2025-02-18 00:29:00,598 - INFO - 127.0.0.1 - - [18/Feb/2025 00:29:00] "GET /wallet HTTP/1.1" 200 -
2025-02-18 00:29:02,084 - INFO - 127.0.0.1 - - [18/Feb/2025 00:29:02] "GET / HTTP/1.1" 200 -
2025-02-18 00:29:03,580 - INFO - Executed query: SELECT * FROM transactions WHERE USERID = %s ORDER BY TIME ASC with params: ('601579326714019840',)
2025-02-18 00:29:03,818 - INFO - 127.0.0.1 - - [18/Feb/2025 00:29:03] "GET /transactions HTTP/1.1" 200 -
2025-02-18 00:29:09,463 - INFO - Executed query: SELECT BANK, WALLET FROM economy WHERE ID = %s with params: ('601579326714019840',)
2025-02-18 00:29:09,673 - INFO - 127.0.0.1 - - [18/Feb/2025 00:29:09] "GET /wallet HTTP/1.1" 200 -
2025-02-18 00:29:10,817 - INFO - 127.0.0.1 - - [18/Feb/2025 00:29:10] "GET / HTTP/1.1" 200 -
2025-02-18 00:30:49,125 - INFO - * Detected change in 'h:\\Discord_Bot\\bot.py', reloading
2025-02-18 00:30:49,299 - ERROR - Task exception was never retrieved
future: <Task finished name='Task-1' coro=<main() done, defined at h:\Discord_Bot\bot.py:41> exception=SystemExit(3)>
Traceback (most recent call last):
File "h:\Discord_Bot\bot.py", line 52, in <module>
asyncio.run(main())
File "C:\Python312\Lib\asyncio\runners.py", line 193, in run
with Runner(debug=debug, loop_factory=loop_factory) as runner:
File "C:\Python312\Lib\asyncio\runners.py", line 62, in __exit__
self.close()
File "C:\Python312\Lib\asyncio\runners.py", line 70, in close
_cancel_all_tasks(loop)
File "C:\Python312\Lib\asyncio\runners.py", line 205, in _cancel_all_tasks
loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True))
File "C:\Python312\Lib\asyncio\base_events.py", line 674, in run_until_complete
self.run_forever()
File "C:\Python312\Lib\asyncio\windows_events.py", line 322, in run_forever
super().run_forever()
File "C:\Python312\Lib\asyncio\base_events.py", line 641, in run_forever
self._run_once()
File "C:\Python312\Lib\asyncio\base_events.py", line 1987, in _run_once
handle._run()
File "C:\Python312\Lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "h:\Discord_Bot\bot.py", line 46, in main
await asyncio.gather(run_web(), client.start(token))
File "C:\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\base_events.py", line 674, in run_until_complete
self.run_forever()
File "C:\Python312\Lib\asyncio\windows_events.py", line 322, in run_forever
super().run_forever()
File "C:\Python312\Lib\asyncio\base_events.py", line 641, in run_forever
self._run_once()
File "C:\Python312\Lib\asyncio\base_events.py", line 1987, in _run_once
handle._run()
File "C:\Python312\Lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "h:\Discord_Bot\bot.py", line 11, in run_web
app.run(debug=True, host="0.0.0.0", port=5000)
File "C:\Python312\Lib\site-packages\flask\app.py", line 615, in run
run_simple(t.cast(str, host), port, self, **options)
File "C:\Python312\Lib\site-packages\werkzeug\serving.py", line 1099, in run_simple
run_with_reloader(
File "C:\Python312\Lib\site-packages\werkzeug\_reloader.py", line 454, in run_with_reloader
reloader.run()
File "C:\Python312\Lib\site-packages\werkzeug\_reloader.py", line 255, in run
self.run_step()
File "C:\Python312\Lib\site-packages\werkzeug\_reloader.py", line 308, in run_step
self.trigger_reload(name)
File "C:\Python312\Lib\site-packages\werkzeug\_reloader.py", line 280, in trigger_reload
sys.exit(3)
SystemExit: 3
2025-02-18 00:30:50,416 - INFO - * Restarting with stat
2025-02-18 00:31:21,508 - INFO - Loaded environment variables from .env
2025-02-18 00:31:22,607 - INFO - Database connection pool created.
2025-02-18 00:31:23,196 - ERROR - Task exception was never retrieved
future: <Task finished name='Task-1' coro=<main() done, defined at h:\Discord_Bot\bot.py:41> exception=SystemExit(1)>
Traceback (most recent call last):
File "h:\Discord_Bot\bot.py", line 52, in <module>
if __name__ == "__main__":
^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\runners.py", line 193, in run
with Runner(debug=debug, loop_factory=loop_factory) as runner:
File "C:\Python312\Lib\asyncio\runners.py", line 62, in __exit__
self.close()
File "C:\Python312\Lib\asyncio\runners.py", line 70, in close
_cancel_all_tasks(loop)
File "C:\Python312\Lib\asyncio\runners.py", line 205, in _cancel_all_tasks
loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True))
File "C:\Python312\Lib\asyncio\base_events.py", line 674, in run_until_complete
self.run_forever()
File "C:\Python312\Lib\asyncio\windows_events.py", line 322, in run_forever
super().run_forever()
File "C:\Python312\Lib\asyncio\base_events.py", line 641, in run_forever
self._run_once()
File "C:\Python312\Lib\asyncio\base_events.py", line 1987, in _run_once
handle._run()
File "C:\Python312\Lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "h:\Discord_Bot\bot.py", line 46, in main
threading.Thread(target=run_flask).start()
File "C:\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\base_events.py", line 674, in run_until_complete
self.run_forever()
File "C:\Python312\Lib\asyncio\windows_events.py", line 322, in run_forever
super().run_forever()
File "C:\Python312\Lib\asyncio\base_events.py", line 641, in run_forever
self._run_once()
File "C:\Python312\Lib\asyncio\base_events.py", line 1987, in _run_once
handle._run()
File "C:\Python312\Lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "h:\Discord_Bot\bot.py", line 11, in run_web
app.run(debug=True, host="0.0.0.0", port=5000)
File "C:\Python312\Lib\site-packages\flask\app.py", line 615, in run
run_simple(t.cast(str, host), port, self, **options)
File "C:\Python312\Lib\site-packages\werkzeug\serving.py", line 1099, in run_simple
run_with_reloader(
File "C:\Python312\Lib\site-packages\werkzeug\_reloader.py", line 456, in run_with_reloader
sys.exit(reloader.restart_with_reloader())
SystemExit: 1
2025-02-18 00:32:28,094 - INFO - Loaded environment variables from .env
2025-02-18 00:32:29,183 - INFO - Database connection pool created.
2025-02-18 00:32:29,516 - INFO - logging in using static token
2025-02-18 00:32:33,191 - INFO - Loaded environment variables from .env
2025-02-18 00:32:34,523 - INFO - Database connection pool created.
2025-02-18 00:32:34,747 - INFO - Loaded environment variables from .env
2025-02-18 00:32:35,875 - INFO - Database connection pool created.
2025-02-18 00:32:42,070 - INFO - Loaded environment variables from .env
2025-02-18 00:32:43,291 - INFO - Database connection pool created.
2025-02-18 00:32:44,569 - INFO - Loaded environment variables from .env
2025-02-18 00:32:45,747 - INFO - Database connection pool created.
2025-02-18 00:32:46,534 - INFO - Shard ID None has connected to Gateway (Session ID: f5b6391616fe1cd902bab5eaede7b1e3).
2025-02-18 00:35:07,214 - INFO - Loaded environment variables from .env
2025-02-18 00:35:08,317 - INFO - Database connection pool created.
2025-02-18 00:35:08,595 - INFO - logging in using static token
2025-02-18 00:35:12,030 - INFO - Loaded environment variables from .env
2025-02-18 00:35:13,232 - INFO - Database connection pool created.
2025-02-18 00:35:13,475 - INFO - Loaded environment variables from .env
2025-02-18 00:35:14,506 - INFO - Database connection pool created.
2025-02-18 00:35:20,276 - INFO - Loaded environment variables from .env
2025-02-18 00:35:21,550 - INFO - Database connection pool created.
2025-02-18 00:35:22,874 - INFO - Loaded environment variables from .env
2025-02-18 00:35:23,990 - INFO - Database connection pool created.
2025-02-18 00:35:24,734 - INFO - Shard ID None has connected to Gateway (Session ID: eab1413949391e81976bde3e246c9aeb).
2025-02-18 00:36:31,294 - INFO - Loaded environment variables from .env
2025-02-18 00:36:32,344 - INFO - Database connection pool created.
2025-02-18 00:36:32,764 - INFO - logging in using static token
2025-02-18 00:36:34,091 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://10.2.71.101:5000
2025-02-18 00:36:34,135 - INFO - Press CTRL+C to quit
2025-02-18 00:36:36,601 - INFO - Loaded environment variables from .env
2025-02-18 00:36:37,621 - INFO - Database connection pool created.
2025-02-18 00:36:37,873 - INFO - Loaded environment variables from .env
2025-02-18 00:36:38,969 - INFO - Database connection pool created.
2025-02-18 00:36:44,499 - INFO - Loaded environment variables from .env
2025-02-18 00:36:45,605 - INFO - Database connection pool created.
2025-02-18 00:36:46,553 - INFO - Loaded environment variables from .env
2025-02-18 00:36:47,609 - INFO - Database connection pool created.
2025-02-18 00:36:48,293 - INFO - Shard ID None has connected to Gateway (Session ID: 7f70f0f59e709bcc61e8c57a85b8860d).
2025-02-18 00:38:09,911 - INFO - Loaded environment variables from .env
2025-02-18 00:38:11,012 - INFO - Database connection pool created.
2025-02-18 00:38:11,313 - INFO - logging in using static token
2025-02-18 00:38:11,784 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://10.2.71.101:5000
2025-02-18 00:38:11,845 - INFO - Press CTRL+C to quit
2025-02-18 00:38:14,661 - INFO - Loaded environment variables from .env
2025-02-18 00:38:15,754 - INFO - Database connection pool created.
2025-02-18 00:38:15,967 - INFO - Loaded environment variables from .env
2025-02-18 00:38:17,046 - INFO - Database connection pool created.
2025-02-18 00:38:22,379 - INFO - Loaded environment variables from .env
2025-02-18 00:38:23,450 - INFO - Database connection pool created.
2025-02-18 00:38:24,355 - INFO - Loaded environment variables from .env
2025-02-18 00:38:25,472 - INFO - Database connection pool created.
2025-02-18 00:38:26,244 - INFO - Shard ID None has connected to Gateway (Session ID: 4caa51a8a7e97e5f8d3fee605ac913f4).
2025-02-18 00:38:41,430 - INFO - 127.0.0.1 - - [18/Feb/2025 00:38:41] "GET / HTTP/1.1" 302 -
2025-02-18 00:38:42,037 - INFO - 127.0.0.1 - - [18/Feb/2025 00:38:42] "GET /main HTTP/1.1" 200 -
2025-02-18 00:38:43,567 - INFO - 127.0.0.1 - - [18/Feb/2025 00:38:43] "GET /login HTTP/1.1" 302 -
2025-02-18 00:39:55,523 - INFO - 127.0.0.1 - - [18/Feb/2025 00:39:55] "GET /callback?code=Xeeh0hYQ7IKHt82mwOHtfVzJLji0Br&guild_id=1013546682249646110&permissions=0 HTTP/1.1" 302 -
2025-02-18 00:39:56,107 - INFO - 127.0.0.1 - - [18/Feb/2025 00:39:56] "GET / HTTP/1.1" 200 -
2025-02-18 00:40:01,639 - ERROR - Exception on /guild/1193182989211926558/settings [GET]
Traceback (most recent call last):
File "C:\Python312\Lib\site-packages\flask\app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "h:\Discord_Bot\web\app.py", line 305, in guild_settings
return render_template("guild_settings.html", user=user, guild=guild_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\templating.py", line 149, in render_template
template = app.jinja_env.get_or_select_template(template_name_or_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 1081, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 1010, in get_template
return self._load_template(name, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 969, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\loaders.py", line 137, in load
code = environment.compile(source, name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 768, in compile
self.handle_exception(source=source_hint)
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "h:\Discord_Bot\web\templates\guild_settings.html", line 14, in template
<img src="{{ guild.icon ? 'https://cdn.discordapp.com/icons/' + guild.id + '/' + guild.icon + '.png' : '/static/default_guild_icon.png' }}"
^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.TemplateSyntaxError: unexpected char '?' at 449
2025-02-18 00:40:02,428 - INFO - 127.0.0.1 - - [18/Feb/2025 00:40:02] "GET /guild/1193182989211926558/settings HTTP/1.1" 500 -
2025-02-18 00:40:06,394 - ERROR - Exception on /guild/1158025725060862093/settings [GET]
Traceback (most recent call last):
File "C:\Python312\Lib\site-packages\flask\app.py", line 1463, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 870, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\app.py", line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "h:\Discord_Bot\web\app.py", line 305, in guild_settings
return render_template("guild_settings.html", user=user, guild=guild_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\flask\templating.py", line 149, in render_template
template = app.jinja_env.get_or_select_template(template_name_or_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 1081, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 1010, in get_template
return self._load_template(name, globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 969, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\loaders.py", line 137, in load
code = environment.compile(source, name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 768, in compile
self.handle_exception(source=source_hint)
File "C:\Python312\Lib\site-packages\jinja2\environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "h:\Discord_Bot\web\templates\guild_settings.html", line 14, in template
<img src="{{ guild.icon ? 'https://cdn.discordapp.com/icons/' + guild.id + '/' + guild.icon + '.png' : '/static/default_guild_icon.png' }}"
^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.TemplateSyntaxError: unexpected char '?' at 449
2025-02-18 00:40:06,699 - INFO - 127.0.0.1 - - [18/Feb/2025 00:40:06] "GET /guild/1158025725060862093/settings HTTP/1.1" 500 -
2025-02-18 00:40:09,668 - INFO - Executed query: SELECT BANK, WALLET FROM economy WHERE ID = %s with params: ('601579326714019840',)
2025-02-18 00:40:10,240 - INFO - 127.0.0.1 - - [18/Feb/2025 00:40:10] "GET /wallet HTTP/1.1" 200 -
2025-02-18 00:40:12,080 - INFO - 127.0.0.1 - - [18/Feb/2025 00:40:12] "GET / HTTP/1.1" 200 -
2025-02-18 00:40:14,702 - INFO - Executed query: SELECT * FROM transactions WHERE USERID = %s ORDER BY TIME ASC with params: ('601579326714019840',)
2025-02-18 00:40:15,310 - INFO - 127.0.0.1 - - [18/Feb/2025 00:40:15] "GET /transactions HTTP/1.1" 200 -
2025-02-18 00:40:31,340 - INFO - Executed query: SELECT * FROM economy WHERE ID = %s with params: (601579326714019840,)
2025-02-18 00:40:31,636 - INFO - Executed query: SELECT XP, LEVEL FROM users WHERE ID = %s with params: (601579326714019840,)
2025-02-18 00:40:31,875 - INFO - Executed query: INSERT INTO users (ID, XP, LEVEL) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), XP = VALUES(XP), LEVEL = VALUES(LEVEL) with params: (601579326714019840, 896, 131)
2025-02-18 00:40:32,596 - INFO - Insert completed with query: INSERT INTO users (ID, XP, LEVEL) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), XP = VALUES(XP), LEVEL = VALUES(LEVEL).
2025-02-18 00:40:32,807 - INFO - Executed query: SELECT * FROM custom_commands WHERE GUILDID = %s with params: ('1193182989211926558',)
2025-02-18 00:40:45,160 - INFO - Executed query: SELECT * FROM economy WHERE ID = %s with params: (601579326714019840,)
2025-02-18 00:40:45,406 - INFO - Executed query: SELECT * FROM economy WHERE ID = %s with params: (601579326714019840,)
2025-02-18 00:40:45,701 - INFO - Executed query: INSERT INTO economy (ID, WALLET, BANK) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), WALLET = VALUES(WALLET), BANK = VALUES(BANK) with params: (601579326714019840, 1000, 6839)
2025-02-18 00:40:45,812 - INFO - Insert completed with query: INSERT INTO economy (ID, WALLET, BANK) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), WALLET = VALUES(WALLET), BANK = VALUES(BANK).
2025-02-18 00:40:46,004 - INFO - Executed query: SELECT XP, LEVEL FROM users WHERE ID = %s with params: (601579326714019840,)
2025-02-18 00:40:46,354 - INFO - Executed query: INSERT INTO users (ID, XP, LEVEL) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), XP = VALUES(XP), LEVEL = VALUES(LEVEL) with params: (601579326714019840, 946, 131)
2025-02-18 00:40:46,462 - INFO - Insert completed with query: INSERT INTO users (ID, XP, LEVEL) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE ID = VALUES(ID), XP = VALUES(XP), LEVEL = VALUES(LEVEL).
2025-02-18 00:40:46,648 - INFO - Executed query: SELECT * FROM custom_commands WHERE GUILDID = %s with params: ('1193182989211926558',)
2025-02-18 00:40:49,085 - INFO - Executed query: SELECT BANK, WALLET FROM economy WHERE ID = %s with params: ('601579326714019840',)
2025-02-18 00:40:49,181 - INFO - 127.0.0.1 - - [18/Feb/2025 00:40:49] "GET /wallet HTTP/1.1" 200 -
2025-02-18 00:40:51,506 - INFO - 127.0.0.1 - - [18/Feb/2025 00:40:51] "GET / HTTP/1.1" 200 -
+3
View File
@@ -0,0 +1,3 @@
Flask
Flask-SQLAlchemy # if you are using SQL
requests # to interact with Discord API
View File
+22
View File
@@ -0,0 +1,22 @@
/* web/static/style.css */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
}
header {
background-color: #333;
padding: 1em;
}
header nav a {
color: white;
margin: 0 1em;
text-decoration: none;
}
main {
padding: 2em;
}
+25
View File
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Add Custom Command</title>
</head>
<body>
<h1>Add a Custom Command</h1>
<form action="{{ url_for('add_command') }}" method="POST">
<label for="guild_id">Guild ID:</label>
<input type="text" name="guild_id" required>
<label for="command_name">Command Name:</label>
<input type="text" name="command_name" required>
<label for="response">Response:</label>
<textarea name="response" required></textarea>
<button type="submit">Create Command</button>
</form>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block content %}
<h1>Admin Controls</h1>
<p>Manage bot permissions and other admin settings here.</p>
<!-- Restrict this page to admins only -->
{% endblock %}
+10
View File
@@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block content %}
<h1>AFK Management</h1>
<form method="post">
<label for="reason">Reason for AFK:</label>
<input type="text" name="reason" id="reason">
<button type="submit">Set AFK</button>
</form>
{% endblock %}
+25
View File
@@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Discord Bot Dashboard</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<header>
<nav>
<a href="{{ url_for('home') }}">Home</a>
<a href="{{ url_for('afk') }}">AFK Management</a>
<a href="{{ url_for('economy') }}">Economy</a>
<a href="{{ url_for('admin_controls') }}">Admin</a>
<a href="{{ url_for('settings') }}">Settings</a>
</nav>
</header>
<main>
{% block content %}{% endblock %}
</main>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block content %}
<h1>Economy Dashboard</h1>
<p>Your Balance: {{ balance }}</p>
<!-- Add more economy features here as needed -->
{% endblock %}
+77
View File
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Guild Settings - {{ guild.name }}</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container mt-5">
<h1>Settings for {{ guild.name }}</h1>
<div class="mb-3">
<img src="{% if guild.icon %}https://cdn.discordapp.com/icons/{{ guild.id }}/{{ guild.icon }}.png{% else %}/static/default_guild_icon.png{% endif %}"
alt="Guild Icon" class="img-thumbnail" width="100">
</div>
<ul class="list-group mb-4">
<li class="list-group-item"><strong>Guild ID:</strong> {{ guild.id }}</li>
<li class="list-group-item"><strong>Guild Name:</strong> {{ guild.name }}</li>
<li class="list-group-item"><strong>Owner:</strong> {{ owner_name }}</li>
<li class="list-group-item"><strong>Permissions:</strong> {{ guild.permissions }}</li>
<li class="list-group-item"><strong>Member Count:</strong> {{ member_count }}</li>
{% if guild.features %}
<li class="list-group-item"><strong>Features:</strong> {{ guild.features|join(', ') }}</li>
{% endif %}
{% if guild.description %}
<li class="list-group-item"><strong>Description:</strong> {{ guild.description }}</li>
{% endif %}
</ul>
{% if guild.roles %}
<div class="mb-4">
<h3>Roles</h3>
<ul class="list-group">
{% for role in guild.roles %}
<li class="list-group-item">
<strong>{{ role.name }}</strong>
<span class="text-muted">(ID: {{ role.id }})</span>
{% if role.permissions %}
<br><small>Permissions: {{ role.permissions }}</small>
{% endif %}
{% if role.managed %}
<span class="badge badge-info ml-2">Managed</span>
{% endif %}
{% if role.hoist %}
<span class="badge badge-secondary ml-2">Hoisted</span>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<form method="POST" action="{{ url_for('guild_settings', guild_id=guild.id) }}">
<div class="form-group">
<label for="guildName">Guild Name</label>
<input type="text" class="form-control" id="guildName" name="guild_name" value="{{ guild.name }}"
required>
</div>
<div class="form-group">
<label for="guildDescription">Description</label>
<textarea class="form-control" id="guildDescription"
name="guild_description">{{ guild.description }}</textarea>
</div>
<button type="submit" class="btn btn-primary">Save Settings</button>
</form>
<a href="{{ url_for('home') }}" class="btn btn-secondary mt-3">Back to Home</a>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>
+46
View File
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container mt-5">
<a href="{{ url_for('wallet') }}" class="btn btn-info mt-3">View Wallet</a>
<a href="{{ url_for('transactions') }}" class="btn btn-info mt-3">View Transaction History</a>
<h1>Welcome, {{ user['username'] }}#{{ user['discriminator'] }}</h1>
<img src="https://cdn.discordapp.com/avatars/{{ user['id'] }}/{{ user['avatar'] }}.png" alt="Avatar"
class="img-thumbnail mb-3" width="100">
<p>Total Users: {{ stats.total_users }}</p>
<p>Number of Servers: {{ stats.servers }}</p>
<h2>Your Servers:</h2>
<ul class="list-group">
{% for guild in guilds %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<a href="{{ url_for('guild_settings', guild_id=guild['id']) }}" class="text-decoration-none">
<strong>{{ guild['name'] }}</strong> (ID: {{ guild['id'] }})
</a>
<small class="text-muted">Members: {{ guild.get('approx_member_count', 'N/A') }}</small>
</li>
{% else %}
<li class="list-group-item">You are not in any servers.</li>
{% endfor %}
</ul>
<a href="{{ url_for('logout') }}" class="btn btn-danger mt-3">Logout</a>
</div>
<!-- Bootstrap JS and dependencies -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<title>Discord Bot Dashboard</title>
</head>
<body>
<h1>Discord Bot Dashboard</h1>
<div id="info">
<!-- User info will be displayed here -->
</div>
<script src="{{ url_for('static', filename='script.js') }}"></script>
</body>
</html>
+979
View File
@@ -0,0 +1,979 @@
<!DOCTYPE html>
<html lang="en" class="fixed dark">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="apple-touch-icon" sizes="180x180" href="/static/icons/apple-touch-icon.png?v=6">
<link rel="icon" type="image/png" sizes="32x32" href="/static/icons/favicon-32x32.png?v=6">
<link rel="icon" type="image/png" sizes="16x16" href="/static/icons/favicon-16x16.png?v=6">
<link rel="manifest" href="/static/icons/site.webmanifest?v=6">
<link rel="mask-icon" href="/static/icons/safari-pinned-tab.svg?v=6" color="#5bbad5">
<link rel="shortcut icon" href="/static/icons/favicon.ico?v=6">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="/static/icons/browserconfig.xml?v=6">
<meta name="theme-color" content="#ffffff">
<meta name="apple-mobile-web-app-title" content="YAGPDB">
<meta name="application-name" content="YAGPDB">
<meta name="msapplication-config" content="/static/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<meta property="og:title" content="YAGPDB" />
<meta property="og:description" content="Yet Another General Purpose Discord Bot" />
<title>YAGPDB - Control Panel | Py Test server</title>
<meta name="keywords" content="YAGPDB Discord bot control panel" />
<meta name="description" content="YAGPDB - Yet Another General Purpose Discord Bot">
<meta name="author" content="jonas747">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light"
rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/static/vendorr/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="/static/vendorr/animate/animate.css">
<link rel="stylesheet" href="/static/vendorr/font-awesome/css/all.min.css" />
<link rel="stylesheet" href="/static/vendorr/magnific-popup/magnific-popup.css" />
<link rel="stylesheet" href="/static/vendorr/bootstrap-datepicker/css/bootstrap-datepicker3.css" />
<link rel="stylesheet" href="/static/vendorr/select2/css/select2.css" />
<link rel="stylesheet" href="/static/vendorr/select2-bootstrap-theme/select2-bootstrap.min.css" />
<link rel="stylesheet" href="/static/vendorr/bootstrap-multiselect/bootstrap-multiselect.css" />
<link rel="stylesheet" href="/static/vendorr/pnotify/pnotify.custom.css" />
<link rel="stylesheet" href="/static/css/theme.css?1730494578" />
<link rel="stylesheet" href="/static/css/skins/default.css" />
<link rel="stylesheet" href="/static/css/custom.css?1730494578">
<script src="/static/vendorr/modernizr/modernizr.js"></script>
<script src="/static/vendorr/jquery/jquery.js"></script>
</head>
<body>
<div id="loading-overlay">
<section class="card">
<header class="card-header">
<h2 class="card-title">
Loading...
</h2>
</header>
<div class="card-body d-flex align-items-center">
<div class="loader"></div>
</div>
</section>
</div>
<section class="body">
<header class="header">
<div class="logo-container">
<a href="/manage" class="logo">
<img src="/static/img/avatar.png" height="35" alt="YAGPDB" />
</a>
<div class="d-md-none toggle-sidebar-left" data-toggle-class="sidebar-left-opened" data-target="html"
data-fire-event="sidebar-left-opened">
<i class="fas fa-bars" aria-label="Toggle sidebar"></i>
</div>
</div>
<div class="header-right">
<span class="separator"></span>
<ul class="notifications">
<li>
<a href="#" onclick="toggleTheme()" target="_blank" class="notification-icon"
data-toggle="tooltip" data-placement="bottom" title=""
data-original-title="Toggle light/dark theme">
<i class="fas fa-lightbulb"></i>
</a>
</li>
<li>
<a href="https://discord.gg/4udtcA5" target="_blank" class="notification-icon"
data-toggle="tooltip" data-placement="bottom" title=""
data-original-title="YAGPDB Community and support server">
<i class="fab fa-discord"></i>
</a>
</li>
<li>
<a href="/manage" class="notification-icon" data-toggle="tooltip" data-placement="bottom"
title="" data-original-title="News and updates">
<i class="far fa-newspaper"></i>
</a>
</li>
<li>
<a href="https://help.yagpdb.xyz/" class="notification-icon" target="_blank"
data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Documentation">
<i class="fas fa-question"></i>
</a>
</li>
<li>
<a href="/status" class="notification-icon" data-toggle="tooltip" data-placement="bottom"
title="" data-original-title="Status">
<i class="fas fa-exclamation-triangle"></i>
</a>
</li>
</ul>
<span class="separator"></span>
<div id="server-selection" class="userbox">
<a href="#" data-toggle="dropdown">
<figure class="profile-picture">
<img src="/static/img/questionmark.png" alt="Server Icon" class="rounded-circle" />
</figure>
<div class="profile-info" data-lock-name="Server Name">
<span class="name">Py Test server</span>
<span class="role">loading....</span>
</div>
<i class="fa custom-caret"></i>
</a>
<div class="dropdown-menu">
<ul class="list-unstyled mb-2" style="max-height: 500px; overflow-y: auto;">
<li class="divider"></li>
<li>
<a role="menuitem" tabindex="-1" href="#"><i class="fas fa-wrench"></i>Loading your
servers</a>
</li>
<li>
<a role="menuitem" tabindex="-1" href="#"><i class="fas fa-wrench"></i>Please wait, or
refresh
the page if broken.</a>
</li>
</ul>
</div>
</div>
<script>
$(function () {
loadWidget("server-selection", "/manage/1193182989211926558/guild_selection");
});
</script>
<span class="separator"></span>
<div id="userbox" class="userbox">
<a href="#" data-toggle="dropdown">
<figure class="profile-picture">
<img src="https://cdn.discordapp.com/avatars/601579326714019840/e59bbcd38596410c2c0e9976989a9288?size=64"
alt="Joseph Doe" class="rounded-circle" data-lock-picture="img/!logged-user.jpg" />
</figure>
<div class="profile-info" data-lock-name="nobody2503" data-lock-email="">
<span class="name">Nobody2503</span>
<span class="role">Foreboding</span>
</div>
<i class="fa custom-caret"></i>
</a>
<div class="dropdown-menu">
<ul class="list-unstyled mb-2">
<li class="divider"></li>
<li>
<a role="menuitem" tabindex="-1" href="/logout"><i class="fas fa-power-off"></i>
Logout</a>
</li>
<li>
<a role="menuitem" tabindex="-1" href="/premium"><i class="fas fa-crown"></i>
Premium</a>
</li>
</ul>
</div>
</div>
</div>
</header>
<div class="inner-wrapper">
<style>
@media(min-width: 768px) {
#sidebar-left {
margin-bottom: 0px;
}
}
</style>
<aside id="sidebar-left" class="sidebar-left">
<div class="sidebar-header">
<div class="sidebar-title">
Navigation
</div>
<div class="sidebar-toggle d-none d-md-block" data-toggle-class="sidebar-left-collapsed"
data-target="html" data-fire-event="sidebar-left-toggle">
<i class="fas fa-bars" aria-label="Toggle sidebar"></i>
</div>
</div>
<div class="nano">
<div class="nano-content">
<nav id="menu" class="nav-main" role="navigation">
<ul class="nav nav-main">
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/home">
<i class="fas fa-home" aria-hidden="true"></i>
<span>Home</span>
</a>
</li>
<li class="nav-parent">
<a class="nav-link" href="#">
<i class="fas fa-cogs" aria-hidden="true"></i>
<span>Core</span>
</a>
<ul class="nav nav-children">
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/core">
<i class="fas fa-cog" aria-hidden="true"></i>
<span>Control panel access</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/cplogs">
<i class="fas fa-database" aria-hidden="true"></i>
<span>Control panel logs</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/commands/settings">
<i class="fas fa-terminal" aria-hidden="true"></i>
<span>Command settings</span>
</a>
</li>
</ul>
</li>
<li class="nav-parent">
<a class="nav-link" href="#">
<i class="fas fa-closed-captioning" aria-hidden="true"></i>
<span>Custom Commands</span>
</a>
<ul class="nav nav-children">
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/customcommands">
<i class="fas fa-code" aria-hidden="true"></i>
<span>Commands</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/customcommands/database">
<i class="fas fa-database" aria-hidden="true"></i>
<span>Database</span>
</a>
</li>
</ul>
</li>
<li class="nav-parent">
<a class="nav-link" href="#">
<i class="fas fa-user-shield" aria-hidden="true"></i>
<span>Moderation</span>
</a>
<ul class="nav nav-children">
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/moderation">
<i class="fas fa-gavel" aria-hidden="true"></i>
<span>Moderation</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/automod_legacy">
<i class="fas fa-robot" aria-hidden="true"></i>
<span>Basic Automoderator</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/automod">
<i class="fas fa-robot" aria-hidden="true"></i>
<span>Advanced Automoderator</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/logging/">
<i class="fas fa-database" aria-hidden="true"></i>
<span>Logging</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/verification">
<i class="fas fa-address-card" aria-hidden="true"></i>
<span>Verification</span>
</a>
</li>
</ul>
</li>
<li class="nav-parent ">
<a class="nav-link" href="#">
<i class="fas fa-rss" aria-hidden="true"></i>
<span>Notifications & Feeds</span>
</a>
<ul class="nav nav-children">
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/notifications/general">
<i class="fas fa-bell" aria-hidden="true"></i>
<span>General</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/reddit">
<i class="fab fa-reddit" aria-hidden="true"></i>
<span>Reddit</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/streaming">
<i class="fas fa-video" aria-hidden="true"></i>
<span>Streaming</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/youtube">
<i class="fab fa-youtube" aria-hidden="true"></i>
<span>Youtube</span>
</a>
</li>
</ul>
</li>
<li class="nav-parent">
<a class="nav-link" href="#">
<i class="fas fa-bolt" aria-hidden="true"></i>
<span>Tools & Utilities</span>
</a>
<ul class="nav nav-children">
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/autorole">
<i class="fas fa-user-plus" aria-hidden="true"></i>
<span>Autorole</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/rolecommands/">
<i class="fas fa-tags" aria-hidden="true"></i>
<span>Role Commands</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/tickets/settings">
<i class="fas fa-ticket-alt" aria-hidden="true"></i>
<span>Ticket System</span>
</a>
</li>
</ul>
</li>
<li class="nav-parent">
<a class="nav-link" href="#">
<i class="fas fa-trophy" aria-hidden="true"></i>
<span>Fun</span>
</a>
<ul class="nav nav-children">
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/reputation">
<i class="fas fa-angry" aria-hidden="true"></i>
<span>Reputation</span>
</a>
</li>
<li>
<a class="nav-link" data-partial-load="true"
href="/manage/1193182989211926558/soundboard/">
<i class="fas fa-border-all" aria-hidden="true"></i>
<span>Soundboard</span>
</a>
</li>
</ul>
</li>
<li class="mt-5">
<a class="nav-link" href="https://help.yagpdb.xyz/" target="_blank">
<i class="fas fa-question" aria-hidden="true"></i>
<span>Documentation</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</aside>
<section role="main" id="main-content" class="content-body">
<header class="page-header">
<h2>Combined Overview</h2>
</header>
<script>
$(function () {
showAlerts("null");
$.getJSON("https://srhpyqt94yxb.statuspage.io/api/v2/incidents/unresolved.json", function (data) {
if (data.incidents) {
data.incidents.forEach(function (incident) {
const incidentLink = `<a href="${incident.shortlink}" target="_blank">${incident.name}</a>`
addAlertHTML("warning", `Discord's ${incident.status} an incident: ${incidentLink}. Functionality may be limited.`);
})
}
});
async function startShardOfflineChecker() {
if (typeof window.offlineShardCheckerInterval !== 'undefined') {
clearInterval(window.offlineShardCheckerInterval);
}
let wasOnline = await checkGuildShardOnline();
window.offlineShardCheckerInterval = setInterval(async () => {
const currentlyOnline = await checkGuildShardOnline();
if (!wasOnline && !currentlyOnline) {
upsertAlert(
"The shard the bot is on for your server is currently offline; some functionality may not work as expected. \
Join the support server for more information if this issue persists."
);
} else {
$("#shard-problems-warning").remove();
}
wasOnline = currentlyOnline;
}, 15_000);
}
async function checkGuildShardOnline() {
const status = await fetch("/api/1193182989211926558/status.json").then((resp) => resp.json());
return status.shard_online;
}
function upsertAlert(msg) {
if ($("#shard-problems-warning").length) {
$("#shard-problems-warning alert").text(msg);
} else {
addAlert("warning", msg, "shard-problems-warning");
}
}
startShardOfflineChecker();
})
</script>
<div id="alerts">
</div>
<h2>Core</h2>
<div class="row">
<div class="col-12 col-sm-6 col-md-4" id="home-widget-control_panel">
<section class="card">
<header class="card-header">
<h2 class="card-title">Control Panel</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-premium">
<section class="card">
<header class="card-header">
<h2 class="card-title">Premium</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-commands">
<section class="card">
<header class="card-header">
<h2 class="card-title">Commands</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-custom_commands">
<section class="card">
<header class="card-header">
<h2 class="card-title">Custom Commands</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
</div>
<h2>Moderation</h2>
<div class="row">
<div class="col-12 col-sm-6 col-md-4" id="home-widget-moderation">
<section class="card">
<header class="card-header">
<h2 class="card-title">Moderation</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-legacy_automod">
<section class="card">
<header class="card-header">
<h2 class="card-title">Basic Automoderator</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-automod_v2">
<section class="card">
<header class="card-header">
<h2 class="card-title">Advanced Automoderator</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
</div>
<h2>Misc</h2>
<div class="row">
<div class="col-12 col-sm-6 col-md-4" id="home-widget-reputation">
<section class="card">
<header class="card-header">
<h2 class="card-title">Reputation</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-streaming">
<section class="card">
<header class="card-header">
<h2 class="card-title">Streaming</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-logging">
<section class="card">
<header class="card-header">
<h2 class="card-title">Logging</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-autorole">
<section class="card">
<header class="card-header">
<h2 class="card-title">Autorole</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-soundboard">
<section class="card">
<header class="card-header">
<h2 class="card-title">Soundboard</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-role_commands">
<section class="card">
<header class="card-header">
<h2 class="card-title">RoleCommands</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-tickets">
<section class="card">
<header class="card-header">
<h2 class="card-title">Tickets</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-verification">
<section class="card">
<header class="card-header">
<h2 class="card-title">Verification</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
</div>
<h2>Feeds</h2>
<div class="row">
<div class="col-12 col-sm-6 col-md-4" id="home-widget-notifications">
<section class="card">
<header class="card-header">
<h2 class="card-title">General Notifications</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-reddit">
<section class="card">
<header class="card-header">
<h2 class="card-title">Reddit</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
<div class="col-12 col-sm-6 col-md-4" id="home-widget-youtube">
<section class="card">
<header class="card-header">
<h2 class="card-title">Youtube</h2>
</header>
<div class="card-body">
Loading...
</div>
</section>
</div>
</div>
<script type="text/javascript">
$(function () {
loadWidget("home-widget-control_panel", "/manage/1193182989211926558/homewidgets/control_panel")
loadWidget("home-widget-premium", "/manage/1193182989211926558/homewidgets/premium")
loadWidget("home-widget-commands", "/manage/1193182989211926558/homewidgets/commands")
loadWidget("home-widget-custom_commands", "/manage/1193182989211926558/homewidgets/custom_commands")
loadWidget("home-widget-moderation", "/manage/1193182989211926558/homewidgets/moderation")
loadWidget("home-widget-legacy_automod", "/manage/1193182989211926558/homewidgets/legacy_automod")
loadWidget("home-widget-automod_v2", "/manage/1193182989211926558/homewidgets/automod_v2")
loadWidget("home-widget-reputation", "/manage/1193182989211926558/homewidgets/reputation")
loadWidget("home-widget-streaming", "/manage/1193182989211926558/homewidgets/streaming")
loadWidget("home-widget-logging", "/manage/1193182989211926558/homewidgets/logging")
loadWidget("home-widget-autorole", "/manage/1193182989211926558/homewidgets/autorole")
loadWidget("home-widget-soundboard", "/manage/1193182989211926558/homewidgets/soundboard")
loadWidget("home-widget-role_commands", "/manage/1193182989211926558/homewidgets/role_commands")
loadWidget("home-widget-tickets", "/manage/1193182989211926558/homewidgets/tickets")
loadWidget("home-widget-verification", "/manage/1193182989211926558/homewidgets/verification")
loadWidget("home-widget-notifications", "/manage/1193182989211926558/homewidgets/notifications")
loadWidget("home-widget-reddit", "/manage/1193182989211926558/homewidgets/reddit")
loadWidget("home-widget-youtube", "/manage/1193182989211926558/homewidgets/youtube")
})
</script>
</section>
</div>
</section>
<div id="unsaved-changes-popup" hidden>
<div id="unsaved-changes-popup-container">
<p id="unsaved-changes-message" class="mb-0">blablablablabla</p>
<input id="unsaved-changes-save-button" type="button" class="btn btn-success ml-3" value="Save!"
onclick="saveUnsavedChanges()">
</p>
</div>
<script>
var visibleURL;
var CURRENT_GUILDID = "1193182989211926558";
</script>
<script src="/static/vendorr/jquery-browser-mobile/jquery.browser.mobile.js"></script>
<script src="/static/vendorr/popper/umd/popper.min.js"></script>
<script src="/static/vendorr/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/vendorr/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="/static/vendorr/common/common.js"></script>
<script src="/static/vendorr/nanoscroller/nanoscroller.js"></script>
<script src="/static/vendorr/magnific-popup/jquery.magnific-popup.js"></script>
<script src="/static/vendorr/jquery-placeholder/jquery-placeholder.js"></script>
<script src="/static/vendorr/select2/js/select2.js"></script>
<script src="/static/vendorr/bootstrap-multiselect/bootstrap-multiselect.js?4"></script>
<script src="/static/vendorr/pnotify/pnotify.custom.js"></script>
<script src="/static/js/theme.js"></script>
<script src="/static/js/custom.js"></script>
<script src="/static/js/theme.init.js"></script>
<script src="/static/js/spongebob.js?1730494578"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-63610773-2', 'auto');
ga('send', 'pageview');
</script>
</body>
<script>
var observer = new MutationObserver(function (mutations) {
$("a").filter(function () {
return this.host !== location.host
}).attr("target", "_blank");
});
observer.observe(document.querySelector("body"), { childList: true, subtree: true });
</script>
</html>
+24
View File
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>List Commands</title>
</head>
<body>
<h1>Custom Commands</h1>
<ul>
{% for command in commands %}
<li>
<strong>{{ command.command_name }}</strong>: {{ command.response }}
<form action="{{ url_for('delete_command', command_id=command.id) }}" method="POST" style="display:inline;">
<button type="submit">Delete</button>
</form>
</li>
{% endfor %}
</ul>
<a href="{{ url_for('home') }}">Back to Home</a>
</body>
</html>
+41
View File
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Main Page</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container mt-5 text-center">
<h1>Welcome to the Discord Bot Management Application</h1>
<p class="lead">Manage your Discord servers efficiently and effectively!</p>
<h2>Features:</h2>
<ul class="list-unstyled">
<li>✔️ Add and configure bots</li>
<li>✔️ View your wallet and transactions</li>
<li>✔️ Manage server settings</li>
<li>✔️ Monitor server statistics</li>
</ul>
<a href="{{ url_for('login') }}" class="btn btn-primary btn-lg">Login with Discord</a>
<p class="mt-3">Already have an account? Log in to access your servers and manage your bots.</p>
<h3>Getting Started</h3>
<p>Follow the steps below to begin:</p>
<ol class="list-unstyled">
<li>1. Click the button above to log in with your Discord account.</li>
<li>2. Grant the required permissions for bot management.</li>
<li>3. Start managing your servers and bots!</li>
</ol>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block content %}
<h1>Settings</h1>
<p>Customize your dashboard experience here.</p>
<!-- Add user-specific settings options here -->
{% endblock %}
+181
View File
@@ -0,0 +1,181 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Transaction History</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <!-- Include Chart.js -->
<style>
body {
background-color: #f8f9fa;
}
h1 {
font-size: 2.5rem;
margin-bottom: 20px;
text-align: center;
}
.table {
border-radius: 0.5rem;
overflow: hidden;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.table thead th {
background-color: #007bff;
color: white;
font-weight: bold;
}
.table tbody tr:hover {
background-color: #e2e6ea;
}
.table tbody td {
vertical-align: middle;
}
.amount-positive {
color: rgb(0, 185, 0);
}
.amount-negative {
color: red;
}
.btn-back {
margin-top: 20px;
background-color: #6c757d;
color: white;
}
.btn-back:hover {
background-color: #5a6268;
}
/* Set a fixed height for the chart */
#transactionChart {
width: 100%;
/* Fill the width of the parent container */
height: 400px;
/* Fixed height */
}
.chart-container {
position: relative;
margin: auto;
height: 400px;
/* Set height for the chart container */
width: 80%;
/* Adjust width as needed */
}
</style>
</head>
<body class="bg-light">
<div class="container mt-5">
<h1>Transaction History for {{ user['username'] }}#{{ user['discriminator'] }}</h1>
<!-- Chart Container -->
<div class="chart-container">
<canvas id="transactionChart"></canvas>
</div>
<form method="get" action="{{ url_for('transactions') }}">
<label for="sort">Sort by:</label>
<select name="sort" id="sort">
<option value="date" {% if sort_by=='date' %}selected{% endif %}>Date</option>
<option value="amount" {% if sort_by=='amount' %}selected{% endif %}>Amount</option>
<!-- Add more sorting options as needed -->
</select>
<label for="order">Order:</label>
<select name="order" id="order">
<option value="asc" {% if order=='asc' %}selected{% endif %}>Ascending</option>
<option value="desc" {% if order=='desc' %}selected{% endif %}>Descending</option>
</select>
<button type="submit">Sort</button>
</form>
<table class="table table-bordered mt-3">
<thead>
<tr>
<th>Type</th>
<th>Amount</th>
<th>Time</th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr>
<td>{{ transaction.TYPE }}</td>
<td class="{% if transaction.amount < 0 %}amount-negative{% else %}amount-positive{% endif %}">
${{ transaction.amount }}</td>
<td>{{ transaction.TIME.strftime('%Y-%m-%d %H:%M:%S') }}</td>
</tr>
{% else %}
<tr>
<td colspan="3" class="text-center">No transactions found.</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ url_for('wallet') }}" class="btn btn-secondary mt-3">Back to Wallet</a>
</div>
<script>
// Assuming `dates` and `totals` are provided correctly from Flask.
const dates = {{ dates | tojson }};
const totals = {{ totals | tojson }};
// Log the dates and totals to the console for debugging
console.log("Dates:", dates);
console.log("Totals:", totals);
// Ensure dates are properly formatted
const formattedDates = dates.map(date => new Date(date).toLocaleDateString());
// Chart.js code
const ctx = document.getElementById('transactionChart').getContext('2d');
const transactionChart = new Chart(ctx, {
type: 'line',
data: {
labels: formattedDates,
datasets: [{
label: 'Daily Transaction Totals',
data: totals,
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1,
fill: true,
}]
},
options: {
responsive: true,
maintainAspectRatio: true, // Maintain aspect ratio
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Amount ($)'
}
},
x: {
title: {
display: true,
text: 'Date'
}
}
}
}
});
</script>
</body>
</html>
+26
View File
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wallet</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container mt-5">
<h1>Wallet for {{ user['username'] }}#{{ user['discriminator'] }}</h1>
<h2>Your Balances:</h2>
<ul class="list-group">
<li class="list-group-item">Wallet: ${{ balance.wallet }}</li>
<li class="list-group-item">Bank: ${{ balance.bank }}</li>
</ul>
<a href="{{ url_for('home') }}" class="btn btn-secondary mt-3">Back to Home</a>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>
Executable
+1
View File
@@ -0,0 +1 @@
1739835509.5274603