mirror of
https://github.com/sern-handler/awesome-plugins
synced 2026-06-14 03:42:23 +00:00
chore: Update JavaScript plugins (#86)
chore: update JavaScript plugins Co-authored-by: EvolutionX-10 <EvolutionX-10@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9da1fd721f
commit
ff40182008
@@ -26,7 +26,7 @@ import {
|
||||
ButtonStyle,
|
||||
ComponentType,
|
||||
} from "discord.js";
|
||||
export function confirmation(options) {
|
||||
export function buttonConfirmation(options) {
|
||||
return CommandControlPlugin(async (ctx, args) => {
|
||||
options = {
|
||||
content: "Do you want to proceed?",
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
* Disables a command entirely, for whatever reasons you may need.
|
||||
*
|
||||
* @author @jacoobes [<@182326315813306368>]
|
||||
* @version 1.0.0
|
||||
* @author @Peter-MJ-Parker [<@1017182455926624316>]
|
||||
* @version 2.0.0
|
||||
* @example
|
||||
* ```ts
|
||||
* import { disable } from "../plugins/disable";
|
||||
@@ -17,18 +18,46 @@
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
import { PluginType } from "@sern/handler";
|
||||
import { CommandControlPlugin, controller } from "@sern/handler";
|
||||
export function disable(onFail) {
|
||||
return {
|
||||
type: PluginType.Event,
|
||||
description: "Disables command from responding",
|
||||
return CommandControlPlugin(async (ctx, [args]) => {
|
||||
if (onFail !== undefined) {
|
||||
switch (args) {
|
||||
case "text":
|
||||
//reply to text command
|
||||
const msg = await ctx.reply(onFail);
|
||||
setTimeout(() => {
|
||||
//deletes the bots reply to the user
|
||||
msg.delete(); //deletes the original authors message (text command).
|
||||
|
||||
async execute([ctx], controller) {
|
||||
if (onFail !== undefined) {
|
||||
await ctx.reply(onFail);
|
||||
ctx.message.delete(); //waits 5 seconds before deleting messages
|
||||
}, 5000).catch((e) => {
|
||||
//logs error to console (if any).
|
||||
console.log(e);
|
||||
});
|
||||
break;
|
||||
|
||||
case "slash":
|
||||
//ephemeral response to say the command is disabled with users response.
|
||||
await ctx.reply({
|
||||
content: onFail,
|
||||
ephemeral: true,
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} //this function tells the bot to reply to an interaction so it doesn't seem like it fails (in case there is no onFail message).
|
||||
|
||||
return controller.stop();
|
||||
},
|
||||
};
|
||||
if (onFail === undefined && args === "slash") {
|
||||
onFail = "This command is disabled.";
|
||||
await ctx.reply({
|
||||
content: onFail,
|
||||
ephemeral: true,
|
||||
});
|
||||
} //stop the command from running
|
||||
|
||||
return controller.stop();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user