mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 22: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
|
@ -41,7 +41,12 @@ import { CreateUnbanCaseOnManualUnbanEvt } from "./events/CreateUnbanCaseOnManua
|
|||
import { PostAlertOnMemberJoinEvt } from "./events/PostAlertOnMemberJoinEvt";
|
||||
import { banUserId } from "./functions/banUserId";
|
||||
import { clearTempban } from "./functions/clearTempban";
|
||||
import { hasMutePermission } from "./functions/hasMutePerm";
|
||||
import {
|
||||
hasBanPermission,
|
||||
hasMutePermission,
|
||||
hasNotePermission,
|
||||
hasWarnPermission,
|
||||
} from "./functions/hasModActionPerm";
|
||||
import { kickMember } from "./functions/kickMember";
|
||||
import { offModActionsEvent } from "./functions/offModActionsEvent";
|
||||
import { onModActionsEvent } from "./functions/onModActionsEvent";
|
||||
|
@ -158,7 +163,7 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()({
|
|||
public: {
|
||||
warnMember(pluginData) {
|
||||
return (member: GuildMember, reason: string, warnOptions?: WarnOptions) => {
|
||||
warnMember(pluginData, member, reason, warnOptions);
|
||||
return warnMember(pluginData, member, reason, warnOptions);
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -170,7 +175,7 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()({
|
|||
|
||||
banUserId(pluginData) {
|
||||
return (userId: string, reason?: string, banOptions?: BanOptions, banTime?: number) => {
|
||||
banUserId(pluginData, userId, reason, banOptions, banTime);
|
||||
return banUserId(pluginData, userId, reason, banOptions, banTime);
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -180,12 +185,30 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()({
|
|||
};
|
||||
},
|
||||
|
||||
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) {
|
||||
|
|
35
backend/src/plugins/ModActions/functions/hasModActionPerm.ts
Normal file
35
backend/src/plugins/ModActions/functions/hasModActionPerm.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { GuildMember, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
|
||||
export async function hasNotePermission(
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
member: GuildMember,
|
||||
channelId: Snowflake,
|
||||
) {
|
||||
return (await pluginData.config.getMatchingConfig({ member, channelId })).can_note;
|
||||
}
|
||||
|
||||
export async function hasWarnPermission(
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
member: GuildMember,
|
||||
channelId: Snowflake,
|
||||
) {
|
||||
return (await pluginData.config.getMatchingConfig({ member, channelId })).can_warn;
|
||||
}
|
||||
|
||||
export async function hasMutePermission(
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
member: GuildMember,
|
||||
channelId: Snowflake,
|
||||
) {
|
||||
return (await pluginData.config.getMatchingConfig({ member, channelId })).can_mute;
|
||||
}
|
||||
|
||||
export async function hasBanPermission(
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
member: GuildMember,
|
||||
channelId: Snowflake,
|
||||
) {
|
||||
return (await pluginData.config.getMatchingConfig({ member, channelId })).can_ban;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
import { GuildMember, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
|
||||
export async function hasMutePermission(
|
||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||
member: GuildMember,
|
||||
channelId: Snowflake,
|
||||
) {
|
||||
return (await pluginData.config.getMatchingConfig({ member, channelId })).can_mute;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue