Files
SpigotWatch/README.md
2026-02-25 17:49:15 +00:00

307 lines
8.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 🐍 SpigotWatch
<div align="center">
![Version](https://img.shields.io/badge/Version-v2.1-blue?style=for-the-badge)
![Node](https://img.shields.io/badge/Node.js-≥18.0.0-green?style=for-the-badge&logo=node.js)
![discord.js](https://img.shields.io/badge/discord.js-v14-5865F2?style=for-the-badge&logo=discord)
![License](https://img.shields.io/badge/Lizenz-GPL--3.0-orange?style=for-the-badge)
**Ein Discord-Bot zum automatischen Überwachen von SpigotMC Plugin-Updates.**
Erhalte sofortige Benachrichtigungen wenn deine Plugins ein Update bekommen direkt in deinen Discord-Kanal.
</div>
---
## ✨ Features
- 🔔 **Automatische Update-Benachrichtigungen** Überwacht SpigotMC Plugins und postet Updates in einen definierten Kanal
- 📋 **Alle eigenen Plugins auf einmal hinzufügen** `addauthor` fügt alle Plugins eines Autors mit einem Befehl hinzu
- 🔍 **Plugin-Suche & Details** Suche nach Plugins, vergleiche sie und prüfe Minecraft-Kompatibilität
- ⚙️ **Vollständig konfigurierbar** Intervall, Sprache, Mention-Rolle und Update-Kanal pro Server einstellbar
- 🌐 **Mehrsprachig** Deutsch und Englisch unterstützt (`vn!setlang en`)
-**Slash Commands** Alle Befehle als `/befehl` und `vn!befehl` verfügbar
- 📊 **Statistiken & Status** Live-Übersicht über API-Status, Queue und Update-Historie
- 🔒 **Token-Schutz** Sicheres `.env`-System, kein Token im Code
- 🚦 **Rate-Limit-Schutz** Queue-System verhindert API-Blockierungen
---
## 📋 Voraussetzungen
- [Node.js](https://nodejs.org/) `>= 18.0.0`
- [npm](https://www.npmjs.com/)
- Ein [Discord Bot Account](https://discord.com/developers/applications)
---
## 🚀 Installation
### 1. Repository klonen
```bash
git clone https://github.com/M-Viper/pluginbot.git
cd pluginbot
```
### 2. Abhängigkeiten installieren
```bash
npm install
```
### 3. `.env` Datei erstellen
Kopiere die Vorlage und fülle sie aus:
```bash
cp .env.example .env
```
Öffne `.env` und trage deine Werte ein:
```env
DISCORD_TOKEN=dein_bot_token_hier
OWNER_ID=deine_discord_user_id
```
> **Token holen:** [Discord Developer Portal](https://discord.com/developers/applications) → Deine App → Bot → Token kopieren
> **User-ID holen:** Discord → Einstellungen → Erweitert → Entwicklermodus aktivieren → Rechtsklick auf dich selbst → ID kopieren
### 4. `config.json` anpassen
```json
{
"prefix": "vn!",
"botName": "Viper-Network",
"authorName": "DeinName",
"authorGithub": "https://deine-website.de",
"inviteClientID": "DEINE_BOT_CLIENT_ID"
}
```
> **Client-ID holen:** [Discord Developer Portal](https://discord.com/developers/applications) → Deine App → OAuth2 → Client ID
### 5. Slash-Befehle registrieren
```bash
node deploy.js
```
### 6. Bot starten
```bash
npm start
```
---
## 🔄 Autostart mit PM2 (empfohlen)
Damit der Bot bei einem Absturz automatisch neu startet:
```bash
npm install -g pm2
pm2 start index.js --name pluginbot
pm2 save
pm2 startup
```
Nützliche PM2-Befehle:
```bash
pm2 status # Status anzeigen
pm2 logs pluginbot # Logs anzeigen
pm2 restart pluginbot
pm2 stop pluginbot
```
---
## 📁 Projektstruktur
```
pluginbot/
├── index.js # Einstiegspunkt
├── deploy.js # Slash-Befehle registrieren (einmalig)
├── config.json # Bot-Konfiguration
├── .env # Token & Owner-ID (nicht auf GitHub!)
├── .env.example # Vorlage für .env
├── .gitignore
├── commands/ # Alle Bot-Befehle
│ ├── add.js
│ ├── addauthor.js
│ ├── changelog.js
│ ├── check.js
│ ├── compare.js
│ ├── help.js
│ ├── info.js
│ ├── invite.js
│ ├── list.js
│ ├── ping.js
│ ├── plugin.js
│ ├── remove.js
│ ├── search.js
│ ├── setchannel.js
│ ├── setinterval.js
│ ├── setlang.js
│ ├── setmention.js
│ ├── stats.js
│ ├── status.js
│ ├── top.js
│ └── update.js
├── events/ # Discord-Events
│ ├── botping.js
│ ├── interactionCreate.js
│ ├── message.js
│ └── ready.js
├── util/ # Hilfsfunktionen
│ ├── helpers.js # Spiget URL-Generatoren
│ ├── i18n.js # Übersetzungen DE/EN
│ ├── logger.js # Winston Logger
│ ├── ownerOnly.js # Owner-Check
│ ├── queue.js # Update-Check Queue
│ └── stats.js # Statistiken
├── serverdata/ # Serverdaten (automatisch angelegt)
└── data/ # Bot-Statistiken (automatisch angelegt)
```
---
## 🎮 Befehle
### Allgemein
| Befehl | Beschreibung |
|--------|--------------|
| `vn!help [befehl]` | Alle Befehle oder Details zu einem bestimmten |
| `vn!info` | Bot-Informationen, Version, RAM, Laufzeit |
| `vn!stats` | Nutzer, Server, Kanäle, Befehle, Laufzeit |
### 🔍 Plugins
| Befehl | Beschreibung |
|--------|--------------|
| `vn!search [name]` | Top 5 Plugins suchen, sortiert nach Downloads |
| `vn!search [name] -r` | Suche sortiert nach Bewertung |
| `vn!search [name] -n 500` | Suchmenge anpassen |
| `vn!plugin [id]` | Details zu einem Plugin anzeigen |
| `vn!changelog [id] [anzahl]` | Letzten 110 Updates eines Plugins |
| `vn!check [id] [mc-version]` | Minecraft-Kompatibilität prüfen |
| `vn!compare [id1] [id2]` | Zwei Plugins nebeneinander vergleichen |
| `vn!top` | Top beobachtete Plugins nach Downloads |
| `vn!top -r` | Top beobachtete Plugins nach Bewertung |
### 👁️ Update-Watcher *(nur Admins)*
| Befehl | Beschreibung |
|--------|--------------|
| `vn!add [id] [#kanal]` | Plugin beobachten (mit ✅/❌ Bestätigung) |
| `vn!addauthor [autor_id] [#kanal]` | Alle Plugins eines Autors auf einmal hinzufügen |
| `vn!remove [id]` | Plugin nicht mehr beobachten |
| `vn!list` | Alle beobachteten Plugins dieses Servers |
| `vn!update [id]` | Manuellen Update-Check auslösen |
| `vn!setchannel [id] [#kanal]` | Update-Kanal für ein Plugin ändern |
| `vn!setmention [id] [@rolle]` | Rolle die bei Updates gepingt wird |
### ⚙️ Konfiguration *(nur Admins)*
| Befehl | Beschreibung |
|--------|--------------|
| `vn!setlang [de\|en]` | Sprache des Bots für diesen Server |
| `vn!setinterval [minuten]` | Update-Check-Intervall (160 Min) |
### 🔒 Owner-Only
| Befehl | Beschreibung |
|--------|--------------|
| `vn!status` | API-Status, Queue-Info und Statistiken |
| `vn!ping` | Bot-Latenz anzeigen |
| `vn!invite` | Einladungslink des Bots |
> Alle Befehle sind auch als Slash-Commands verfügbar: `/add`, `/search`, `/status` usw.
---
## ⚙️ Konfiguration
### Update-Intervall pro Server
Standardmäßig prüft der Bot alle **5 Minuten** auf Updates. Anpassbar per Server:
```
vn!setinterval 10
```
### Mention-Rolle bei Updates
Eine Rolle die bei jedem Update automatisch gepingt wird:
```
vn!setmention 72678 @Plugin-Updates
```
Mention entfernen:
```
vn!setmention 72678
```
### Sprache
```
vn!setlang en # Englisch
vn!setlang de # Deutsch (Standard)
```
---
## 🔗 Ressourcen-ID finden
Die **Ressourcen-ID** eines SpigotMC Plugins findest du in der URL:
```
https://www.spigotmc.org/resources/vault.34315/
^^^^^
Ressourcen-ID = 34315
```
---
## 📦 Abhängigkeiten
| Paket | Version | Zweck |
|-------|---------|-------|
| [discord.js](https://discord.js.org/) | ^14.15.3 | Discord API |
| [spiget](https://www.npmjs.com/package/spiget) | 0.1.3 | SpigotMC API |
| [dotenv](https://www.npmjs.com/package/dotenv) | ^16.4.5 | Umgebungsvariablen |
| [winston](https://www.npmjs.com/package/winston) | ^3.13.0 | Logging |
---
## 🛡️ Sicherheit
- Der Bot-Token wird ausschließlich in der `.env` Datei gespeichert
- Die `.env` Datei ist in `.gitignore` eingetragen und wird **niemals** auf GitHub hochgeladen
- `serverdata/` und `data/` sind ebenfalls in `.gitignore` keine Serverdaten auf GitHub
- Owner-only Befehle (`status`, `ping`, `setinterval`) können nur vom konfigurierten Owner genutzt werden
---
## 📄 Lizenz
Dieses Projekt steht unter der [GPL-3.0 Lizenz](LICENSE).
---
<div align="center">
Entwickelt von **[M_Viper](https://m-viper.de)**
</div>