3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 13:55:03 +00:00

Implement temporary permission check public functions

This commit is contained in:
Dark 2021-08-15 01:44:25 +02:00
parent 7cf75f3255
commit 1c8a223264
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
7 changed files with 46 additions and 10 deletions

View file

@ -17,9 +17,9 @@ export async function cleanAction(
channelId: interaction.channelId,
member: executingMember,
});
const utility = pluginData.getPlugin(UtilityPlugin);
// TODO: Add perm check for can_clean in util
if (!userCfg.can_use) {
if (!userCfg.can_use || !(await utility.hasPermission(executingMember, interaction.channelId, "can_clean"))) {
await interaction.followUp({ content: "Cannot clean: insufficient permissions" });
return;
}
@ -36,7 +36,6 @@ export async function cleanAction(
try {
interaction.followUp(`Cleaning... Amount: ${amount}, User Only: ${targetUserOnly}, Pins: ${deletePins}`);
const utility = pluginData.getPlugin(UtilityPlugin);
utility.clean({ count: amount, user, channel: targetMessage.channel.id, "delete-pins": deletePins }, targetMessage);
} catch (e) {
interaction.followUp({ ephemeral: true, content: "Plugin error, please check your BOT_ALERTs" });