Update from Git Manager GUI

This commit is contained in:
2026-02-25 18:51:13 +01:00
parent 7dba3a8db8
commit ff0dc70b54
6 changed files with 480 additions and 0 deletions

26
util/ownerOnly.js Normal file
View File

@@ -0,0 +1,26 @@
/**
* util/ownerOnly.js
* Hilfsfunktion um Owner-only Befehle zu schützen.
*/
import { t } from "./i18n.js";
/**
* Gibt true zurück wenn der Nutzer der Bot-Owner ist.
* @param {Object} client
* @param {Object} ctx message oder slash ctx
* @param {string} lang
*/
export function isOwner(client, ctx) {
const userID = ctx.isSlash ? ctx.interaction.user.id : ctx.author.id;
return userID === client.config.ownerID;
}
/**
* Prüft ob Owner wenn nicht, antwortet mit Fehlermeldung und gibt false zurück.
*/
export async function requireOwner(client, ctx, lang = "de") {
if (isOwner(client, ctx)) return true;
await ctx.reply({ content: t(lang, "error.onlyOwner"), ephemeral: true });
return false;
}