mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-08 00:05:01 +00:00
Merge branch 'master' of github.com:ZeppelinBot/Zeppelin into feat/application-commands
This commit is contained in:
commit
0be54912c4
164 changed files with 22402 additions and 25686 deletions
|
@ -1,18 +1,18 @@
|
|||
import { GuildMember, Message, Snowflake } from "discord.js";
|
||||
import { Message } from "discord.js";
|
||||
import { EventEmitter } from "events";
|
||||
import { guildPlugin } from "knub";
|
||||
import { Queue } from "../../Queue";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
import { onGuildEvent } from "../../data/GuildEvents";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildMutes } from "../../data/GuildMutes";
|
||||
import { GuildTempbans } from "../../data/GuildTempbans";
|
||||
import { mapToPublicFn } from "../../pluginUtils";
|
||||
import { MINUTES, trimPluginDescription } from "../../utils";
|
||||
import { makePublicFn, mapToPublicFn } from "../../pluginUtils";
|
||||
import { MINUTES } from "../../utils";
|
||||
import { CasesPlugin } from "../Cases/CasesPlugin";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { MutesPlugin } from "../Mutes/MutesPlugin";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { AddCaseMsgCmd } from "./commands/addcase/AddCaseMsgCmd";
|
||||
import { AddCaseSlashCmd } from "./commands/addcase/AddCaseSlashCmd";
|
||||
import { BanMsgCmd } from "./commands/ban/BanMsgCmd";
|
||||
|
@ -71,15 +71,7 @@ import { offModActionsEvent } from "./functions/offModActionsEvent";
|
|||
import { onModActionsEvent } from "./functions/onModActionsEvent";
|
||||
import { updateCase } from "./functions/updateCase";
|
||||
import { warnMember } from "./functions/warnMember";
|
||||
import {
|
||||
AttachmentLinkReactionType,
|
||||
BanOptions,
|
||||
KickOptions,
|
||||
ModActionsPluginType,
|
||||
WarnOptions,
|
||||
modActionsSlashGroup,
|
||||
zModActionsConfig,
|
||||
} from "./types";
|
||||
import { AttachmentLinkReactionType, ModActionsPluginType, modActionsSlashGroup, zModActionsConfig } from "./types";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
@ -147,16 +139,8 @@ const defaultOptions = {
|
|||
],
|
||||
};
|
||||
|
||||
export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()({
|
||||
export const ModActionsPlugin = guildPlugin<ModActionsPluginType>()({
|
||||
name: "mod_actions",
|
||||
showInDocs: true,
|
||||
info: {
|
||||
prettyName: "Mod actions",
|
||||
description: trimPluginDescription(`
|
||||
This plugin contains the 'typical' mod actions such as warning, muting, kicking, banning, etc.
|
||||
`),
|
||||
configSchema: zModActionsConfig,
|
||||
},
|
||||
|
||||
dependencies: () => [TimeAndDatePlugin, CasesPlugin, MutesPlugin, LogsPlugin],
|
||||
configParser: (input) => zModActionsConfig.parse(input),
|
||||
|
@ -218,66 +202,21 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()({
|
|||
DeleteCaseMsgCmd,
|
||||
],
|
||||
|
||||
public: {
|
||||
warnMember(pluginData) {
|
||||
return (member: GuildMember, reason: string, reasonWithAttachments: string, warnOptions?: WarnOptions) => {
|
||||
return warnMember(pluginData, member, reason, reasonWithAttachments, warnOptions);
|
||||
};
|
||||
},
|
||||
|
||||
kickMember(pluginData) {
|
||||
return (member: GuildMember, reason: string, reasonWithAttachments: string, kickOptions?: KickOptions) => {
|
||||
kickMember(pluginData, member, reason, reasonWithAttachments, kickOptions);
|
||||
};
|
||||
},
|
||||
|
||||
banUserId(pluginData) {
|
||||
return (
|
||||
userId: string,
|
||||
reason?: string,
|
||||
reasonWithAttachments?: string,
|
||||
banOptions?: BanOptions,
|
||||
banTime?: number,
|
||||
) => {
|
||||
return banUserId(pluginData, userId, reason, reasonWithAttachments, banOptions, banTime);
|
||||
};
|
||||
},
|
||||
|
||||
updateCase(pluginData) {
|
||||
return (msg: Message, caseNumber: number | null, note: string) => {
|
||||
updateCase(pluginData, msg, msg.author, caseNumber ?? undefined, note, [...msg.attachments.values()]);
|
||||
};
|
||||
},
|
||||
|
||||
hasNotePermission(pluginData) {
|
||||
return (member: GuildMember, channelId: Snowflake) => {
|
||||
return hasNotePermission(pluginData, member, channelId);
|
||||
};
|
||||
},
|
||||
|
||||
hasWarnPermission(pluginData) {
|
||||
return (member: GuildMember, channelId: Snowflake) => {
|
||||
return hasWarnPermission(pluginData, member, channelId);
|
||||
};
|
||||
},
|
||||
|
||||
hasMutePermission(pluginData) {
|
||||
return (member: GuildMember, channelId: Snowflake) => {
|
||||
return hasMutePermission(pluginData, member, channelId);
|
||||
};
|
||||
},
|
||||
|
||||
hasBanPermission(pluginData) {
|
||||
return (member: GuildMember, channelId: Snowflake) => {
|
||||
return hasBanPermission(pluginData, member, channelId);
|
||||
};
|
||||
},
|
||||
|
||||
on: mapToPublicFn(onModActionsEvent),
|
||||
off: mapToPublicFn(offModActionsEvent),
|
||||
getEventEmitter(pluginData) {
|
||||
return () => pluginData.state.events;
|
||||
},
|
||||
public(pluginData) {
|
||||
return {
|
||||
warnMember: makePublicFn(pluginData, warnMember),
|
||||
kickMember: makePublicFn(pluginData, kickMember),
|
||||
banUserId: makePublicFn(pluginData, banUserId),
|
||||
updateCase: (msg: Message, caseNumber: number | null, note: string) =>
|
||||
updateCase(pluginData, msg, msg.author, caseNumber ?? undefined, note, [...msg.attachments.values()]),
|
||||
hasNotePermission: makePublicFn(pluginData, hasNotePermission),
|
||||
hasWarnPermission: makePublicFn(pluginData, hasWarnPermission),
|
||||
hasMutePermission: makePublicFn(pluginData, hasMutePermission),
|
||||
hasBanPermission: makePublicFn(pluginData, hasBanPermission),
|
||||
on: mapToPublicFn(onModActionsEvent),
|
||||
off: mapToPublicFn(offModActionsEvent),
|
||||
getEventEmitter: () => pluginData.state.events,
|
||||
};
|
||||
},
|
||||
|
||||
beforeLoad(pluginData) {
|
||||
|
|
12
backend/src/plugins/ModActions/info.ts
Normal file
12
backend/src/plugins/ModActions/info.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { ZeppelinPluginInfo } from "../../types";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { zModActionsConfig } from "./types";
|
||||
|
||||
export const modActionsPluginInfo: ZeppelinPluginInfo = {
|
||||
prettyName: "Mod actions",
|
||||
showInDocs: true,
|
||||
description: trimPluginDescription(`
|
||||
This plugin contains the 'typical' mod actions such as warning, muting, kicking, banning, etc.
|
||||
`),
|
||||
configSchema: zModActionsConfig,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue