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
|
||||
import aiosqlite
|
||||
@@ -27,7 +27,7 @@ class Media(commands.Cog):
|
||||
|
||||
|
||||
async def set_db(self):
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
await db.execute('''
|
||||
CREATE TABLE IF NOT EXISTS media_channels (
|
||||
guild_id INTEGER PRIMARY KEY,
|
||||
@@ -62,7 +62,7 @@ class Media(commands.Cog):
|
||||
@commands.cooldown(1, 3, commands.BucketType.user)
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def setup(self, ctx, *, channel: discord.TextChannel):
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
async with db.execute('SELECT channel_id FROM media_channels WHERE guild_id = ?', (ctx.guild.id,)) as cursor:
|
||||
result = await cursor.fetchone()
|
||||
if result:
|
||||
@@ -80,7 +80,7 @@ class Media(commands.Cog):
|
||||
@commands.cooldown(1, 3, commands.BucketType.user)
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def remove(self, ctx):
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
async with db.execute('SELECT channel_id FROM media_channels WHERE guild_id = ?', (ctx.guild.id,)) as cursor:
|
||||
result = await cursor.fetchone()
|
||||
if not result:
|
||||
@@ -98,7 +98,7 @@ class Media(commands.Cog):
|
||||
@commands.cooldown(1, 3, commands.BucketType.user)
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def config(self, ctx):
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
async with db.execute('SELECT channel_id FROM media_channels WHERE guild_id = ?', (ctx.guild.id,)) as cursor:
|
||||
result = await cursor.fetchone()
|
||||
if not result:
|
||||
@@ -124,7 +124,7 @@ class Media(commands.Cog):
|
||||
@commands.cooldown(1, 3, commands.BucketType.user)
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def bypass_add(self, ctx, user: discord.Member):
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
async with db.execute('SELECT COUNT(*) FROM media_bypass WHERE guild_id = ?', (ctx.guild.id,)) as cursor:
|
||||
count = await cursor.fetchone()
|
||||
if count[0] >= 25:
|
||||
@@ -148,7 +148,7 @@ class Media(commands.Cog):
|
||||
@commands.cooldown(1, 3, commands.BucketType.user)
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def bypass_remove(self, ctx, user: discord.Member):
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
async with db.execute('SELECT 1 FROM media_bypass WHERE guild_id = ? AND user_id = ?', (ctx.guild.id, user.id)) as cursor:
|
||||
result = await cursor.fetchone()
|
||||
if not result:
|
||||
@@ -166,7 +166,7 @@ class Media(commands.Cog):
|
||||
@commands.cooldown(1, 3, commands.BucketType.user)
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def bypass_show(self, ctx):
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
async with db.execute('SELECT user_id FROM media_bypass WHERE guild_id = ?', (ctx.guild.id,)) as cursor:
|
||||
result = await cursor.fetchall()
|
||||
if not result:
|
||||
@@ -183,16 +183,16 @@ class Media(commands.Cog):
|
||||
if message.author.bot:
|
||||
return
|
||||
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
async with db.execute('SELECT channel_id FROM media_channels WHERE guild_id = ?', (message.guild.id,)) as cursor:
|
||||
media_channel = await cursor.fetchone()
|
||||
|
||||
if media_channel and message.channel.id == media_channel[0]:
|
||||
async with aiosqlite.connect('db/block.db') as block_db:
|
||||
async with aiosqlite.connect(db_path('block.db')) as block_db:
|
||||
async with block_db.execute('SELECT 1 FROM user_blacklist WHERE user_id = ?', (message.author.id,)) as cursor:
|
||||
blacklisted = await cursor.fetchone()
|
||||
|
||||
async with aiosqlite.connect('db/media.db') as db:
|
||||
async with aiosqlite.connect(db_path('media.db')) as db:
|
||||
async with db.execute('SELECT 1 FROM media_bypass WHERE guild_id = ? AND user_id = ?', (message.guild.id, message.author.id)) as cursor:
|
||||
bypassed = await cursor.fetchone()
|
||||
|
||||
@@ -221,7 +221,7 @@ class Media(commands.Cog):
|
||||
]
|
||||
|
||||
if len(self.infractions[message.author.id]) >= 5:
|
||||
async with aiosqlite.connect('db/block.db') as block_db:
|
||||
async with aiosqlite.connect(db_path('block.db')) as block_db:
|
||||
await block_db.execute('INSERT OR IGNORE INTO user_blacklist (user_id) VALUES (?)', (message.author.id,))
|
||||
|
||||
await block_db.commit()
|
||||
|
||||
Reference in New Issue
Block a user