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

@@ -19,26 +19,25 @@
* });
* ```
*/
import { PluginType } from "@sern/handler";
import { controller, CommandControlPlugin } from "@sern/handler";
export function serverOnly(
guildId,
failMessage = "This command is not available in this guild. \nFor permission to use in your server, please contact my developer."
) {
return {
type: PluginType.Event,
description: "Checks if a command is available in a specific server.",
return CommandControlPlugin(async (ctx, _) => {
if (ctx.guildId == null) {
return controller.stop();
}
async execute([ctx, args], controller) {
if (!guildId.includes(ctx.guildId)) {
await ctx.reply(failMessage).then(async (m) => {
setTimeout(async () => {
await m.delete();
}, 3000);
});
return controller.stop();
}
if (!guildId.includes(ctx.guildId)) {
ctx.reply(failMessage).then(async (m) => {
setTimeout(async () => {
await m.delete();
}, 3000);
});
return controller.stop();
}
return controller.next();
},
};
return controller.next();
});
}