Update project configuration files, and API routes accordingly. Add SQLite runtime file ignores to .gitignore for better file management.
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
# ╔══════════════════════════════════════════════════════════════════╗
|
||||
# ║ ║
|
||||
# ║ ░█▀▀░█▀█░█▀▄░█▀▀░█░█ ░█▀▄░█▀▀░█░█░█▀▀ ║
|
||||
# ║ ░█░░░█░█░█░█░█▀▀░▄▀▄ ░█░█░█▀▀░▀▄▀░▀▀█ ║
|
||||
# ║ ░▀▀▀░▀▀▀░▀▀░░▀▀▀░▀░▀ ░▀▀░░▀▀▀░░▀░░▀▀▀ ║
|
||||
# ║ +-+-+-+-+-+-+-+-+ ║
|
||||
# ║ |H|e|x|a|H|o|s|t| ║
|
||||
# ║ +-+-+-+-+-+-+-+-+ ║
|
||||
# ║ ║
|
||||
# ║ © 2026 CodeX Devs — All Rights Reserved ║
|
||||
# ║ © 2026 HexaHost — All Rights Reserved ║
|
||||
# ║ ║
|
||||
# ║ discord ── https://discord.gg/codexdev ║
|
||||
# ║ youtube ── https://youtube.com/@CodeXDevs ║
|
||||
# ║ github ── https://github.com/RayExo ║
|
||||
# ║ discord ── https://discord.gg/hexahost ║
|
||||
# ║ github ── https://github.com/theoneandonlymace ║
|
||||
# ║ ║
|
||||
# ╚══════════════════════════════════════════════════════════════════╝
|
||||
|
||||
@@ -18,10 +17,10 @@ from discord.ext import commands
|
||||
from core import Context
|
||||
from utils.emoji import DENIED
|
||||
import aiosqlite
|
||||
import asyncio
|
||||
from utils.db_paths import db_path, bot_root_json_path
|
||||
|
||||
async def setup_db():
|
||||
async with aiosqlite.connect('db/prefix.db') as db:
|
||||
async with aiosqlite.connect(db_path('prefix.db')) as db:
|
||||
await db.execute('''
|
||||
CREATE TABLE IF NOT EXISTS prefixes (
|
||||
guild_id INTEGER PRIMARY KEY,
|
||||
@@ -31,10 +30,8 @@ async def setup_db():
|
||||
await db.commit()
|
||||
|
||||
|
||||
asyncio.run(setup_db())
|
||||
|
||||
async def is_topcheck_enabled(guild_id: int):
|
||||
async with aiosqlite.connect('db/topcheck.db') as db:
|
||||
async with aiosqlite.connect(db_path('topcheck.db')) as db:
|
||||
async with db.execute("SELECT enabled FROM topcheck WHERE guild_id = ?", (guild_id,)) as cursor:
|
||||
row = await cursor.fetchone()
|
||||
return row is not None and row[0] == 1
|
||||
@@ -80,17 +77,17 @@ def getIgnore(guild_id):
|
||||
"bypassuser": [],
|
||||
"commands": []
|
||||
}
|
||||
return get_or_create_guild_config("ignore.json", guild_id, default_config)
|
||||
return get_or_create_guild_config(bot_root_json_path("ignore.json"), guild_id, default_config)
|
||||
|
||||
def updateignore(guild_id, data):
|
||||
update_guild_config("ignore.json", guild_id, data)
|
||||
update_guild_config(bot_root_json_path("ignore.json"), guild_id, data)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async def getConfig(guildID):
|
||||
async with aiosqlite.connect('db/prefix.db') as db:
|
||||
async with aiosqlite.connect(db_path('prefix.db')) as db:
|
||||
async with db.execute("SELECT prefix FROM prefixes WHERE guild_id = ?", (guildID,)) as cursor:
|
||||
row = await cursor.fetchone()
|
||||
if row:
|
||||
@@ -101,7 +98,7 @@ async def getConfig(guildID):
|
||||
return defaultConfig
|
||||
|
||||
async def updateConfig(guildID, data):
|
||||
async with aiosqlite.connect('db/prefix.db') as db:
|
||||
async with aiosqlite.connect(db_path('prefix.db')) as db:
|
||||
await db.execute(
|
||||
"INSERT OR REPLACE INTO prefixes (guild_id, prefix) VALUES (?, ?)",
|
||||
(guildID, data["prefix"])
|
||||
@@ -118,7 +115,7 @@ def restart_program():
|
||||
def blacklist_check():
|
||||
|
||||
async def predicate(ctx):
|
||||
async with aiosqlite.connect('db/block.db') as db:
|
||||
async with aiosqlite.connect(db_path('block.db')) as db:
|
||||
cursor = await db.execute("SELECT 1 FROM user_blacklist WHERE user_id = ?", (str(ctx.author.id),))
|
||||
user_blacklisted = await cursor.fetchone()
|
||||
if user_blacklisted:
|
||||
@@ -135,7 +132,7 @@ def blacklist_check():
|
||||
|
||||
|
||||
async def get_ignore_data(guild_id: int) -> dict:
|
||||
async with aiosqlite.connect("db/ignore.db") as db:
|
||||
async with aiosqlite.connect(db_path("ignore.db")) as db:
|
||||
data = {
|
||||
"channel": set(),
|
||||
"user": set(),
|
||||
|
||||
Reference in New Issue
Block a user