Files
d4rkbot/src/bot/commands/purge.js
T
D4rkst3randClaude Fable 5 f7b261c648 Branding-Tab: Name/Farben/Bot-Status/Avatar/Banner + Button-Farben für Rollen-Menüs
- Alle Embeds nutzen jetzt brandName/brandColor/brandColor2/brandFooter aus den
  Settings (Codemod über 20 Module) — Farbe & Name serverweit per Klick änderbar
- Bot-Status (Presence): Typ (Spielt/Schaut/Hört/Status) + Text, sofort angewendet;
  Server-Monitor nutzt die Presence nur noch, wenn kein eigener Status gesetzt ist
- Avatar-/Banner-Upload direkt aufs Bot-Profil (Base64, 8-MB-Limit,
  Discord-Rate-Limit sauber gemeldet)
- Env-Verlagerung: GITEA_API_TOKEN (write-only Setting) und DISCORD_GUILD_ID
  jetzt auch über den Brand-Tab pflegbar — weniger Redeploys
- Rollen-Menüs: Button-Farbe pro Eintrag wählbar (Grau/Blau/Grün/Rot)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 00:40:08 +02:00

46 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
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.
// /purge — Nachrichten im aktuellen Kanal massenlöschen (max 100, jünger als 14 Tage)
import { SlashCommandBuilder, PermissionFlagsBits, MessageFlags, EmbedBuilder } from 'discord.js';
import { modlogChannelId, brandColor2 } from '../../runtime-settings.js';
export const data = new SlashCommandBuilder()
.setName('purge')
.setDescription('Löscht die letzten N Nachrichten in diesem Kanal')
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)
.addIntegerOption((o) =>
o.setName('anzahl').setDescription('Wie viele? (1100)').setRequired(true).setMinValue(1).setMaxValue(100)
);
export async function execute(interaction) {
const count = interaction.options.getInteger('anzahl');
await interaction.deferReply({ flags: MessageFlags.Ephemeral });
let deleted;
try {
// true = Nachrichten >14 Tage still überspringen (Discord-API-Limit)
deleted = await interaction.channel.bulkDelete(count, true);
} catch {
await interaction.editReply('❌ Löschen fehlgeschlagen — Bot braucht „Nachrichten verwalten" hier.');
return;
}
const logChannelId = modlogChannelId();
if (logChannelId && deleted.size > 0) {
const channel = await interaction.client.channels.fetch(logChannelId).catch(() => null);
await channel?.send({
embeds: [
new EmbedBuilder()
.setColor(brandColor2())
.setTitle('🧹 Purge')
.setDescription(
`**${deleted.size}** Nachrichten in <#${interaction.channelId}> gelöscht von **${interaction.user.username}**`
)
.setTimestamp(),
],
}).catch(() => {});
}
await interaction.editReply(
`🧹 **${deleted.size}** Nachrichten gelöscht.${deleted.size < count ? ' (ältere als 14 Tage kann Discord nicht massenlöschen)' : ''}`
);
}