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:
github-actions[bot]
2023-01-28 23:47:35 +05:30
committed by GitHub
parent 98ab449203
commit b2ee0996f1
24 changed files with 876 additions and 917 deletions

View File

@@ -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();
});
}