Skip to content

Latest commit

 

History

History
144 lines (101 loc) · 5.65 KB

File metadata and controls

144 lines (101 loc) · 5.65 KB

The Precut Script Bot
The Precut Script Bot

Discord bot for automated media tools, with features ported and improved from the original After Effects extension.
Queue-based Remove Background, Duplicate Deadframes Remover, and YouTube Downloader (Video/WebM + MP3) all features from the extension, now in bot form!


🎬 About

The Precut Script Bot is a Discord bot that helps editors by automating common AE extension tasks.
The bot began as an After Effects extension, and its features were transferred and expanded for Discord:

  • Remove Background (RMBG / rembg CPU) for a single image
  • Remove Duplicate/Dead Frames for short videos (Discord upload-limit friendly)
  • YouTube Downloader (separate Video/WebM + MP3 channels)

🚀 Features

  • Queue system (MySQL): runs jobs one-at-a-time for Remove BG / Dedup / YouTube
  • System channels: users can only submit the correct content (auto-deletes free chat)
  • Results channels: optionally post output into a separate channel, show “Requested by @user”
  • Component Containers (V2): Dedup + YouTube video use enhanced, interactive layouts (as in the extension)
  • Discord limits aware: checks file sizes vs server boost limits (Ryujin-style 8MB / 50MB)

⚙️ How Does It Work?

  1. Admin runs /managesystem inside a channel to set it as a submit channel:
    • Remove Background submit channel (image uploads)
    • Dedup submit channel (video uploads)
    • YouTube Download (MP4) channel (YouTube links, delivered as WebM for speed)
    • YouTube Download (MP3) channel (YouTube links)
  2. Users drop an attachment/link in the configured channel.
  3. The bot enqueues it in MySQL and processes jobs sequentially.
  4. The result is posted in the same or in a results channel (mimicking the extension's workflow).

🛠️ Requirements

  • Python 3.10+
  • FFmpeg available on the machine (required for YouTube merge/copy + MP3 conversion)
  • MySQL (required for channel config + queue)

Runs on CPU; heavy workloads (e.g., background removal) should be throttled via .env limits.


📦 Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Configure .env:
  • Copy .env.example.env
  • Set DISCORD_TOKEN
  • Set MySQL:
    • MYSQL_HOST
    • MYSQL_USER
    • MYSQL_PASSWORD
    • MYSQL_DATABASE
  1. Run the bot:
python bot.py

🔗 Adding the bot to a server

  1. Open Discord Developer Portal → your app → OAuth2 → URL Generator
  2. Scopes: bot, applications.commands
  3. Required permissions (recommended):
    • View Channels, Send Messages, Read Message History
    • Attach Files, Embed Links
    • Manage Messages (pin setup messages + delete invalid submissions)
  4. In Bot → Privileged Gateway Intents, enable Message Content Intent (needed for channel-based submission workflows as in the extension)

🎯 Commands / Setup

Slash commands

  • /help command list
  • /ping status / latency
  • /info about
  • /removebg one-off remove background (attachment)
  • /dedup one-off dedup (attachment)
  • /managesystem configure submit channels (admin)

Channel systems (submission)

  • Remove BG submit channel: upload 1 image → bot returns PNG
  • Dedup submit channel: upload 1 video → bot returns processed clip
  • YouTube video channel (labeled “MP4” in setup): post a YouTube URL → bot returns WebM video (fast method)
  • YouTube MP3 channel: post a YouTube URL → bot returns MP3 (320 kbps)

All major extension features are supported as channels or commands.


📸 Screenshots

Duplicate Deadframes Remover (feature originally from the extension)

Duplicate Deadframes Remover setup

YouTube Audio Downloader

YouTube Audio Downloader setup

YouTube Video Downloader

YouTube Video Downloader setup

Help Command

Help command output


discord.py MySQL FFmpeg

📜 License

This project is licensed under the MIT License with Commons Clause. Commercial sale or monetized distribution of this software is not allowed. See the LICENSE file for details.