From d5985aa1026279a80251576210a9a411ff959c02 Mon Sep 17 00:00:00 2001 From: RayExo Date: Thu, 16 Jul 2026 12:52:33 +0530 Subject: [PATCH] CodeX --- bot/.env.example | 3 ++ bot/CodeX.py | 2 +- bot/cogs/commands/autorole.py | 3 +- bot/cogs/commands/dms.py | 8 ++---- bot/cogs/commands/emergency.py | 15 ++++------ bot/cogs/commands/extraown.py | 3 +- bot/cogs/commands/nightmode.py | 3 +- bot/cogs/commands/np.py | 6 ++-- bot/cogs/commands/owner.py | 8 +++--- bot/cogs/events/react.py | 9 ++++-- bot/cogs/events/react3.txt | 50 ---------------------------------- bot/utils/config.py | 35 +++++++++++++++++++----- 12 files changed, 58 insertions(+), 87 deletions(-) delete mode 100644 bot/cogs/events/react3.txt diff --git a/bot/.env.example b/bot/.env.example index ad3c7f2..e241963 100644 --- a/bot/.env.example +++ b/bot/.env.example @@ -2,6 +2,9 @@ TOKEN = TOKEN_HERE brand_name='ZyroX' NEXT_PUBLIC_BRAND_NAME='ZyroX' +# Owner +OWNER_IDS=870179991462236170,767979794411028491 + # LAVALINK CONFIG LAVALINK_HOST="lavalink.jirayu.net" LAVALINK_PASSWORD="youshallnotpass" diff --git a/bot/CodeX.py b/bot/CodeX.py index b7faafd..c30a2db 100644 --- a/bot/CodeX.py +++ b/bot/CodeX.py @@ -125,7 +125,7 @@ async def on_guild_join(guild: discord.Guild): @client.event async def on_command_completion(context: commands.Context) -> None: - if context.author.id == 870179991462236170: + if context.author.id in OWNER_IDS: return full_command_name = context.command.qualified_name diff --git a/bot/cogs/commands/autorole.py b/bot/cogs/commands/autorole.py index 9a30023..57c98c5 100644 --- a/bot/cogs/commands/autorole.py +++ b/bot/cogs/commands/autorole.py @@ -22,6 +22,7 @@ from typing import List, Dict from discord.ui import LayoutView, TextDisplay, Separator, Container from utils.Tools import * from utils.cv2 import CV2, build_container +from utils.config import OWNER_IDS @@ -39,7 +40,7 @@ class BasicView(discord.ui.View): self.ctx = ctx async def interaction_check(self, interaction: discord.Interaction): - if interaction.user.id != self.ctx.author.id and interaction.user.id not in [870179991462236170]: + if interaction.user.id != self.ctx.author.id and interaction.user.id not in OWNER_IDS: await interaction.response.send_message("Uh oh! That message doesn't belong to you.\nYou must run this command to interact with it.", ephemeral=True) return False return True diff --git a/bot/cogs/commands/dms.py b/bot/cogs/commands/dms.py index ad0f7fd..edb8392 100644 --- a/bot/cogs/commands/dms.py +++ b/bot/cogs/commands/dms.py @@ -16,11 +16,7 @@ import discord from discord.ui import LayoutView, TextDisplay, Separator, Container, Button, ActionRow from discord.ext import commands from utils.cv2 import CV2, build_container - -authorized_staff_ids = [ - 1263404140965396555, - 767979794411028491 -] +from utils.config import STAFF_IDS class SuccessView(LayoutView): @@ -88,7 +84,7 @@ class StaffDMCog(commands.Cog): @commands.command(name="dmstaff") async def dm_staff(self, ctx, member: discord.Member, *, message: str): - if ctx.author.id not in authorized_staff_ids: + if ctx.author.id not in STAFF_IDS: view = PermissionErrorView() await ctx.reply(view=view) return diff --git a/bot/cogs/commands/emergency.py b/bot/cogs/commands/emergency.py index eb6961c..b70bf45 100644 --- a/bot/cogs/commands/emergency.py +++ b/bot/cogs/commands/emergency.py @@ -19,6 +19,7 @@ from discord.ext import commands import aiosqlite from utils.Tools import * from utils.cv2 import CV2, build_container +from utils.config import OWNER_IDS_STR class EmergencyRestoreConfirmView(LayoutView): @@ -419,9 +420,7 @@ class Emergency(commands.Cog): @commands.cooldown(1, 4, commands.BucketType.user) @commands.guild_only() async def enable(self, ctx): - if ctx.author.id != ctx.guild.owner_id and str(ctx.author.id) not in [ - "870179991462236170" - ]: + if ctx.author.id != ctx.guild.owner_id and str(ctx.author.id) not in OWNER_IDS_STR: return await ctx.reply(view=EnableErrorView()) dangerous_perms = [ "administrator", @@ -460,9 +459,7 @@ class Emergency(commands.Cog): @commands.cooldown(1, 4, commands.BucketType.user) @commands.guild_only() async def disable(self, ctx): - if ctx.author.id != ctx.guild.owner_id and str(ctx.author.id) not in [ - "870179991462236170" - ]: + if ctx.author.id != ctx.guild.owner_id and str(ctx.author.id) not in OWNER_IDS_STR: return await ctx.reply(view=DisableErrorView()) async with aiosqlite.connect(self.db_path) as db: await db.execute( @@ -626,7 +623,7 @@ class Emergency(commands.Cog): async def emergencysituation(self, ctx): if not await self.is_guild_owner_or_authorised(ctx) and str( ctx.author.id - ) not in ["870179991462236170"]: + ) not in OWNER_IDS_STR: return await ctx.reply(view=EmergencySituationErrorView("access")) proc_msg = await ctx.reply( @@ -746,9 +743,7 @@ class Emergency(commands.Cog): @commands.guild_only() @commands.bot_has_permissions(manage_roles=True) async def emergencyrestore(self, ctx): - if ctx.author.id != ctx.guild.owner_id and str(ctx.author.id) not in [ - "870179991462236170" - ]: + if ctx.author.id != ctx.guild.owner_id and str(ctx.author.id) not in OWNER_IDS_STR: return await ctx.reply(view=EmergencyRestoreAccessErrorView()) async with aiosqlite.connect(self.db_path) as db: diff --git a/bot/cogs/commands/extraown.py b/bot/cogs/commands/extraown.py index 3fe2018..1e17028 100644 --- a/bot/cogs/commands/extraown.py +++ b/bot/cogs/commands/extraown.py @@ -19,6 +19,7 @@ from discord.ui import LayoutView, TextDisplay, Separator, Container, ActionRow, import aiosqlite from utils.Tools import * from utils.cv2 import CV2, build_container +from utils.config import OWNER_IDS_STR @@ -106,7 +107,7 @@ class Extraowner(commands.Cog): if ctx.guild.member_count < 2: return await ctx.send(view=CV2(f"{CROSS} Error", "Your Server Doesn't Meet My 30 Member Criteria")) - Ray = ['870179991462236170','767979794411028491'] + Ray = OWNER_IDS_STR if ctx.author.id != ctx.guild.owner_id and str(ctx.author.id) not in Ray: return await ctx.send(view=CV2(f"{ZWARNING} Access Denied", "Only Server Owner Can Run This Command")) diff --git a/bot/cogs/commands/nightmode.py b/bot/cogs/commands/nightmode.py index 987c4ab..1cb897c 100644 --- a/bot/cogs/commands/nightmode.py +++ b/bot/cogs/commands/nightmode.py @@ -19,6 +19,7 @@ import os from utils.Tools import * from utils.cv2 import CV2 from discord.ui import TextDisplay, Separator, ActionRow, LayoutView, Container +from utils.config import OWNER_IDS_STR # Database setup db_folder = "db" @@ -30,7 +31,7 @@ class Nightmode(commands.Cog): def __init__(self, bot): self.bot = bot self.bot.loop.create_task(self.initialize_db()) - self.ricky = ["870179991462236170", "767979794411028491"] + self.ricky = OWNER_IDS_STR self.color = 0xFF0000 async def initialize_db(self): diff --git a/bot/cogs/commands/np.py b/bot/cogs/commands/np.py index 1139c7d..fdcfabd 100644 --- a/bot/cogs/commands/np.py +++ b/bot/cogs/commands/np.py @@ -418,7 +418,7 @@ class NoPrefix(commands.Cog): url=user.display_avatar.url if user.avatar else user.default_avatar.url ) embed_log.set_footer(text="No Prefix Removal Log") - await log_channel.send("<@870179991462236170>", view=embed_log) + await log_channel.send(" ".join(f"<@{oid}>" for oid in OWNER_IDS), view=embed_log) @_np.command( name="status", help="Check if a user is in the No Prefix list and show details." @@ -544,7 +544,7 @@ class NoPrefix(commands.Cog): description=f"**User**: **[{after}](https://discord.com/users/{after.id})** (ID: {after.id})\n**Server**: {after.guild.name}", color=0xFF0000, ) - message = await log_channel.send("<@870179991462236170>", view=embed) + message = await log_channel.send(" ".join(f"<@{oid}>" for oid in OWNER_IDS), view=embed) await message.publish() elif before.premium_since is not None and after.premium_since is None: @@ -569,7 +569,7 @@ class NoPrefix(commands.Cog): description=f"**User**: **[{user}](https://discord.com/users/{user.id})** (ID: {user.id})\n**Server**: {user.guild.name}", color=0xFF0000, ) - message = await log_channel.send("<@870179991462236170>", view=embed) + message = await log_channel.send(" ".join(f"<@{oid}>" for oid in OWNER_IDS), view=embed) await message.publish() async def add_np(self, user, duration): diff --git a/bot/cogs/commands/owner.py b/bot/cogs/commands/owner.py index 62a10be..f0b4f9a 100644 --- a/bot/cogs/commands/owner.py +++ b/bot/cogs/commands/owner.py @@ -24,7 +24,7 @@ import aiosqlite from typing import Optional from utils import Paginator, DescriptionEmbedPaginator, FieldPagePaginator, TextPaginator from utils.Tools import * -from utils.config import OWNER_IDS +from utils.config import OWNER_IDS, BOT_OWNER_IDS from utils.emoji import BOOSTS, DISCORD_BADGE_EMOJIS, LOADINGRED, NITRO_BOOST, TICK, ZWARNING from core import Cog, zyrox, Context import sqlite3 @@ -32,7 +32,7 @@ import os import requests import numpy as np from io import BytesIO -from utils.config import OWNER_IDS +from utils.config import OWNER_IDS, BOT_OWNER_IDS from discord.errors import Forbidden from discord import Embed from discord.ui import Button, View @@ -42,7 +42,7 @@ from utils.config import * # --- Configuration & Helpers --- -OWNER_IDS = [1258831252748894436] +# OWNER_IDS and BOT_OWNER_IDS are imported from utils.config — edit .env to change them # Your custom bot badges, including Family and Developer BADGE_URLS = { @@ -138,7 +138,7 @@ class Owner(commands.Cog): self.np_cache = [] self.db_path = 'db/np.db' self.stop_tour = False - self.bot_owner_ids = [870179991462236170,1432771000629596225,1382744437049790495] + self.bot_owner_ids = BOT_OWNER_IDS self.client.loop.create_task(self.setup_database()) self.client.loop.create_task(self.load_staff()) diff --git a/bot/cogs/events/react.py b/bot/cogs/events/react.py index d1f0601..fde4715 100644 --- a/bot/cogs/events/react.py +++ b/bot/cogs/events/react.py @@ -15,6 +15,7 @@ import discord from utils.emoji import ACTIVE_DEVELOPER, BLACKCROWN, MINGLE, STAFF from discord.ext import commands +from utils.config import OWNER_IDS import asyncio class React(commands.Cog): @@ -29,17 +30,19 @@ class React(commands.Cog): for owner in self.bot.owner_ids: if f"<@{owner}>" in message.content: try: - if owner == 870179991462236170: + # Primary owner (first in OWNER_IDS) gets an extra emoji + if owner == OWNER_IDS[0]: emojis = [ BLACKCROWN, ACTIVE_DEVELOPER, STAFF, - MINGLE ] + MINGLE, + ] else: emojis = [ BLACKCROWN, ACTIVE_DEVELOPER, - STAFF + STAFF, ] for emoji in emojis: diff --git a/bot/cogs/events/react3.txt b/bot/cogs/events/react3.txt deleted file mode 100644 index a6ed1a7..0000000 --- a/bot/cogs/events/react3.txt +++ /dev/null @@ -1,50 +0,0 @@ -import discord -from utils.emoji import CODED, CUTE_CUTE_CUTE, GIFD, GIFN, HAPPY_PANDA, HEADMOD, HEART_EM, HEERIYE, KING, KING_ALT1, MAX__A, RACECAR64, REDHEART, SG_RD, STAR, STAR_ALT1, STAR_ALT2, ZBAN, _37496ALERT -from discord.ext import commands -import asyncio - -class React(commands.Cog): - - def __init__(self, bot): - self.bot = bot - - @commands.Cog.listener() - async def on_message(self, message): - if message.author.bot: - return - for owner in self.bot.owner_ids: - if f"<@{owner}>" in message.content: - try: - if owner == 870179991462236170: - - emojis = [ - KING, - f"{ZBAN} ", - STAR, - CUTE_CUTE_CUTE, - HAPPY_PANDA, - _37496ALERT, - CODED, - RACECAR64, - GIFD, - GIFN, - MAX__A, - HEERIYE, - HEART_EM, - STAR_ALT1, - KING_ALT1, - HEADMOD, - f"{SG_RD} ", - REDHEART, - f" {STAR_ALT2}" - ] - for emoji in emojis: - await message.add_reaction(emoji) - else: - - await message.add_reaction(f"{KING},{RACECAR64},{CODED}") - except discord.errors.RateLimited as e: - await asyncio.sleep(e.retry_after) - await message.add_reaction(f"{KING},{RACECAR64},{CODED}") - except Exception as e: - print(f"An unexpected error occurred Auto react owner mention: {e}") diff --git a/bot/utils/config.py b/bot/utils/config.py index 7bec54f..0a1b43d 100644 --- a/bot/utils/config.py +++ b/bot/utils/config.py @@ -17,12 +17,33 @@ from dotenv import load_dotenv load_dotenv() -TOKEN = os.environ.get("TOKEN") +TOKEN = os.environ.get("TOKEN") BRAND_NAME = os.environ.get("brand_name", "Zyrox X") -NAME = BRAND_NAME -server = "https://discord.gg/codexdev" -ch = "https://discord.com/channels/699587669059174461/1271825678710476911" -OWNER_IDS = [870179991462236170] -BotName = BRAND_NAME +NAME = BRAND_NAME +BotName = BRAND_NAME + +server = "https://discord.gg/codexdev" serverLink = "https://discord.gg/codexdev" -CMD_WEBHOOK_URL = os.getenv("CMD_WEBHOOK_URL") \ No newline at end of file +ch = "https://discord.com/channels/699587669059174461/1271825678710476911" + +CMD_WEBHOOK_URL = os.getenv("CMD_WEBHOOK_URL") + +# ── Owner / Staff IDs ───────────────────────────────────────────────────────── +# Edit OWNER_IDS in .env — comma-separated, no spaces needed. +# Example: OWNER_IDS = 870179991462236170,767979794411028491,1432771000629596225 + +def _parse_ids(env_key: str, defaults: list[int]) -> list[int]: + raw = os.getenv(env_key, "").strip() + if not raw: + return defaults + ids = [int(p.strip()) for p in raw.split(",") if p.strip().isdigit()] + return ids or defaults + +OWNER_IDS: list[int] = _parse_ids("OWNER_IDS", [870179991462236170]) +OWNER_IDS_STR: list[str] = [str(i) for i in OWNER_IDS] + +# Aliases kept for backwards compatibility with files that import these names +BOT_OWNER_IDS = OWNER_IDS +BOT_OWNER_IDS_STR = OWNER_IDS_STR +STAFF_IDS = OWNER_IDS +STAFF_IDS_STR = OWNER_IDS_STR \ No newline at end of file