Rename Events and files to prevent ambiguity and order availablePlugins

This commit is contained in:
Dark 2020-07-21 17:55:25 +02:00
parent f324dfc227
commit 0bc7dc17b7
13 changed files with 59 additions and 65 deletions

View file

@ -7,9 +7,8 @@ import { fillActiveAlertsList } from "./utils/fillAlertsList";
import { WhereCmd } from "./commands/WhereCmd";
import { FollowCmd } from "./commands/FollowCmd";
import { ListFollowCmd, DeleteFollowCmd } from "./commands/ListFollowCmd";
import { ChannelJoinEvt, ChannelSwitchEvt } from "./events/ChannelJoinEvt";
import { ChannelLeaveEvt } from "./events/ChannelLeaveEvt";
import { GuildBanAddEvt } from "./events/GuildBanAddEvt";
import { ChannelJoinAlertsEvt, ChannelSwitchAlertsEvt, ChannelLeaveAlertsEvt } from "./events/SendAlertsEvts";
import { GuildBanRemoveAlertsEvt } from "./events/BanRemoveAlertsEvt";
const defaultOptions: PluginOptions<LocateUserPluginType> = {
config: {
@ -41,10 +40,10 @@ export const LocateUserPlugin = zeppelinPlugin<LocateUserPluginType>()("locate_u
// prettier-ignore
events: [
ChannelJoinEvt,
ChannelSwitchEvt,
ChannelLeaveEvt,
GuildBanAddEvt
ChannelJoinAlertsEvt,
ChannelSwitchAlertsEvt,
ChannelLeaveAlertsEvt,
GuildBanRemoveAlertsEvt
],
onLoad(pluginData) {

View file

@ -1,6 +1,6 @@
import { locateUserEvent } from "../types";
export const GuildBanAddEvt = locateUserEvent({
export const GuildBanRemoveAlertsEvt = locateUserEvent({
event: "guildBanAdd",
async listener(meta) {

View file

@ -1,22 +0,0 @@
import { locateUserEvent } from "../types";
import { sendAlerts } from "../utils/sendAlerts";
export const ChannelJoinEvt = locateUserEvent({
event: "voiceChannelJoin",
async listener(meta) {
if (meta.pluginData.state.usersWithAlerts.includes(meta.args.member.id)) {
sendAlerts(meta.pluginData, meta.args.member.id);
}
},
});
export const ChannelSwitchEvt = locateUserEvent({
event: "voiceChannelSwitch",
async listener(meta) {
if (meta.pluginData.state.usersWithAlerts.includes(meta.args.member.id)) {
sendAlerts(meta.pluginData, meta.args.member.id);
}
},
});

View file

@ -2,7 +2,27 @@ import { locateUserEvent } from "../types";
import { sendAlerts } from "../utils/sendAlerts";
import { VoiceChannel, TextableChannel } from "eris";
export const ChannelLeaveEvt = locateUserEvent({
export const ChannelJoinAlertsEvt = locateUserEvent({
event: "voiceChannelJoin",
async listener(meta) {
if (meta.pluginData.state.usersWithAlerts.includes(meta.args.member.id)) {
sendAlerts(meta.pluginData, meta.args.member.id);
}
},
});
export const ChannelSwitchAlertsEvt = locateUserEvent({
event: "voiceChannelSwitch",
async listener(meta) {
if (meta.pluginData.state.usersWithAlerts.includes(meta.args.member.id)) {
sendAlerts(meta.pluginData, meta.args.member.id);
}
},
});
export const ChannelLeaveAlertsEvt = locateUserEvent({
event: "voiceChannelLeave",
async listener(meta) {