mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-07 16:05:01 +00:00
feat: Context menu mod menu command
This commit is contained in:
parent
5a4e50b19d
commit
771ed76f64
17 changed files with 818 additions and 204 deletions
|
@ -1,32 +1,30 @@
|
|||
import { PluginOptions } from "knub";
|
||||
import { GuildContextMenuLinks } from "../../data/GuildContextMenuLinks";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
import { makeIoTsConfigParser } from "../../pluginUtils";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { CasesPlugin } from "../Cases/CasesPlugin";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { MutesPlugin } from "../Mutes/MutesPlugin";
|
||||
import { UtilityPlugin } from "../Utility/UtilityPlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { ContextClickedEvt } from "./events/ContextClickedEvt";
|
||||
import { ModMenuCmd } from "./commands/ModMenuCmd";
|
||||
import { ConfigSchema, ContextMenuPluginType } from "./types";
|
||||
import { loadAllCommands } from "./utils/loadAllCommands";
|
||||
|
||||
const defaultOptions: PluginOptions<ContextMenuPluginType> = {
|
||||
config: {
|
||||
can_use: false,
|
||||
|
||||
user_muteindef: false,
|
||||
user_mute1d: false,
|
||||
user_mute1h: false,
|
||||
user_info: false,
|
||||
can_open_mod_menu: false,
|
||||
|
||||
message_clean10: false,
|
||||
message_clean25: false,
|
||||
message_clean50: false,
|
||||
log_channel: null,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
level: ">=50",
|
||||
config: {
|
||||
can_use: true,
|
||||
|
||||
can_open_mod_menu: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
@ -34,24 +32,24 @@ const defaultOptions: PluginOptions<ContextMenuPluginType> = {
|
|||
|
||||
export const ContextMenuPlugin = zeppelinGuildPlugin<ContextMenuPluginType>()({
|
||||
name: "context_menu",
|
||||
showInDocs: false,
|
||||
showInDocs: true,
|
||||
info: {
|
||||
prettyName: "Context Menus",
|
||||
description: trimPluginDescription(`
|
||||
This plugin provides command shortcuts via context menus
|
||||
`),
|
||||
configSchema: ConfigSchema,
|
||||
},
|
||||
|
||||
dependencies: () => [MutesPlugin, LogsPlugin, UtilityPlugin],
|
||||
dependencies: () => [CasesPlugin, MutesPlugin, LogsPlugin, UtilityPlugin],
|
||||
configParser: makeIoTsConfigParser(ConfigSchema),
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
ContextClickedEvt,
|
||||
],
|
||||
contextMenuCommands: [ModMenuCmd],
|
||||
|
||||
beforeLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
state.contextMenuLinks = new GuildContextMenuLinks(guild.id);
|
||||
},
|
||||
|
||||
afterLoad(pluginData) {
|
||||
loadAllCommands(pluginData);
|
||||
state.cases = GuildCases.getGuildInstance(guild.id);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue