adriandev0062

Erstelle einen modernen Discord-Bot für meinen YouTube-/Gaming-Kanal „ZENIX“.

YouTube-Kanal: https://www.youtube.com/@Zenix-t87

BRANDING:

  • Name: ZENIX
  • Hauptfarben: Schwarz und Weiß
  • Stil: modern, clean, futuristisch, Gaming/Esports
  • Keine bunten Farben
  • Discord-Embeds sollen hochwertig und übersichtlich aussehen
  • Verwende klare Icons und dezente Emojis

YOUTUBE-FUNKTIONEN:

  1. Automatische Benachrichtigung, wenn ein neues YouTube-Video erscheint.
  2. Automatische Benachrichtigung, wenn ein YouTube-Short erscheint.
  3. Automatische Benachrichtigung bei einem YouTube-Livestream.
  4. Die Benachrichtigungen sollen in einem konfigurierbaren Discord-Kanal erscheinen.
  5. Jede Benachrichtigung soll den Videotitel, Thumbnail und einen direkten Link enthalten.
  6. Vermeide doppelte Benachrichtigungen.

DISCORD-FUNKTIONEN:

  • /help – zeigt alle Befehle
  • /youtube – zeigt den YouTube-Kanal
  • /socials – zeigt meine Social-Media-Links
  • /ping – zeigt die Bot-Latenz
  • /userinfo – zeigt grundlegende Discord-Informationen
  • /serverinfo – zeigt Informationen über den Server

MODERATION:

  • einfache Anti-Spam-Funktion
  • Timeout-Funktion
  • Warnsystem
  • Nachrichten löschen
  • Logs für Moderationsaktionen
  • konfigurierbarer Moderationskanal

COMMUNITY:

  • Willkommensnachricht für neue Mitglieder
  • auswählbare Willkommensrolle
  • Regeln-Befehl
  • Support-/Ticket-System
  • Rollen für Community-Mitglieder

STREAMING:

Wenn ZENIX auf YouTube live geht, soll der Bot automatisch eine auffällige, aber nicht übertriebene Live-Benachrichtigung senden.

BEISPIEL: 🔴 ZENIX ist LIVE!

[Streamtitel]

🎮 Schaut jetzt vorbei: [YouTube-Link]

DESIGN:

Alle Embeds sollen zum schwarz-weißen ZENIX-Branding passen.

Das Design soll professionell, minimalistisch und modern wirken.

WICHTIG:

  • Alle wichtigen Einstellungen sollen über eine Konfiguration veränderbar sein.
  • Keine unnötigen Funktionen.
  • Der Bot soll übersichtlich und einfach zu bedienen sein.
  • Sicherheit und Berechtigungen sollen berücksichtigt werden.
  • Verwende Slash Commands.
  • Erstelle eine saubere und verständliche Struktur.
Kodari AI
KodariSep 16 at 1:34 pm 2
ZenixBot
Modern black-and-white Discord bot for the ZENIX YouTube gaming channel. Features automatic YouTube video, Short, and livestream notifications with thumbnails and links in configurable channels. Includes slash commands for help, YouTube, socials, ping, userinfo, and serverinfo. Provides anti-spam moderation, timeout, warning system, message deletion, and moderation logs. Community tools include welcome messages, assignable roles, rules command, ticket system, and member roles. All embeds follow minimalist ZENIX branding with configurable settings.
  1. Grundstruktur und Konfiguration für den ZENIX-Bot erstellen.

  2. YouTube-Überwachung für Videos, Shorts und Livestreams mit Duplikat-Schutz integrieren.

  3. Slash-Commands, Moderation, Anti-Spam und Moderations-Logs implementieren.

  4. Community-, Rollen-, Willkommens- und Ticket-Funktionen ergänzen.

  5. Setup-Dateien und Dokumentation für Discord-/YouTube-Konfiguration hinzufügen.

  1. Vollständige Bot-Struktur für ZENIX erstellt: Konfiguration, SQLite-Datenbank, Embeds, Logging und .env-Setup.

  2. YouTube-Überwachung integriert: Videos, Shorts und Livestreams mit Thumbnail, direktem Link und Duplikat-Schutz.

  3. Slash-Commands umgesetzt: /help, /youtube, /socials, /ping, /userinfo, /serverinfo, /rules, /roles, /role und /ticket.

  4. Moderation hinzugefügt: Anti-Spam, /warn, /warnings, /timeout, /clear und konfigurierbare Moderationslogs.

  5. Community-Funktionen ergänzt: Willkommensnachrichten, automatische Willkommensrolle, Community-Rollen und private Support-Tickets.

  6. README.md, requirements.txt, .env.example, config.json und .gitignore erstellt.

Start:

Shell
cp .env.example .env
pip install -r requirements.txt
python bot.py

Vor dem Start müssen die Discord-IDs in config.json eingetragen und die erforderlichen Gateway Intents im Discord Developer Portal aktiviert werden.

Kodari can make mistakes. Review important code before using.
Files
.gitignore
bot.py
community.py
config.json
config.py
database.py
embeds.py
general.py
moderation.py
README.md
requirements.txt
tickets.py
youtube.py
Code
13 939
bot.py
from __future__ import annotations

import logging

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

from community import CommunityCog
from config import Settings, load_settings
from database import Database
from general import GeneralCog
from moderation import ModerationCog
from tickets import TicketsCog
from youtube import YouTubeCog


logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s | %(levelname)s | %(name)s | %(message)s",
)
LOGGER = logging.getLogger("zenix")


class ZenixBot(commands.Bot):
    def __init__(self, settings: Settings) -> None:
        intents = discord.Intents.default()
        intents.members = True
        intents.message_content = True
        super().__init__(command_prefix=commands.when_mentioned_or("!"), intents=intents, help_command=None)
        self.settings = settings
        self.database = Database(settings.database_path)

    async def setup_hook(self) -> None:
        await self.database.connect()
        await self.add_cog(GeneralCog(self.settings))
        await self.add_cog(CommunityCog(self.settings))
        await self.add_cog(ModerationCog(self, self.settings, self.database))
        await self.add_cog(TicketsCog(self.settings))
        await self.add_cog(YouTubeCog(self, self.settings, self.database))

        if self.settings.sync_guild_id:
            guild = discord.Object(id=self.settings.sync_guild_id)
            self.tree.copy_global_to(guild=guild)
            await self.tree.sync(guild=guild)
            LOGGER.info("Slash commands synced to guild %s", self.settings.sync_guild_id)
        else:
            await self.tree.sync()
            LOGGER.info("Global slash commands synced")

    async def close(self) -> None:
        await self.database.close()
        await super().close()

    async def on_ready(self) -> None:
        if self.user:
            LOGGER.info("ZENIX online as %s (%s)", self.user, self.user.id)

    async def on_app_command_error(self, interaction: discord.Interaction, error: app_commands.AppCommandError) -> None:
        if isinstance(error, app_commands.CommandOnCooldown):
            message = f"Bitte warte noch {error.retry_after:.1f} Sekunden."
        elif isinstance(error, app_commands.MissingPermissions):
            message = "Dir fehlen die notwendigen Berechtigungen."
        else:
            LOGGER.error("Slash command error", exc_info=error)
            message = "Bei der Ausführung ist ein Fehler aufgetreten."
        if interaction.response.is_done():
            await interaction.followup.send(message, ephemeral=True)
        else:
            await interaction.response.send_message(message, ephemeral=True)


def main() -> None:
    load_dotenv()
    settings = load_settings()
    if not settings.token or settings.token == "replace_with_your_bot_token":
        raise RuntimeError("DISCORD_TOKEN fehlt. Lege ihn in einer .env-Datei fest.")
    bot = ZenixBot(settings)
    bot.run(settings.token)


if __name__ == "__main__":
    main()