mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Docs updates
This commit is contained in:
parent
f820a06bac
commit
028786d348
13 changed files with 208 additions and 60 deletions
|
@ -4,7 +4,71 @@
|
|||
<p class="mb-1">
|
||||
This page details the different argument types available for commands.
|
||||
</p>
|
||||
<h2 id="delay" class="z-title is-2 mt-2 mb-1">Delay</h2>
|
||||
|
||||
<h2 id="string" class="z-title is-2 mt-2 mb-1">string</h2>
|
||||
<p class="mb-1">
|
||||
Any text
|
||||
</p>
|
||||
|
||||
<h2 id="number" class="z-title is-2 mt-2 mb-1">number</h2>
|
||||
<p class="mb-1">
|
||||
Any number
|
||||
</p>
|
||||
|
||||
<h2 id="user" class="z-title is-2 mt-2 mb-1">user</h2>
|
||||
<p class="mb-1">
|
||||
Anything that uniquely identifies a user. This includes:
|
||||
</p>
|
||||
<ul class="z-list z-ul mb-1">
|
||||
<li>User ID <code>108552944961454080</code></li>
|
||||
<li>User mention <code>@Dark#1010</code></li>
|
||||
<li>Loose user mention <code>Dark#1010</code></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="userId" class="z-title is-2 mt-2 mb-1">userId</h2>
|
||||
<p class="mb-1">
|
||||
A valid user ID, e.g. <code>108552944961454080</code>
|
||||
</p>
|
||||
|
||||
<h2 id="channel" class="z-title is-2 mt-2 mb-1">channel</h2>
|
||||
<p class="mb-1">
|
||||
Anything that uniquely identifies a channel. This includes:
|
||||
</p>
|
||||
<ul class="z-list z-ul mb-1">
|
||||
<li>Channel ID <code>473087035574321152</code></li>
|
||||
<li>Channel mention <code>#my-channel</code></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="channelId" class="z-title is-2 mt-2 mb-1">channelId</h2>
|
||||
<p class="mb-1">
|
||||
A valid channel ID, e.g. <code>473087035574321152</code>
|
||||
</p>
|
||||
|
||||
<h2 id="role" class="z-title is-2 mt-2 mb-1">role</h2>
|
||||
<p class="mb-1">
|
||||
Anything that uniquely identifies a role. This includes:
|
||||
</p>
|
||||
<ul class="z-list z-ul mb-1">
|
||||
<li>Role ID <code>473085927053590538</code></li>
|
||||
<li>Role mention <code>@MyRole</code></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="member" class="z-title is-2 mt-2 mb-1">member</h2>
|
||||
<p class="mb-1">
|
||||
Anything that uniquely identifies a member currently on the server. This includes:
|
||||
</p>
|
||||
<ul class="z-list z-ul mb-1">
|
||||
<li>User ID <code>108552944961454080</code></li>
|
||||
<li>User Mention <code>@Dark#1010</code></li>
|
||||
<li>Loose user mention <code>Dark#1010</code></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="resolvedMember" class="z-title is-2 mt-2 mb-1">resolvedMember</h2>
|
||||
<p class="mb-1">
|
||||
See <code>member</code> above
|
||||
</p>
|
||||
|
||||
<h2 id="delay" class="z-title is-2 mt-2 mb-1">delay</h2>
|
||||
<p class="mb-1">
|
||||
A delay is used to specify an amount of time. It uses simple letters to specify time durations.<br>
|
||||
For example, <code>2d15h27m3s</code> would be 2 days, 15 hours, 27 minutes and 3 seconds.
|
||||
|
@ -40,18 +104,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</b-collapse>
|
||||
|
||||
<h2 id="string" class="z-title is-2 mb-1">String</h2>
|
||||
|
||||
<h2 id="user" class="z-title is-2 mt-2 mb-1">User</h2>
|
||||
<p class="mb-1">
|
||||
Anything that uniquely identifies a user. This includes:
|
||||
</p>
|
||||
<ul class="z-list z-ul mb-1">
|
||||
<li>User ID <code>108552944961454080</code></li>
|
||||
<li>User Mention <code>@Dark#1010</code></li>
|
||||
<li>Loose user mention <code>Dark#1010</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -28,15 +28,21 @@
|
|||
<aside class="menu">
|
||||
<p class="menu-label">General</p>
|
||||
<ul class="menu-list">
|
||||
<li><router-link to="/docs">Introduction</router-link></li>
|
||||
<li><router-link to="/docs/introduction">Introduction</router-link></li>
|
||||
<li><router-link to="/docs/configuration-format">Configuration format</router-link></li>
|
||||
<li><router-link to="/docs/plugin-configuration">Plugin configuration</router-link></li>
|
||||
<li><router-link to="/docs/permissions">Permissions</router-link></li>
|
||||
</ul>
|
||||
|
||||
<p class="menu-label">Descriptions</p>
|
||||
<p class="menu-label">Reference</p>
|
||||
<ul class="menu-list">
|
||||
<li><router-link to="/docs/descriptions/argument-types">Argument types</router-link></li>
|
||||
<li><router-link to="/docs/reference/argument-types">Argument types</router-link></li>
|
||||
</ul>
|
||||
|
||||
<p class="menu-label">Setup guides</p>
|
||||
<ul class="menu-list">
|
||||
<li><router-link to="/docs/setup-guides/logs">Logs</router-link></li>
|
||||
<li><router-link to="/docs/setup-guides/moderation">Moderation</router-link></li>
|
||||
</ul>
|
||||
|
||||
<p class="menu-label">Plugins</p>
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
<div v-else>
|
||||
<h1 class="z-title is-1 mb-1">{{ data.info.prettyName || data.name }}</h1>
|
||||
|
||||
<!-- Description -->
|
||||
<MarkdownBlock :content="data.info.description" class="content"></MarkdownBlock>
|
||||
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li v-bind:class="{'is-active': tab === 'usage'}">
|
||||
|
@ -18,8 +21,10 @@
|
|||
|
||||
<!-- Usage tab -->
|
||||
<div class="usage" v-if="tab === 'usage'">
|
||||
<!-- Description -->
|
||||
<MarkdownBlock :content="data.info.description" class="content"></MarkdownBlock>
|
||||
<div v-if="!hasUsageInfo">
|
||||
This plugin has no usage information.
|
||||
See <router-link v-bind:to="'/docs/plugins/' + pluginName + '/configuration'">Configuration</router-link>.
|
||||
</div>
|
||||
|
||||
<!-- Usage guide -->
|
||||
<div v-if="data.info.usageGuide">
|
||||
|
@ -32,11 +37,11 @@
|
|||
<h2 id="commands" class="z-title is-2 mt-2 mb-1">Commands</h2>
|
||||
<div v-for="command in data.commands">
|
||||
<h3 class="z-title is-3 mt-2 mb-1">!{{ command.trigger }}</h3>
|
||||
<div v-if="command.config.requiredPermission">
|
||||
Permission: <code>{{ command.config.requiredPermission }}</code>
|
||||
<div v-if="command.config.extra.requiredPermission">
|
||||
Permission: <code>{{ command.config.extra.requiredPermission }}</code>
|
||||
</div>
|
||||
<div v-if="command.config.info && command.config.info.basicUsage">
|
||||
Basic usage: <code>{{ command.config.info.basicUsage }}</code>
|
||||
<div v-if="command.config.extra.info && command.config.extra.info.basicUsage">
|
||||
Basic usage: <code>{{ command.config.extra.info.basicUsage }}</code>
|
||||
</div>
|
||||
<div v-if="command.config.aliases && command.config.aliases.length">
|
||||
Shortcut:
|
||||
|
@ -68,7 +73,7 @@
|
|||
<ul class="z-list z-ul">
|
||||
<li v-for="param in command.parameters">
|
||||
<code>{{ renderParameter(param) }}</code>
|
||||
<router-link :to="'/docs/descriptions/argument-types#' + (param.type || 'string')">{{ param.type || 'string' }}</router-link>
|
||||
<router-link :to="'/docs/reference/argument-types#' + (param.type || 'string')">{{ param.type || 'string' }}</router-link>
|
||||
<MarkdownBlock v-if="command.config.info && command.config.info.parameterDescriptions && command.config.info.parameterDescriptions[param.name]"
|
||||
:content="command.config.info.parameterDescriptions[param.name]"
|
||||
class="content">
|
||||
|
@ -76,6 +81,20 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mt-2" v-if="command.config.options && command.config.options.length">
|
||||
Options:
|
||||
<ul class="z-list z-ul">
|
||||
<li v-for="opt in command.config.options">
|
||||
<code>{{ renderOption(opt) }}</code>
|
||||
<router-link :to="'/docs/reference/argument-types#' + (opt.type || 'string')">{{ opt.type || 'string' }}</router-link>
|
||||
<MarkdownBlock v-if="command.config.info && command.config.info.optionDescriptions && command.config.info.optionDescriptions[opt.name]"
|
||||
:content="command.config.info.optionDescriptions[opt.name]"
|
||||
class="content">
|
||||
</MarkdownBlock>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</b-collapse>
|
||||
</div>
|
||||
|
@ -134,7 +153,14 @@
|
|||
|
||||
async mounted() {
|
||||
this.loading = true;
|
||||
|
||||
await this.$store.dispatch("docs/loadPluginData", this.pluginName);
|
||||
|
||||
// If there's no usage info, use Configuration as the default tab
|
||||
if (!this.hasUsageInfo && ! this.$route.params.tab) {
|
||||
this.tab = 'configuration';
|
||||
}
|
||||
|
||||
this.loading = false;
|
||||
},
|
||||
methods: {
|
||||
|
@ -152,6 +178,17 @@
|
|||
return `[${str}]`;
|
||||
}
|
||||
},
|
||||
renderOption(opt) {
|
||||
let str = `--${opt.name}`;
|
||||
if (opt.shortcut) {
|
||||
str += `|-${opt.shortcut}`;
|
||||
}
|
||||
if (opt.required) {
|
||||
return `<${str}>`;
|
||||
} else {
|
||||
return `[${str}]`;
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -167,6 +204,12 @@
|
|||
data(state) {
|
||||
return state.plugins[this.pluginName];
|
||||
},
|
||||
hasUsageInfo() {
|
||||
if (!this.data) return true;
|
||||
if (this.data.commands.length) return true;
|
||||
if (this.data.info.usageGuide) return true;
|
||||
return false;
|
||||
},
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
|
8
dashboard/src/components/docs/WorkInProgress.vue
Normal file
8
dashboard/src/components/docs/WorkInProgress.vue
Normal file
|
@ -0,0 +1,8 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1 class="z-title is-1 mb-1">Work in progress</h1>
|
||||
<p class="mb-1">
|
||||
This page is a work in progress.
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
|
@ -19,6 +19,10 @@ export const router = new VueRouter({
|
|||
children: [
|
||||
{
|
||||
path: "",
|
||||
redirect: "/docs/introduction",
|
||||
},
|
||||
{
|
||||
path: "introduction",
|
||||
component: () => import("./components/docs/Introduction.vue"),
|
||||
},
|
||||
{
|
||||
|
@ -34,9 +38,17 @@ export const router = new VueRouter({
|
|||
component: () => import("./components/docs/PluginConfiguration.vue"),
|
||||
},
|
||||
{
|
||||
path: "descriptions/argument-types",
|
||||
path: "reference/argument-types",
|
||||
component: () => import("./components/docs/ArgumentTypes.vue"),
|
||||
},
|
||||
{
|
||||
path: "setup-guides/logs",
|
||||
component: () => import("./components/docs/WorkInProgress.vue"),
|
||||
},
|
||||
{
|
||||
path: "setup-guides/moderation",
|
||||
component: () => import("./components/docs/WorkInProgress.vue"),
|
||||
},
|
||||
{
|
||||
path: "plugins/:pluginName/:tab?",
|
||||
component: () => import("./components/docs/Plugin.vue"),
|
||||
|
|
|
@ -61,3 +61,17 @@ $tabs-link-active-border-bottom-color: $grey-lighter;
|
|||
background: transparent;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.menu-label {
|
||||
&:not(:first-child) {
|
||||
margin-top: 1.4em;
|
||||
}
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-list .router-link-active {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
|
|
@ -53,13 +53,8 @@ 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 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"
|
||||
|
@ -78,11 +73,7 @@ export function initDocs(app: express.Express) {
|
|||
parameters,
|
||||
config,
|
||||
};
|
||||
}),
|
||||
);
|
||||
}
|
||||
return arr;
|
||||
}, []);
|
||||
});
|
||||
|
||||
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,
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
"interface-name": false,
|
||||
"no-submodule-imports": false,
|
||||
"no-floating-promises": true,
|
||||
"no-string-literal": false
|
||||
"no-string-literal": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue