No description
Find a file
2025-08-09 13:41:56 +02:00
cogs Fix AdminCog context menu registration 2025-08-09 13:17:45 +02:00
commands Merge branch 'main' into codex/empfehle-umstrukturierung-des-codes 2025-08-08 18:20:57 +02:00
models Use AsyncOpenAI for summaries 2025-08-08 20:15:29 +02:00
utils feat: add onboarding introduction command 2025-08-08 22:18:57 +02:00
.env.example use env vars for db credentials 2025-08-08 20:30:03 +02:00
.gitignore Ignore sensitive files and remove tracked copies 2025-08-08 20:49:33 +02:00
bot.py Clean up stray summary call and fix recurrence handler 2025-08-08 22:43:12 +02:00
config.py Clean up stray summary call and fix recurrence handler 2025-08-08 22:43:12 +02:00
database.py handle missing db connection 2025-08-09 13:41:43 +02:00
LICENSE Add MIT license 2025-08-08 21:16:31 +02:00
README.md README.md aktualisiert 2025-08-09 10:23:26 +00:00
requirements.txt Add missing dependencies 2025-08-08 20:56:45 +02:00

BotNoir

BotNoir is a feature-rich Discord bot, specially created for NRW Noir, designed to enhance and automate server management, user engagement, and community moderation. It leverages Discord's modern slash commands, context menus, and scheduled tasks to provide a seamless experience for both administrators and users.

Features

  • Event Announcements
    Automatically announces upcoming events for the next week in configured channels with detailed embeds and local time conversion.

  • Scheduled Surveys
    Posts scheduled surveys in specific channels, adds reaction options for voting, and tracks responses.

  • Welcome Messages Greets new members with personalized messages, including links to important channels (rules, introductions, etc.).

  • Vorstellungs-Generator Über den Slash-Befehl /vorstellung beantworten neue Mitglieder einige Fragen und erhalten daraus einen vorgefertigten Text, den sie selbst im VorstellungsChannel posten können.

  • Summary Management
    Allows users to opt-in or opt-out of receiving message summaries. Summaries can be generated from messages via context menu actions.

  • Context Menu Actions

    • Greet users on command.
    • Add trigger warnings to messages.
    • Create channel summaries.
    • Temporarily mute summaries.
    • Send off-topic warnings to users.
  • Off-Topic Reminders
    Reminds users to stay on topic with configurable warning levels and suggests appropriate channels.

  • Announcement Commands
    Post announcements (with templates) and list available announcement intros via slash commands.

  • Channel Synchronization
    Keeps channel information in sync with the database for accurate management.

  • Survey Reaction Handling
    Tracks and processes user reactions on surveys.

  • Data Privacy Controls
    Users can manage their participation in summaries and opt-in/out as desired.

  • Trigger Warning System Supports adding trigger warnings (e.g., suicide, violence, drugs, abuse) with custom emojis.

  • Role-Restricted Actions
    Certain actions (like greeting users) are restricted to users with specific roles (e.g., "Gotherator").

  • Help Command
    /hilfe provides a list of all available commands and their usage.

Getting Started

Prerequisites

  • Python 3.8+
  • Discord bot token
  • Required dependencies (see requirements.txt)
  • (Optional) Database configuration for persistent features

Installation

  1. Clone the repository:

    git clone https://github.com/negurvulkan/BotNoir.git
    cd BotNoir
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Configure environment variables and config files as needed.

  4. Run the bot:

    python bot.py
    

Usage

  • Use slash commands (/hilfe, /optin, /optout, /datenschutz, etc.) in your Discord server.
  • Right-click messages or users for context menu actions (e.g., add trigger warnings, greet, create summaries).
  • Admins can configure channels and roles in the bot's config.

Trigger Warnings

Trigger warning emojis are defined in utils/trigger_warnings.json. Each entry maps a warning name to a custom emoji ID. To add a new warning:

  1. Open utils/trigger_warnings.json.

  2. Insert a new key/value pair with the warning name and emoji, for example:

    {
      "Suizid": "<:trigger_suizid:1280114652381974649>",
      "YourWarning": "<:your_emoji:1234567890>"
    }
    
  3. Restart the bot so it loads the updated warnings.

Configuration

Datenbankzugang

Setze sie über Umgebungsvariablen in der .envDatei:

cp .env.example .env
# `.env` bearbeiten und mit deinen Zugangsdaten füllen

Alternativ können die Variablen direkt im Environment exportiert werden:

export DB_HOST=example.com
export DB_USER=dbuser
export DB_PASSWORD=geheimes_passwort
export DB_NAME=dbname

Moderationschannel

Für jeden Server kann im entsprechenden File unter serverconfigs/ ein Eintrag "moderation_channel" mit der ChannelID (z.B. "123456789012345678") hinzugefügt werden. Dieser Channel wird für Vorschläge aus /thissoundslike verwendet.

Befehls- und Parameternamen

Innerhalb derselben Konfigurationsdateien kann der Abschnitt "command_overrides" genutzt werden, um Befehlsnamen und Parameter pro Server anzupassen. Beispiel:

"command_overrides": {
  "thissoundslike": {
    "name": "diesessounds",
    "parameters": {
      "band_name1": "band1",
      "band_name2": "band2"
    }
  }
}

Sprache

Jede Datei serverconfigs/<guild_id>_config.json kann einen Eintrag "language" (z.B. "de" oder "en") enthalten, der die Serversprache festlegt.

Die Texte liegen in JSONDateien unter utils/locales/<sprache>.json und bestehen aus einfachen SchlüsselWertPaaren:

{
  "survey_invalid_reaction": "Bitte verwende nur die vorgesehenen Reaktionen für diese Umfrage."
}

Fehlende Übersetzungen fallen auf Englisch zurück.

Contributing

Contributions are welcome! Please fork the repository and submit pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with discord.py
  • Special thanks to all contributors and the Discord community.