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
|
@ -1,4 +1,4 @@
|
|||
import { MessageEmbedOptions } from "discord.js";
|
||||
import { GuildMember, MessageEmbedOptions } from "discord.js";
|
||||
import { PluginOptions } from "knub";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
|
@ -38,6 +38,7 @@ import { VcdisconnectCmd } from "./commands/VcdisconnectCmd";
|
|||
import { VcmoveAllCmd, VcmoveCmd } from "./commands/VcmoveCmd";
|
||||
import { AutoJoinThreadEvt, AutoJoinThreadSyncEvt } from "./events/AutoJoinThreadEvt";
|
||||
import { getUserInfoEmbed } from "./functions/getUserInfoEmbed";
|
||||
import { hasPermission } from "./functions/hasPermission";
|
||||
import { activeReloads } from "./guildReloads";
|
||||
import { refreshMembersIfNeeded } from "./refreshMembers";
|
||||
import { ConfigSchema, UtilityPluginType } from "./types";
|
||||
|
@ -170,6 +171,12 @@ export const UtilityPlugin = zeppelinGuildPlugin<UtilityPluginType>()({
|
|||
return getUserInfoEmbed(pluginData, userId, false, requestMemberId);
|
||||
};
|
||||
},
|
||||
|
||||
hasPermission(pluginData) {
|
||||
return (member: GuildMember, channelId: string, permission: string) => {
|
||||
return hasPermission(pluginData, member, channelId, permission);
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
beforeLoad(pluginData) {
|
||||
|
|
12
backend/src/plugins/Utility/functions/hasPermission.ts
Normal file
12
backend/src/plugins/Utility/functions/hasPermission.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { GuildMember, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { UtilityPluginType } from "../types";
|
||||
|
||||
export async function hasPermission(
|
||||
pluginData: GuildPluginData<UtilityPluginType>,
|
||||
member: GuildMember,
|
||||
channelId: Snowflake,
|
||||
permission: string,
|
||||
) {
|
||||
return (await pluginData.config.getMatchingConfig({ member, channelId }))[permission];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue