mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-14 21:31:50 +00:00
refactor: consolidate pluginInfo internal/legacy fields
This commit is contained in:
parent
8a4f7fe0e8
commit
dfdc6566cf
41 changed files with 46 additions and 51 deletions
|
@ -98,13 +98,13 @@ function formatZodConfigSchema(schema: z.ZodTypeAny) {
|
|||
}
|
||||
|
||||
export function initDocs(router: express.Router) {
|
||||
const docsPluginNames = Object.keys(guildPluginInfo).filter((k) => guildPluginInfo[k].showInDocs);
|
||||
const docsPluginNames = Object.keys(guildPluginInfo).filter((k) => guildPluginInfo[k].type === "stable" || guildPluginInfo[k].type === "legacy");
|
||||
|
||||
router.get("/docs/plugins", (req: express.Request, res: express.Response) => {
|
||||
res.json(
|
||||
docsPluginNames.map((pluginName) => {
|
||||
const info = guildPluginInfo[pluginName];
|
||||
const thinInfo = info ? { prettyName: info.prettyName, legacy: info.legacy ?? false } : {};
|
||||
const info = guildPluginInfo[pluginName]!;
|
||||
const thinInfo = { prettyName: info.prettyName, type: info.type };
|
||||
return {
|
||||
name: pluginName,
|
||||
info: thinInfo,
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ZeppelinPluginInfo } from "../../types.js";
|
|||
import { zAutoDeleteConfig } from "./types.js";
|
||||
|
||||
export const autoDeletePluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Auto-delete",
|
||||
description: "Allows Zeppelin to auto-delete messages from a channel after a delay",
|
||||
configurationGuide: "Maximum deletion delay is currently 5 minutes",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zAutoReactionsConfig } from "./types.js";
|
||||
|
||||
export const autoReactionsInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Auto-reactions",
|
||||
description: trimPluginDescription(`
|
||||
Allows setting up automatic reactions to all new messages on a channel
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zAutomodConfig } from "./types.js";
|
||||
|
||||
export const automodPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Automod",
|
||||
configSchema: zAutomodConfig,
|
||||
description: trimPluginDescription(`
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zCasesConfig } from "./types.js";
|
||||
|
||||
export const casesPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Cases",
|
||||
configSchema: zCasesConfig,
|
||||
description: trimPluginDescription(`
|
||||
|
|
|
@ -3,8 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zCensorConfig } from "./types.js";
|
||||
|
||||
export const censorPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
legacy: true,
|
||||
type: "legacy",
|
||||
prettyName: "Censor",
|
||||
configSchema: zCensorConfig,
|
||||
description: trimPluginDescription(`
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zCompanionChannelsConfig } from "./types.js";
|
||||
|
||||
export const companionChannelsPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Companion channels",
|
||||
configSchema: zCompanionChannelsConfig,
|
||||
description: trimPluginDescription(`
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ZeppelinPluginInfo } from "../../types.js";
|
|||
import { zContextMenusConfig } from "./types.js";
|
||||
|
||||
export const contextMenuPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: false,
|
||||
type: "stable",
|
||||
prettyName: "Context menu",
|
||||
configSchema: zContextMenusConfig,
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { zCountersConfig } from "./types.js";
|
|||
|
||||
export const countersPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Counters",
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
description:
|
||||
"Keep track of per-user, per-channel, or global numbers and trigger specific actions based on this number",
|
||||
configurationGuide: "See <a href='/docs/setup-guides/counters'>Counters setup guide</a>",
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zCustomEventsConfig } from "./types.js";
|
|||
|
||||
export const customEventsPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Custom events",
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
configSchema: zCustomEventsConfig,
|
||||
};
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zGuildConfigReloaderPlugin } from "./types.js";
|
|||
|
||||
export const guildConfigReloaderPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Guild config reloader",
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
configSchema: zGuildConfigReloaderPlugin,
|
||||
};
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zGuildInfoSaverConfig } from "./types.js";
|
|||
|
||||
export const guildInfoSaverPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Guild info saver",
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
configSchema: zGuildInfoSaverConfig,
|
||||
};
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zGuildMemberCacheConfig } from "./types.js";
|
|||
|
||||
export const guildMemberCachePluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Guild member cache",
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
configSchema: zGuildMemberCacheConfig,
|
||||
};
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zInternalPosterConfig } from "./types.js";
|
|||
|
||||
export const internalPosterPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Internal poster",
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
configSchema: zInternalPosterConfig,
|
||||
};
|
||||
|
|
|
@ -4,11 +4,11 @@ import { zLocateUserConfig } from "./types.js";
|
|||
|
||||
export const locateUserPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Locate user",
|
||||
type: "stable",
|
||||
description: trimPluginDescription(`
|
||||
This plugin allows users with access to the commands the following:
|
||||
* Instantly receive an invite to the voice channel of a user
|
||||
* Be notified as soon as a user switches or joins a voice channel
|
||||
`),
|
||||
configSchema: zLocateUserConfig,
|
||||
showInDocs: true,
|
||||
};
|
||||
|
|
|
@ -4,5 +4,5 @@ import { zLogsConfig } from "./types.js";
|
|||
export const logsPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Logs",
|
||||
configSchema: zLogsConfig,
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
};
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zMessageSaverConfig } from "./types.js";
|
|||
|
||||
export const messageSaverPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Message saver",
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
configSchema: zMessageSaverConfig,
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@ import { zModActionsConfig } from "./types.js";
|
|||
|
||||
export const modActionsPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Mod actions",
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
description: trimPluginDescription(`
|
||||
This plugin contains the 'typical' mod actions such as warning, muting, kicking, banning, etc.
|
||||
`),
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zMutesConfig } from "./types.js";
|
|||
|
||||
export const mutesPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Mutes",
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
configSchema: zMutesConfig,
|
||||
};
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zNameHistoryConfig } from "./types.js";
|
|||
|
||||
export const nameHistoryPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Name history",
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
configSchema: zNameHistoryConfig,
|
||||
};
|
||||
|
|
|
@ -9,5 +9,5 @@ export const persistPluginInfo: ZeppelinPluginInfo = {
|
|||
Mute roles are re-applied automatically, this plugin is not required for that.
|
||||
`),
|
||||
configSchema: zPersistConfig,
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ import { zPhishermanConfig } from "./types.js";
|
|||
|
||||
export const phishermanPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Phisherman",
|
||||
type: "stable",
|
||||
description: trimPluginDescription(`
|
||||
Match scam/phishing links using the Phisherman API. See https://phisherman.gg/ for more details!
|
||||
`),
|
||||
|
@ -40,5 +41,4 @@ export const phishermanPluginInfo: ZeppelinPluginInfo = {
|
|||
~~~
|
||||
`),
|
||||
configSchema: zPhishermanConfig,
|
||||
showInDocs: true,
|
||||
};
|
||||
|
|
|
@ -4,5 +4,5 @@ import { zPingableRolesConfig } from "./types.js";
|
|||
export const pingableRolesPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Pingable roles",
|
||||
configSchema: zPingableRolesConfig,
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
};
|
||||
|
|
|
@ -4,5 +4,5 @@ import { zPostConfig } from "./types.js";
|
|||
export const postPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Post",
|
||||
configSchema: zPostConfig,
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
};
|
||||
|
|
|
@ -4,7 +4,6 @@ import { zReactionRolesConfig } from "./types.js";
|
|||
export const reactionRolesPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Reaction roles",
|
||||
description: "Consider using the [Role buttons](https://zeppelin.gg/docs/plugins/role_buttons) plugin instead.",
|
||||
legacy: true,
|
||||
type: "legacy",
|
||||
configSchema: zReactionRolesConfig,
|
||||
showInDocs: true,
|
||||
};
|
||||
|
|
|
@ -4,5 +4,5 @@ import { zRemindersConfig } from "./types.js";
|
|||
export const remindersPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Reminders",
|
||||
configSchema: zRemindersConfig,
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zRoleButtonsConfig } from "./types.js";
|
||||
|
||||
export const roleButtonsPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Role buttons",
|
||||
description: trimPluginDescription(`
|
||||
Allow users to pick roles by clicking on buttons
|
||||
|
|
|
@ -3,6 +3,6 @@ import { zRoleManagerConfig } from "./types.js";
|
|||
|
||||
export const roleManagerPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Role manager",
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
configSchema: zRoleManagerConfig,
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zRolesConfig } from "./types.js";
|
||||
|
||||
export const rolesPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Roles",
|
||||
description: trimPluginDescription(`
|
||||
Enables authorised users to add and remove whitelisted roles with a command.
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zSelfGrantableRolesConfig } from "./types.js";
|
||||
|
||||
export const selfGrantableRolesPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Self-grantable roles",
|
||||
description: trimPluginDescription(`
|
||||
Allows users to grant themselves roles via a command
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ZeppelinPluginInfo } from "../../types.js";
|
|||
import { zSlowmodeConfig } from "./types.js";
|
||||
|
||||
export const slowmodePluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Slowmode",
|
||||
configSchema: zSlowmodeConfig,
|
||||
};
|
||||
|
|
|
@ -3,12 +3,11 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zSpamConfig } from "./types.js";
|
||||
|
||||
export const spamPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "legacy",
|
||||
prettyName: "Spam protection",
|
||||
description: trimPluginDescription(`
|
||||
Basic spam detection and auto-muting.
|
||||
For more advanced spam filtering, check out the Automod plugin!
|
||||
`),
|
||||
legacy: true,
|
||||
configSchema: zSpamConfig,
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zStarboardConfig } from "./types.js";
|
||||
|
||||
export const starboardPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Starboard",
|
||||
description: trimPluginDescription(`
|
||||
This plugin allows you to set up starboards on your server. Starboards are like user voted pins where messages with enough reactions get immortalized on a "starboard" channel.
|
||||
|
|
|
@ -4,7 +4,7 @@ import { TemplateFunctions } from "./templateFunctions.js";
|
|||
import { TemplateFunction, zTagsConfig } from "./types.js";
|
||||
|
||||
export const tagsPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Tags",
|
||||
description: "Tags are a way to store and reuse information.",
|
||||
configurationGuide: trimPluginDescription(`
|
||||
|
|
|
@ -3,7 +3,7 @@ import { trimPluginDescription } from "../../utils.js";
|
|||
import { zTimeAndDateConfig } from "./types.js";
|
||||
|
||||
export const timeAndDatePluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Time and date",
|
||||
description: trimPluginDescription(`
|
||||
Allows controlling the displayed time/date formats and timezones
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ZeppelinPluginInfo } from "../../types.js";
|
|||
import { zUsernameSaverConfig } from "./types.js";
|
||||
|
||||
export const usernameSaverPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: false,
|
||||
type: "internal",
|
||||
prettyName: "Username saver",
|
||||
configSchema: zUsernameSaverConfig,
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ZeppelinPluginInfo } from "../../types.js";
|
|||
import { zUtilityConfig } from "./types.js";
|
||||
|
||||
export const utilityPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Utility",
|
||||
configSchema: zUtilityConfig,
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ZeppelinPluginInfo } from "../../types.js";
|
|||
import { zWelcomeMessageConfig } from "./types.js";
|
||||
|
||||
export const welcomeMessagePluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
type: "stable",
|
||||
prettyName: "Welcome message",
|
||||
configSchema: zWelcomeMessageConfig,
|
||||
};
|
||||
|
|
|
@ -33,14 +33,15 @@ export type TZeppelinKnub = Knub;
|
|||
*/
|
||||
export type TMarkdown = string;
|
||||
|
||||
export type ZeppelinPluginType = "stable" | "legacy" | "internal";
|
||||
|
||||
export interface ZeppelinPluginInfo {
|
||||
showInDocs: boolean;
|
||||
type: ZeppelinPluginType;
|
||||
prettyName: string;
|
||||
configSchema: ZodTypeAny;
|
||||
description?: TMarkdown;
|
||||
usageGuide?: TMarkdown;
|
||||
configurationGuide?: TMarkdown;
|
||||
legacy?: boolean;
|
||||
}
|
||||
|
||||
export interface CommandInfo {
|
||||
|
|
|
@ -156,14 +156,14 @@
|
|||
...menu,
|
||||
{
|
||||
label: 'Plugins',
|
||||
items: this.plugins.filter(plugin => !plugin.info.legacy).map(plugin => ({
|
||||
items: this.plugins.filter(plugin => plugin.info.type === "stable").map(plugin => ({
|
||||
label: plugin.info.prettyName || plugin.name,
|
||||
to: `/docs/plugins/${plugin.name}`,
|
||||
})),
|
||||
},
|
||||
{
|
||||
label: "Legacy Plugins",
|
||||
items: this.plugins.filter(plugin => plugin.info.legacy).map(plugin => ({
|
||||
items: this.plugins.filter(plugin => plugin.info.type === "legacy").map(plugin => ({
|
||||
label: plugin.info.prettyName || plugin.name,
|
||||
to: `/docs/plugins/${plugin.name}`,
|
||||
})),
|
||||
|
|
|
@ -8,16 +8,13 @@
|
|||
<!-- Description -->
|
||||
<MarkdownBlock :content="data.info.description" class="content"></MarkdownBlock>
|
||||
|
||||
<div v-if="data.info.legacy">
|
||||
<div v-if="data.info.type === 'legacy'">
|
||||
<div class="px-3 py-2 mb-4 rounded bg-gray-800 shadow-md inline-block flex">
|
||||
<div class="flex-none mr-2">
|
||||
<alert class="inline-icon mr-1 text-yellow-300" />
|
||||
</div>
|
||||
<div class="flex-auto">
|
||||
<strong>Note!</strong> This is a legacy plugin which is no longer actively maintained and may be removed in a future update.
|
||||
<div v-if="typeof data.info.legacy === 'string'" class="mt-4">
|
||||
<MarkdownBlock v-if="typeof data.info.legacy === 'string'" :content="data.info.legacy"></MarkdownBlock>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue