mirror of
https://github.com/sern-handler/awesome-plugins
synced 2026-06-23 16:22:21 +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
@@ -19,29 +19,23 @@
|
||||
* ```
|
||||
*/
|
||||
import { ChannelType } from "discord.js";
|
||||
import { PluginType } from "@sern/handler";
|
||||
import { CommandControlPlugin, controller } from "@sern/handler";
|
||||
export function channelType(channelType, onFail) {
|
||||
return {
|
||||
type: PluginType.Event,
|
||||
description: "Checks the channel type.",
|
||||
return CommandControlPlugin(async (ctx, args) => {
|
||||
let channel = ctx.channel?.type; //for some reason the dm channel type was returning undefined at some points
|
||||
|
||||
async execute(event, controller) {
|
||||
const [ctx] = event;
|
||||
let channel = ctx.channel?.type; //for some reason the dm channel type was returning undefined at some points
|
||||
if (channel === undefined) {
|
||||
channel = ChannelType.DM;
|
||||
}
|
||||
|
||||
if (channel === undefined) {
|
||||
channel = ChannelType.DM;
|
||||
}
|
||||
if (channelType.includes(channel)) {
|
||||
return controller.next();
|
||||
}
|
||||
|
||||
if (channelType.includes(channel)) {
|
||||
return controller.next();
|
||||
}
|
||||
if (onFail) {
|
||||
await ctx.reply(onFail);
|
||||
}
|
||||
|
||||
if (onFail) {
|
||||
await ctx.reply(onFail);
|
||||
}
|
||||
|
||||
return controller.stop();
|
||||
},
|
||||
};
|
||||
return controller.stop();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user