Equicord/src/plugins/customCommands/settings.ts

50 lines
1.1 KiB
TypeScript
Raw Normal View History

/*
* Vencord, a Discord client mod
* Copyright (c) 2026 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { unregisterCommand } from "@api/Commands";
import { definePluginSettings } from "@api/Settings";
import { OptionType } from "@utils/types";
import { registerTagCommand } from ".";
import { SettingsTagList } from "./SettingsTagList";
export const settings = definePluginSettings({
tagsList: {
type: OptionType.CUSTOM,
2026-03-13 12:50:00 -04:00
description: "",
default: {} as Record<string, Tag>,
},
tagComponent: {
type: OptionType.COMPONENT,
component: SettingsTagList
}
});
export interface Tag {
name: string;
message: string;
}
export function getTags() {
return settings.store.tagsList;
}
export function getTag(name: string) {
return settings.store.tagsList[name];
}
export function addTag(tag: Tag) {
unregisterCommand(tag.name);
settings.store.tagsList[tag.name] = tag;
registerTagCommand(tag);
}
export function removeTag(name: string) {
delete settings.store.tagsList[name];
unregisterCommand(name);
}