From 282ca4374a42187a9d1c8e86864ae3e9d114cf17 Mon Sep 17 00:00:00 2001 From: Xargana Date: Fri, 9 May 2025 22:43:55 +0300 Subject: [PATCH] i left skid marks in the code --- app.py | 413 ++------------------------------ bot/cogs/__init__.py | 1 + bot/cogs/admin_commands.py | 129 ++++++++++ bot/cogs/afk_commands.py | 96 ++++++++ bot/cogs/cog_commands.py | 85 +++++++ bot/cogs/fun_commands.py | 72 ++++++ bot/cogs/test_commands.py | 104 ++++++++ bot/cogs/tracking.py | 98 ++++++++ bot/cogs/user_management.py | 47 ++++ bot/cogs/utility_commands.py | 215 +++++++++++++++++ bot/handlers/__init__.py | 2 +- bot/handlers/message_handler.py | 132 +++------- bot/selfbot.py | 71 +++--- 13 files changed, 942 insertions(+), 523 deletions(-) create mode 100644 bot/cogs/__init__.py create mode 100644 bot/cogs/admin_commands.py create mode 100644 bot/cogs/afk_commands.py create mode 100644 bot/cogs/cog_commands.py create mode 100644 bot/cogs/fun_commands.py create mode 100644 bot/cogs/test_commands.py create mode 100644 bot/cogs/tracking.py create mode 100644 bot/cogs/user_management.py create mode 100644 bot/cogs/utility_commands.py diff --git a/app.py b/app.py index bffc73c..8f3bf27 100644 --- a/app.py +++ b/app.py @@ -1,402 +1,25 @@ -import random import discord import asyncio -import traceback -import random -import datetime +import logging import os -import importlib.util -import ast -import websockets -import json -import difflib -import io -import gzip -import re -from dotenv import load_dotenv +from bot.selfbot import SelfBot +from config import TOKEN -# Load environment variables from .env file -load_dotenv() - -time_regex = re.compile(r'(\d+)([smhd])') # Matches 4m2s, 1h30m, etc. - -def parse_time(time_str): - units = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400} - total_seconds = sum(int(amount) * units[unit] for amount, unit in time_regex.findall(time_str)) - return total_seconds if total_seconds > 0 else None - -COMMANDS_DIR = "commands" -os.makedirs(COMMANDS_DIR, exist_ok=True) - -def load_commands(): - commands = {} - for filename in os.listdir(COMMANDS_DIR): - if filename.endswith(".py"): - cmd_name = filename[:-3] - cmd_path = os.path.join(COMMANDS_DIR, filename) - - spec = importlib.util.spec_from_file_location(cmd_name, cmd_path) - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - - if hasattr(module, "run") and callable(module.run): - commands[cmd_name] = module.run - return commands -# Add a tracking file to save channel IDs -TRACKED_CHANNELS_FILE = "tracked_channels.json" - -def load_tracked_channels(): - if os.path.exists(TRACKED_CHANNELS_FILE): - with open(TRACKED_CHANNELS_FILE, 'r') as f: - return json.load(f) - return [] - -def save_tracked_channels(tracked_channels): - with open(TRACKED_CHANNELS_FILE, 'w') as f: - json.dump(tracked_channels, f) - -async def handle_blacklist(message): - if message.author in [696800726084747314]: - await message.reply("no") - -class Selfbot(discord.Client): - def __init__(self): - super().__init__() - self.default_status = None - self.loaded_commands = load_commands() - self.tracked_channels = load_tracked_channels() - self.last_status = {} - self.AFK_STATUS = False # Static variable to track AFK status - self.AFK_NOTIFIED_USERS = [] # Static list to store users notified of AFK status - self.horsin = [] - async def on_ready(self): - print(f"Logged in as {self.user}") - async def handle_afk_dm(self,message): - if self.AFK_STATUS and message.author.id not in self.AFK_NOTIFIED_USERS: - await message.reply( - "Heya, I'm not at my computer right now, if you're requesting something please follow . I'll let you know when I'm back :) \n\n-# This action was automated." - ) - self.AFK_NOTIFIED_USERS.append(message.author.id) - async def on_message(self, message): - if message.author.id == 1169111190824308768 and "<@1236667927944761396>" in message.content: - await message.reply("shut the fuck up") - - if message.content.startswith(".remindme "): - await handle_blacklist(message) - - parts = message.content.split(" ", 2) - if len(parts) < 3: - await message.reply("Usage: `.remindme