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,16 +1,16 @@
|
||||
# ╔══════════════════════════════════════════════════════════════════╗
|
||||
# ║ ║
|
||||
# ║ ░█▀▀░█▀█░█▀▄░█▀▀░█░█ ░█▀▄░█▀▀░█░█░█▀▀ ║
|
||||
# ║ ░█░░░█░█░█░█░█▀▀░▄▀▄ ░█░█░█▀▀░▀▄▀░▀▀█ ║
|
||||
# ║ ░▀▀▀░▀▀▀░▀▀░░▀▀▀░▀░▀ ░▀▀░░▀▀▀░░▀░░▀▀▀ ║
|
||||
# ║ +-+-+-+-+-+-+-+-+ ║
|
||||
# ║ |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 ║
|
||||
# ║ ║
|
||||
# ╚══════════════════════════════════════════════════════════════════╝
|
||||
from utils.db_paths import db_path
|
||||
|
||||
import discord
|
||||
from utils.emoji import CROSS, TICK
|
||||
@@ -37,7 +37,7 @@ class Block(commands.Cog):
|
||||
|
||||
#@commands.Cog.listener()
|
||||
async def set_db(self):
|
||||
async with aiosqlite.connect('db/block.db') as db:
|
||||
async with aiosqlite.connect(db_path('block.db')) as db:
|
||||
await db.execute('''
|
||||
CREATE TABLE IF NOT EXISTS user_blacklist (
|
||||
user_id INTEGER PRIMARY KEY,
|
||||
@@ -71,7 +71,7 @@ class Block(commands.Cog):
|
||||
@user.command(name="add", help="Adds a user to the blacklist.")
|
||||
@commands.is_owner()
|
||||
async def add_user(self, ctx, user: discord.User):
|
||||
async with aiosqlite.connect('db/block.db') as db:
|
||||
async with aiosqlite.connect(db_path('block.db')) as db:
|
||||
cursor = await db.execute('SELECT user_id FROM user_blacklist WHERE user_id = ?', (user.id,))
|
||||
if await cursor.fetchone():
|
||||
await ctx.reply(view=CV2("User Already Blacklisted", f"{user.mention} is already blacklisted."))
|
||||
@@ -83,7 +83,7 @@ class Block(commands.Cog):
|
||||
@user.command(name="remove", help="Remove a user from the blacklist.")
|
||||
@commands.is_owner()
|
||||
async def remove_user(self, ctx, user: discord.User):
|
||||
async with aiosqlite.connect('db/block.db') as db:
|
||||
async with aiosqlite.connect(db_path('block.db')) as db:
|
||||
cursor = await db.execute('SELECT user_id FROM user_blacklist WHERE user_id = ?', (user.id,))
|
||||
if not await cursor.fetchone():
|
||||
await ctx.reply(view=CV2(f"{CROSS} User Not Blacklisted", f"{user.mention} is not in the blacklist."))
|
||||
@@ -95,7 +95,7 @@ class Block(commands.Cog):
|
||||
@user.command(name="show", aliases=["list"], help="Shows all Blacklisted users.")
|
||||
@commands.is_owner()
|
||||
async def show_users(self, 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 user_id FROM user_blacklist')
|
||||
rows = await cursor.fetchall()
|
||||
if not rows:
|
||||
@@ -135,7 +135,7 @@ class Block(commands.Cog):
|
||||
@guild.command(name="add", help="Adds a guild to the blacklist.")
|
||||
@commands.is_owner()
|
||||
async def add_guild(self, ctx, guild_id: int):
|
||||
async with aiosqlite.connect('db/block.db') as db:
|
||||
async with aiosqlite.connect(db_path('block.db')) as db:
|
||||
cursor = await db.execute('SELECT guild_id FROM guild_blacklist WHERE guild_id = ?', (guild_id,))
|
||||
if await cursor.fetchone():
|
||||
await ctx.reply(view=CV2(f"{CROSS} Guild Already Blacklisted", f"Guild with ID `{guild_id}` is already blacklisted."))
|
||||
@@ -147,7 +147,7 @@ class Block(commands.Cog):
|
||||
@guild.command(name="remove", help="Remove a guild from the blacklist.")
|
||||
@commands.is_owner()
|
||||
async def remove_guild(self, ctx, guild_id: int):
|
||||
async with aiosqlite.connect('db/block.db') as db:
|
||||
async with aiosqlite.connect(db_path('block.db')) as db:
|
||||
cursor = await db.execute('SELECT guild_id FROM guild_blacklist WHERE guild_id = ?', (guild_id,))
|
||||
if not await cursor.fetchone():
|
||||
await ctx.reply(view=CV2(f"{CROSS} Guild Not Blacklisted", f"Guild with ID `{guild_id}` is not in the blacklist."))
|
||||
@@ -160,7 +160,7 @@ class Block(commands.Cog):
|
||||
@guild.command(name="show", aliases=["list"], help="Shows the list of blacklisted guilds")
|
||||
@commands.is_owner()
|
||||
async def show_guilds(self, 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 guild_id FROM guild_blacklist')
|
||||
rows = await cursor.fetchall()
|
||||
if not rows:
|
||||
|
||||
Reference in New Issue
Block a user