mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Implement temporary permission check public functions
This commit is contained in:
parent
7cf75f3255
commit
1c8a223264
7 changed files with 46 additions and 10 deletions
|
@ -38,6 +38,7 @@ import { CreateKickCaseOnManualKickEvt } from "./events/CreateKickCaseOnManualKi
|
|||
import { CreateUnbanCaseOnManualUnbanEvt } from "./events/CreateUnbanCaseOnManualUnbanEvt";
|
||||
import { PostAlertOnMemberJoinEvt } from "./events/PostAlertOnMemberJoinEvt";
|
||||
import { banUserId } from "./functions/banUserId";
|
||||
import { hasMutePermission } from "./functions/hasMutePerm";
|
||||
import { kickMember } from "./functions/kickMember";
|
||||
import { offModActionsEvent } from "./functions/offModActionsEvent";
|
||||
import { onModActionsEvent } from "./functions/onModActionsEvent";
|
||||
|
@ -181,6 +182,12 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()({
|
|||
};
|
||||
},
|
||||
|
||||
hasMutePermission(pluginData) {
|
||||
return (member: GuildMember, channelId: string) => {
|
||||
return hasMutePermission(pluginData, member, channelId);
|
||||
};
|
||||
},
|
||||
|
||||
on: mapToPublicFn(onModActionsEvent),
|
||||
off: mapToPublicFn(offModActionsEvent),
|
||||
getEventEmitter(pluginData) {
|
||||
|
|
11
backend/src/plugins/ModActions/functions/hasMutePerm.ts
Normal file
11
backend/src/plugins/ModActions/functions/hasMutePerm.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
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