Polo Gamer

i want u to make me a bot with components v2 for discord with a storage system and env file etc prefix $ bot token; <redacted> bot name; Scam Files (it will display in help command etc) staff role; 1556800910724833350 it will be able to use report trust etc commands commands: help - shows all the commands and how to use and what they do server invitelink/invitecode/or any type of invite/discord server id - it shows the logo and the banner and the name description when made does it have discovery and is it reported by staff, if it wasnt it also includes saying that even if the server isnt reported it doesent mean its trusted, and if the server was a scam or wtv reason it says so in a red embed etc with a button for proofs if the proofs were added in the report system imma show u, and a blue embed if server is trusted also with proofs button if it has report serverid reason proofimage1 proofimage2 etc... - it saves up the server as reported in a file u make, and when ppl press on the proofs button it shows in a private msg not dm like images of the proofs trust serverid reason imgproof1 etc etc, it shows the server as trusted list trust/scam - it shows the last reported or trusted servers that were listed and how many time ago in the time thing with who reported reasons server ids etc

this is it for now il tell u if i need anything else added in it, it helps ppl make sure wich server is for scamming and wich one is legit so they never get scammed

Kodari AI
KodariOct 5 at 10:55 pm 2
ServerVaultGuard
A Discord bot using discord.py v2 components for server reputation tracking. Features a JSON storage system, environment variable configuration, and prefix-based commands ($). Commands include help, server lookup showing logo/banner/discovery status, report/trust commands with staff role verification, proof image buttons that DM users, and list commands showing recent scam/trusted servers with timestamps and reporter details. Uses embeds with color-coded trust status and a .env file for token configuration.

Created the Scam Files bot with discord.py Components V2, JSON storage, $help, $server, $report, $trust, and $list trust|scam. Proofs can be added as image URLs or attachments; the View proofs button shows them privately.

Before starting:

  • Reset the bot token you posted in the Discord Developer Portal, then put the replacement in .env.

  • Enable Message Content Intent under Developer Portal → your app → Bot → Privileged Gateway Intents so $ commands work.

  • Install dependencies from requirements.txt.

Reports and trust entries are saved in storage.json.

Polo Gamer

add dividers everywhere and make everythig look good, also when like errors make it be specified if in example i do $report it says whats missing in a comp v2 embed, also that add a $remove serverid wich removes it from being a scam or a trusted server

Kodari AI
KodariOct 5 at 11:09 pm 1

Plan:

  1. Review the current command and embed implementation.

  2. Apply consistent Components V2 styling and specific missing-argument errors.

  3. Add $remove <serverid> with staff-role protection and storage cleanup.

Updated bot.py with consistent Components V2 panels and dividers, including command help, server details, lists, success messages, and errors. Missing arguments now explain exactly what’s needed and show the command’s usage—for example, $report identifies whether the server or reason is missing.

Added staff-only $remove <server-id>. It removes all saved scam and trusted records for that server.

Polo Gamer

when i do the $server everything is like too close tg etc, make the logo be shown at the corner of the embed, the banner between 2 dividers under the name id description etc and up is it a scam server reason etc and divider under it with proofs button if it has proofs, also make all in embeds

Kodari AI
KodariOct 5 at 11:13 pm 1

Updated $server to use a cleaner Components V2 layout: safety status and staff reason appear first, followed by a divider and server details with the icon in the corner. The banner sits between dividers, with the proofs button below when proofs are available. All details remain inside the V2 panel.

Polo Gamer

make the report or trust command like this $report server reason imgproof1 imgproof2 etc so i can do multiple words in the reason

Kodari AI
KodariOct 5 at 11:14 pm 1
  1. Update $report and $trust help/error examples to show multi-word reasons and proof-image URLs on separate lines.

  2. Ensure newline-separated proof links are extracted without becoming part of the saved reason.

Updated $report and $trust to support multi-word reasons with proof-image URLs on separate lines. The help and error messages now show that format, and newline-separated image links are collected as proofs.

Plain Text
$report 123456789012345678 This server is scamming people
https://example.com/proof1.png
https://example.com/proof2.png
Polo Gamer

make the this does not mean the sevrer is trusted show in the lastttt at the bottom, also like make colors etc so its easier for ppl to see if a server is a scam unknown or trusted cause u have to read etc to know so make it work with colors etc

Kodari AI
KodariOct 5 at 11:23 pm 1
  1. Make scam, unknown, and trusted status unmistakable with distinct colors and prominent labels.

  2. Move the “not necessarily trusted” disclaimer to the very bottom of the unknown-server panel.

Updated the $server panel so status is immediately clear: 🔴 SCAM / UNSAFE, 🟢 TRUSTED, or 🟡 UNKNOWN, with matching red, green, and orange accents. For unknown servers, the “not automatically trusted” disclaimer now appears at the very bottom of the panel.

Polo Gamer

https://images-ext-1.discordapp.net/external/P8ChfXRz4-9frF-HkU5T7kd5JpbQTmR8b2AMk3GxLko/%3Fsize%3D96/https/cdn.discordapp.com/emojis/1548721316235059220.webp?format=webp make this image to be shown when server is trusted, its a green dot https://images-ext-1.discordapp.net/external/qYyEru7XsyRutc7IvFhfY7puIwN0yw3vmBKFLAOSbSU/%3Fsize%3D96/https/cdn.discordapp.com/emojis/1548721265483972678.webp?format=webp this when scam https://images-ext-1.discordapp.net/external/IUEGJwbIRjotlh2aWu934-zHwGtTZKwBpBiWXgWuRu0/%3Fsize%3D96%26animated%3Dtrue/https/cdn.discordapp.com/emojis/1130326727026016336.webp?animated=true and this when its unknown

Kodari AI
KodariOct 6 at 12:53 pm 1
  1. Add the three supplied status-image URLs.

  2. Show the matching image beside the status in the $server Components V2 panel.

Added the supplied green, red, and unknown-status images beside the status in the $server Components V2 panel. Each server now displays the matching image and keeps its corresponding status color.

Polo Gamer

change unknown to this one https://cdn.discordapp.com/emojis/1523758114967654481.webp?size=96&animated=true also that i want u to also show the owner of the server id username display

Kodari AI
KodariOct 6 at 12:58 pm 1
  1. Replace the unknown-status image with the new URL.

  2. Show the server owner’s username in the $server details.

Updated $server to use your new unknown-status image and display the server owner’s username. If Discord doesn’t provide owner details to the bot, it shows Unavailable.

Polo Gamer

theres an error

Kodari AI
KodariOct 6 at 12:59 pm 1

Fixed a Python indentation error in the owner lookup and status-image section that could prevent the bot from starting. If you still see an error, send me the full traceback so I can pinpoint it.

Polo Gamer

make the msg after u report cooler etc

Kodari AI
KodariOct 6 at 1:04 pm 1

Plan:

  1. Replace the plain saved-record notice with a polished Components V2 confirmation.

  2. Make scam reports and trusted entries visually distinct, and include the reason and proof access.

Updated the $report/$trust confirmation with a Components V2 card: clear red or green status, server name and ID, the saved reason, proof count, and a View proofs button when images were included.

Kodari can make mistakes. Review important code before using.
Files
.gitignore
bot.py
requirements.txt
storage.json
Code
4 663
bot.py
import asyncio
import json
import logging
import os
import re
from datetime import datetime, timezone
from pathlib import Path
from urllib.parse import urlparse
from uuid import uuid4

import discord
from discord.ext import commands
from dotenv import load_dotenv


load_dotenv()
logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s %(levelname)s %(name)s: %(message)s",
)
logger = logging.getLogger("scam_files")

BOT_NAME = "Scam Files"
STAFF_ROLE_ID = 1556800910724833350
STORAGE_PATH = Path("storage.json")
STATUS_IMAGES = {
    "trusts": "https://images-ext-1.discordapp.net/external/P8ChfXRz4-9frF-HkU5T7kd5JpbQTmR8b2AMk3GxLko/%3Fsize%3D96/https/cdn.discordapp.com/emojis/1548721316235059220.webp?format=webp",
    "reports": "https://images-ext-1.discordapp.net/external/qYyEru7XsyRutc7IvFhfY7puIwN0yw3vmBKFLAOSbSU/%3Fsize%3D96/https/cdn.discordapp.com/emojis/1548721265483972678.webp?format=webp",
    "unknown": "https://cdn.discordapp.com/emojis/1523758114967654481.webp?size=96&animated=true",
}
IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".gif", ".webp", ".avif"}
URL_PATTERN = re.compile(r"https?://[^\s<>]+", re.IGNORECASE)


class ReviewStorage:
    def __init__(self, path: Path):
        self.path = path
        self.lock = asyncio.Lock()
        self.data = self._load()

    def _load(self):
        try:
            data = json.loads(self.path.read_text(encoding="utf-8"))
        except FileNotFoundError:
            data = {}
        except json.JSONDecodeError:
            logger.exception("Storage file is invalid JSON; starting with empty records")
            data = {}

        if not isinstance(data, dict):
            data = {}
        data.setdefault("reports", [])
        data.setdefault("trusts", [])
        return data

    def _write(self):
        temporary_path = self.path.with_suffix(self.path.suffix + ".tmp")
        temporary_path.write_text(
            json.dumps(self.data, ensure_ascii=False, indent=2), encoding="utf-8"
        )
        temporary_path.replace(self.path)

    async def add(self, category: str, record: dict):
        async with self.lock:
            self.data[category].append(record)
            await asyncio.to_thread(self._write)

    async def remove_server(self, server_id: int):
        async with self.lock:
            removed = 0
            for category in ("reports", "trusts"):
                original_count = len(self.data[category])
                self.data[category] = [
                    record
                    for record in self.data[category]
                    if record["server_id"] != server_id
                ]
                removed += original_count - len(self.data[category])
            if removed:
                await asyncio.to_thread(self._write)
            return removed

    def latest_for_server(self, server_id: int):
        records = self.data["reports"] + self.data["trusts"]
        matching = [record for record in records if record["server_id"] == server_id]
        return max(matching, key=lambda record: record["created_at"], default=None)

    def recent_by_category(self, category: str, limit: int = 10):
        latest_by_server = {}
        for record in self.data[category]:
            current = latest_by_server.get(record["server_id"])
            if current is None or record["created_at"] > current["created_at"]:
                latest_by_server[record["server_id"]] = record
        return sorted(
            latest_by_server.values(),
            key=lambda record: record["created_at"],
            reverse=True,
        )[:limit]


storage = ReviewStorage(STORAGE_PATH)
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="$", intents=intents, help_command=None)


def image_url(value: str):
    parsed = urlparse(value)
    if parsed.scheme != "https" or Path(parsed.path).suffix.lower() not in IMAGE_EXTENSIONS:
        return None
    return value


def collect_proofs(ctx: commands.Context, details: str):
    proofs = []
    for line in details.splitlines():
        for value in URL_PATTERN.findall(line):
            clean_url = value.rstrip(".,;:!?)\"]}")
            valid_url = image_url(clean_url)
            if valid_url and valid_url not in proofs:
                proofs.append(valid_url)

    reason = URL_PATTERN.sub(" ", details)
    for value in ctx.message.attachments:
        extension = Path(value.filename).suffix.lower()
        if extension in IMAGE_EXTENSIONS and value.url not in proofs:
            proofs.append(value.url)

    return " ".join(reason.split()).strip(), proofs[:10]


def invite_code(target: str):
    value = target.strip().strip("<>")
    match = re.search(
        r"(?:discord\.gg/|discord(?:app)?\.com/invite/)([A-Za-z0-9-]+)",
        value,
        re.IGNORECASE,
    )
    return match.group(1) if match else value.rstrip("/")


def asset_url(server_id: int, asset, kind: str):
    if not asset:
        return None
    existing_url = getattr(asset, "url", None)
    if existing_url:
        return str(existing_url)
    key = str(asset)
    extension = "gif" if key.startswith("a_") else "png"
    return f"https://cdn.discordapp.com/{kind}/{server_id}/{key}.{extension}?size=1024"


async def resolve_server(target: str):
    value = target.strip().strip("<>")
    if value.isdecimal():
        server_id = int(value)
        guild = bot.get_guild(server_id)
        if guild is None:
            guild = await bot.fetch_guild(server_id)
    else:
        code = invite_code(value)
        invite = await bot.fetch_invite(code, with_counts=True)
        guild = invite.guild
        if guild is None:
            raise discord.NotFound(
                response=None,
                message="That invite does not contain server information.",
            )

    server_id = int(guild.id)
    owner_id = getattr(guild, "owner_id", None)
    owner = None
    if owner_id is not None:
        owner = getattr(guild, "get_member", lambda _: None)(owner_id)
        if owner is None:
            try:
                owner = await bot.fetch_user(owner_id)
            except discord.HTTPException:
                pass
    features = getattr(guild, "features", None)
    return {
        "id": server_id,
        "name": getattr(guild, "name", None) or "Unknown server",
        "owner": owner.name if owner else "Unavailable",
        "description": getattr(guild, "description", None),
        "discoverable": None if features is None else "DISCOVERABLE" in features,
        "icon": asset_url(server_id, getattr(guild, "icon", None), "icons"),
        "banner": asset_url(server_id, getattr(guild, "banner", None), "banners"),
    }


def status_text(record):
    if record is None:
        return (
            "**UNKNOWN — NO STAFF REVIEW FOUND**",
            discord.Colour.orange(),
            STATUS_IMAGES["unknown"],
        )
    if record["category"] == "trusts":
        return (