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:
parent
3ddfb3b65a
commit
7cf75f3255
12 changed files with 183 additions and 272 deletions
|
@ -1,7 +1,7 @@
|
|||
import { ContextMenuInteraction } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { availableActions } from "../actions/availableActions";
|
||||
import { ContextMenuPluginType } from "../types";
|
||||
import { hardcodedActions } from "./hardcodedContextOptions";
|
||||
|
||||
export async function routeContextAction(
|
||||
pluginData: GuildPluginData<ContextMenuPluginType>,
|
||||
|
@ -9,20 +9,5 @@ export async function routeContextAction(
|
|||
) {
|
||||
const contextLink = await pluginData.state.contextMenuLinks.get(interaction.commandId);
|
||||
if (!contextLink) return;
|
||||
const contextActions = Object.entries(pluginData.config.get().context_actions);
|
||||
|
||||
const configLink = contextActions.find(x => x[0] === contextLink.action_name);
|
||||
if (!configLink) return;
|
||||
|
||||
for (const [actionName, actionConfig] of Object.entries(configLink[1].action)) {
|
||||
if (actionConfig == null) return;
|
||||
const action = availableActions[actionName];
|
||||
action.apply({
|
||||
actionName,
|
||||
pluginData,
|
||||
actionConfig,
|
||||
interaction,
|
||||
});
|
||||
return;
|
||||
}
|
||||
hardcodedActions[contextLink.action_name](pluginData, interaction);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue