mirror of
https://github.com/sern-handler/awesome-plugins
synced 2026-06-11 10:22:22 +00:00
chore: Update JavaScript plugins (#69)
chore: update JavaScript plugins Co-authored-by: EvolutionX-10 <EvolutionX-10@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
98ab449203
commit
b2ee0996f1
@@ -17,30 +17,23 @@
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
import { PluginType } from "@sern/handler";
|
||||
import { CommandControlPlugin, controller } from "@sern/handler";
|
||||
export function permCheck(perm, response) {
|
||||
return {
|
||||
type: PluginType.Event,
|
||||
description: "Checks for specified perm",
|
||||
return CommandControlPlugin(async (ctx, args) => {
|
||||
if (ctx.guild === null) {
|
||||
await ctx.reply("This command cannot be used here");
|
||||
console.warn(
|
||||
"PermCheck > A command stopped because we couldn't check a users permissions (was used in dms)"
|
||||
); //delete this line if you dont want to be notified when a command is used outside of a guild/server
|
||||
|
||||
async execute(event, controller) {
|
||||
const [ctx] = event;
|
||||
return controller.stop();
|
||||
}
|
||||
|
||||
if (ctx.guild === null) {
|
||||
ctx.reply("This command cannot be used here");
|
||||
console.warn(
|
||||
"PermCheck > A command stopped because we couldn't check a users permissions (was used in dms)"
|
||||
); //delete this line if you dont want to be notified when a command is used outside of a guild/server
|
||||
if (!ctx.member.permissions.has(perm)) {
|
||||
await ctx.reply(response);
|
||||
return controller.stop();
|
||||
}
|
||||
|
||||
return controller.stop();
|
||||
}
|
||||
|
||||
if (!ctx.member.permissions.has(perm)) {
|
||||
await ctx.reply(response);
|
||||
return controller.stop();
|
||||
}
|
||||
|
||||
return controller.next();
|
||||
},
|
||||
};
|
||||
return controller.next();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user