3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 13:55:03 +00:00

Change ContextMenu to hardcoded default actions

Sadge

(More complex self-defined stuff coming at some point tho)
This commit is contained in:
Dark 2021-08-15 01:09:04 +02:00
parent 3ddfb3b65a
commit 7cf75f3255
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
12 changed files with 183 additions and 272 deletions

View file

@ -1,22 +1,25 @@
import { ApplicationCommandData } from "discord.js";
import { LogType } from "src/data/LogType";
import { LogsPlugin } from "src/plugins/Logs/LogsPlugin";
import { LogType } from "../../../data/LogType";
import { LogsPlugin } from "../../../plugins/Logs/LogsPlugin";
import { GuildPluginData } from "knub";
import { ContextMenuPluginType, ContextMenuTypeNameToNumber } from "../types";
import { ContextMenuPluginType } from "../types";
import { hardcodedContext } from "./hardcodedContextOptions";
export async function loadAllCommands(pluginData: GuildPluginData<ContextMenuPluginType>) {
const comms = await pluginData.client.application!.commands;
const actions = pluginData.config.get().context_actions;
const cfg = pluginData.config.get();
const newCommands: ApplicationCommandData[] = [];
const addedNames: string[] = [];
for (const [name, configAction] of Object.entries(actions)) {
if (!configAction.enabled) continue;
for (const [name, label] of Object.entries(hardcodedContext)) {
if (!cfg[name]) continue;
const type = name.startsWith("user") ? 2 : 3;
const data: ApplicationCommandData = {
type: ContextMenuTypeNameToNumber[configAction.type],
name: configAction.label,
type,
name: label,
};
addedNames.push(name);
newCommands.push(data);
}