mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Docs updates
This commit is contained in:
parent
f820a06bac
commit
028786d348
13 changed files with 208 additions and 60 deletions
|
@ -53,36 +53,27 @@ export function initDocs(app: express.Express) {
|
|||
return notFound(res);
|
||||
}
|
||||
|
||||
const props = Reflect.ownKeys(pluginClass.prototype);
|
||||
const commands = props.reduce((arr, prop) => {
|
||||
if (typeof prop !== "string") return arr;
|
||||
const decoratorCommands = pluginUtils.getPluginDecoratorCommands(pluginClass as typeof Plugin);
|
||||
if (decoratorCommands) {
|
||||
arr.push(
|
||||
...decoratorCommands.map(cmd => {
|
||||
const trigger = typeof cmd.trigger === "string" ? cmd.trigger : cmd.trigger.source;
|
||||
const parameters = cmd.parameters
|
||||
? typeof cmd.parameters === "string"
|
||||
? parseParameters(cmd.parameters)
|
||||
: cmd.parameters
|
||||
: [];
|
||||
const config: IPluginCommandConfig = cmd.config || {};
|
||||
if (config.overloads) {
|
||||
config.overloads = config.overloads.map(overload => {
|
||||
return typeof overload === "string" ? parseParameters(overload) : overload;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
trigger,
|
||||
parameters,
|
||||
config,
|
||||
};
|
||||
}),
|
||||
);
|
||||
const decoratorCommands = pluginUtils.getPluginDecoratorCommands(pluginClass as typeof Plugin) || [];
|
||||
const commands = decoratorCommands.map(cmd => {
|
||||
const trigger = typeof cmd.trigger === "string" ? cmd.trigger : cmd.trigger.source;
|
||||
const parameters = cmd.parameters
|
||||
? typeof cmd.parameters === "string"
|
||||
? parseParameters(cmd.parameters)
|
||||
: cmd.parameters
|
||||
: [];
|
||||
const config: IPluginCommandConfig = cmd.config || {};
|
||||
if (config.overloads) {
|
||||
config.overloads = config.overloads.map(overload => {
|
||||
return typeof overload === "string" ? parseParameters(overload) : overload;
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}, []);
|
||||
|
||||
return {
|
||||
trigger,
|
||||
parameters,
|
||||
config,
|
||||
};
|
||||
});
|
||||
|
||||
const defaultOptions = (pluginClass as typeof ZeppelinPlugin).getStaticDefaultOptions();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { SavedMessage } from "../data/entities/SavedMessage";
|
|||
import { GuildAutoReactions } from "../data/GuildAutoReactions";
|
||||
import { Message } from "eris";
|
||||
import { customEmojiRegex, errorMessage, isEmoji, successMessage } from "../utils";
|
||||
import { trimPluginDescription, ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||
import { CommandInfo, trimPluginDescription, ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||
import * as t from "io-ts";
|
||||
|
||||
const ConfigSchema = t.type({
|
||||
|
@ -56,7 +56,13 @@ export class AutoReactionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
this.savedMessages.events.off("create", this.onMessageCreateFn);
|
||||
}
|
||||
|
||||
@d.command("auto_reactions", "<channelId:channelId> <reactions...>")
|
||||
@d.command("auto_reactions", "<channelId:channelId> <reactions...>", {
|
||||
extra: {
|
||||
info: <CommandInfo>{
|
||||
basicUsage: "!auto_reactions 629990160477585428 👍 👎",
|
||||
},
|
||||
},
|
||||
})
|
||||
@d.permission("can_manage")
|
||||
async setAutoReactionsCmd(msg: Message, args: { channelId: string; reactions: string[] }) {
|
||||
const finalReactions = [];
|
||||
|
@ -90,7 +96,13 @@ export class AutoReactionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
msg.channel.createMessage(successMessage(`Auto-reactions set for <#${args.channelId}>`));
|
||||
}
|
||||
|
||||
@d.command("auto_reactions disable", "<channelId:channelId>")
|
||||
@d.command("auto_reactions disable", "<channelId:channelId>", {
|
||||
extra: {
|
||||
info: <CommandInfo>{
|
||||
basicUsage: "!auto_reactions disable 629990160477585428",
|
||||
},
|
||||
},
|
||||
})
|
||||
@d.permission("can_manage")
|
||||
async disableAutoReactionsCmd(msg: Message, args: { channelId: string }) {
|
||||
const autoReaction = await this.autoReactions.getForChannel(args.channelId);
|
||||
|
|
|
@ -4,7 +4,7 @@ import { CaseTypes } from "../data/CaseTypes";
|
|||
import { Case } from "../data/entities/Case";
|
||||
import moment from "moment-timezone";
|
||||
import { CaseTypeColors } from "../data/CaseTypeColors";
|
||||
import { trimPluginDescription, ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||
import { PluginInfo, trimPluginDescription, ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||
import { GuildArchives } from "../data/GuildArchives";
|
||||
import { IPluginOptions } from "knub";
|
||||
import { GuildLogs } from "../data/GuildLogs";
|
||||
|
@ -47,7 +47,7 @@ export class CasesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
public static pluginName = "cases";
|
||||
public static configSchema = ConfigSchema;
|
||||
|
||||
public static pluginInfo = {
|
||||
public static pluginInfo: PluginInfo = {
|
||||
prettyName: "Cases",
|
||||
description: trimPluginDescription(`
|
||||
This plugin contains basic configuration for cases created by other plugins
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Member, MemberOptions } from "eris";
|
|||
import { GuildLogs } from "../data/GuildLogs";
|
||||
import { LogType } from "../data/LogType";
|
||||
import { stripObjectToScalars } from "../utils";
|
||||
import { ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||
import { trimPluginDescription, ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||
import * as t from "io-ts";
|
||||
|
||||
const ConfigSchema = t.type({
|
||||
|
@ -21,6 +21,9 @@ export class PersistPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
|
||||
public static pluginInfo = {
|
||||
prettyName: "Persist",
|
||||
description: trimPluginDescription(`
|
||||
Blah
|
||||
`),
|
||||
};
|
||||
|
||||
protected persistedData: GuildPersistedData;
|
||||
|
|
|
@ -41,6 +41,9 @@ export interface CommandInfo {
|
|||
parameterDescriptions?: {
|
||||
[key: string]: TMarkdown;
|
||||
};
|
||||
optionDescriptions?: {
|
||||
[key: string]: TMarkdown;
|
||||
};
|
||||
}
|
||||
|
||||
export function trimPluginDescription(str) {
|
||||
|
|
|
@ -26,11 +26,13 @@ import { CompanionChannelPlugin } from "./CompanionChannels";
|
|||
import { LocatePlugin } from "./LocateUser";
|
||||
import { GuildConfigReloader } from "./GuildConfigReloader";
|
||||
import { ChannelArchiverPlugin } from "./ChannelArchiver";
|
||||
import { AutomodPlugin } from "./Automod";
|
||||
|
||||
/**
|
||||
* Plugins available to be loaded for individual guilds
|
||||
*/
|
||||
export const availablePlugins = [
|
||||
AutomodPlugin,
|
||||
MessageSaverPlugin,
|
||||
NameHistoryPlugin,
|
||||
CasesPlugin,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue