3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-21 08:45:03 +00:00
zeppelin/backend/src/plugins/ContextMenus/helpers.ts

25 lines
847 B
TypeScript

import { ContextMenuInteraction } from "discord.js";
import * as t from "io-ts";
import { GuildPluginData } from "../../../../../Knub/dist";
import { Awaitable } from "../../../../../Knub/dist/utils";
import { ContextMenuPluginType } from "./types";
type ContextActionApplyFn<TConfigType> = (meta: {
actionName: string;
pluginData: GuildPluginData<ContextMenuPluginType>;
actionConfig: TConfigType;
interaction: ContextMenuInteraction;
}) => Awaitable<void>;
export interface ContextActionBlueprint<TConfigType extends t.Any> {
configType: TConfigType;
defaultConfig: Partial<t.TypeOf<TConfigType>>;
apply: ContextActionApplyFn<t.TypeOf<TConfigType>>;
}
export function contextMenuAction<TConfigType extends t.Any>(
blueprint: ContextActionBlueprint<TConfigType>,
): ContextActionBlueprint<TConfigType> {
return blueprint;
}