Merge pull request #78 from DarkView/k30_betterEventNames
[K30] Rename Events and files to prevent ambiguity and order availablePlugins
This commit is contained in:
commit
a4cadd2629
13 changed files with 59 additions and 65 deletions
|
@ -3,9 +3,9 @@ import { ConfigSchema, AutoReactionsPluginType } from "./types";
|
|||
import { PluginOptions } from "knub";
|
||||
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd";
|
||||
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd";
|
||||
import { MessageCreateEvt } from "./events/MessageCreateEvt";
|
||||
import { GuildSavedMessages } from "src/data/GuildSavedMessages";
|
||||
import { GuildAutoReactions } from "src/data/GuildAutoReactions";
|
||||
import { AddReactionsEvt } from "./events/AddReactionsEvt";
|
||||
|
||||
const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
|
||||
config: {
|
||||
|
@ -33,7 +33,7 @@ export const AutoReactionsPlugin = zeppelinPlugin<AutoReactionsPluginType>()("au
|
|||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
MessageCreateEvt,
|
||||
AddReactionsEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { isDiscordRESTError } from "src/utils";
|
|||
import { logger } from "knub";
|
||||
import { LogType } from "src/data/LogType";
|
||||
|
||||
export const MessageCreateEvt = autoReactionsEvt({
|
||||
export const AddReactionsEvt = autoReactionsEvt({
|
||||
event: "messageCreate",
|
||||
allowOutsideOfGuild: false,
|
||||
|
|
@ -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) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { locateUserEvent } from "../types";
|
||||
|
||||
export const GuildBanAddEvt = locateUserEvent({
|
||||
export const GuildBanRemoveAlertsEvt = locateUserEvent({
|
||||
event: "guildBanAdd",
|
||||
|
||||
async listener(meta) {
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
});
|
|
@ -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) {
|
|
@ -2,14 +2,13 @@ import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
|||
import { UsernameHistory } from "src/data/UsernameHistory";
|
||||
import { Queue } from "src/Queue";
|
||||
import { UsernameSaverPluginType } from "./types";
|
||||
import { MessageCreateEvt } from "./events/MessageCreateEvt";
|
||||
import { VoiceChannelJoinEvt } from "./events/VoiceChannelJoinEvt";
|
||||
import { MessageCreateUpdateUsernameEvt, VoiceChannelJoinUpdateUsernameEvt } from "./events/UpdateUsernameEvts";
|
||||
|
||||
export const UsernameSaverPlugin = zeppelinPlugin<UsernameSaverPluginType>()("username_saver", {
|
||||
// prettier-ignore
|
||||
events: [
|
||||
MessageCreateEvt,
|
||||
VoiceChannelJoinEvt,
|
||||
MessageCreateUpdateUsernameEvt,
|
||||
VoiceChannelJoinUpdateUsernameEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
import { usernameEvent } from "../types";
|
||||
import { updateUsername } from "../updateUsername";
|
||||
|
||||
export const MessageCreateEvt = usernameEvent({
|
||||
event: "messageCreate",
|
||||
|
||||
async listener(meta) {
|
||||
if (meta.args.message.author.bot) return;
|
||||
meta.pluginData.state.updateQueue.add(() => updateUsername(meta.pluginData, meta.args.message.author));
|
||||
},
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
import { usernameEvent } from "../types";
|
||||
import { updateUsername } from "../updateUsername";
|
||||
|
||||
export const MessageCreateUpdateUsernameEvt = usernameEvent({
|
||||
event: "messageCreate",
|
||||
|
||||
async listener(meta) {
|
||||
if (meta.args.message.author.bot) return;
|
||||
meta.pluginData.state.updateQueue.add(() => updateUsername(meta.pluginData, meta.args.message.author));
|
||||
},
|
||||
});
|
||||
|
||||
export const VoiceChannelJoinUpdateUsernameEvt = usernameEvent({
|
||||
event: "voiceChannelJoin",
|
||||
|
||||
async listener(meta) {
|
||||
if (meta.args.member.bot) return;
|
||||
meta.pluginData.state.updateQueue.add(() => updateUsername(meta.pluginData, meta.args.member.user));
|
||||
},
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { usernameEvent } from "../types";
|
||||
import { updateUsername } from "../updateUsername";
|
||||
|
||||
export const VoiceChannelJoinEvt = usernameEvent({
|
||||
event: "voiceChannelJoin",
|
||||
|
||||
async listener(meta) {
|
||||
if (meta.args.member.bot) return;
|
||||
meta.pluginData.state.updateQueue.add(() => updateUsername(meta.pluginData, meta.args.member.user));
|
||||
},
|
||||
});
|
|
@ -2,7 +2,7 @@ import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
|||
import { PluginOptions } from "knub";
|
||||
import { WelcomeMessagePluginType, ConfigSchema } from "./types";
|
||||
import { GuildLogs } from "src/data/GuildLogs";
|
||||
import { GuildMemberAddEvt } from "./events/GuildMemberAddEvt";
|
||||
import { SendWelcomeMessageEvt } from "./events/SendWelcomeMessageEvt";
|
||||
|
||||
const defaultOptions: PluginOptions<WelcomeMessagePluginType> = {
|
||||
config: {
|
||||
|
@ -18,7 +18,7 @@ export const WelcomeMessagePlugin = zeppelinPlugin<WelcomeMessagePluginType>()("
|
|||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
GuildMemberAddEvt,
|
||||
SendWelcomeMessageEvt,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { stripObjectToScalars, createChunkedMessage } from "src/utils";
|
|||
import { LogType } from "src/data/LogType";
|
||||
import { TextChannel } from "eris";
|
||||
|
||||
export const GuildMemberAddEvt = welcomeEvent({
|
||||
export const SendWelcomeMessageEvt = welcomeEvent({
|
||||
event: "guildMemberAdd",
|
||||
|
||||
async listener(meta) {
|
|
@ -13,9 +13,9 @@ import { WelcomeMessagePlugin } from "./WelcomeMessage/WelcomeMessagePlugin";
|
|||
export const guildPlugins: Array<ZeppelinPluginBlueprint<any>> = [
|
||||
AutoReactionsPlugin,
|
||||
LocateUserPlugin,
|
||||
PersistPlugin,
|
||||
NameHistoryPlugin,
|
||||
MessageSaverPlugin,
|
||||
NameHistoryPlugin,
|
||||
PersistPlugin,
|
||||
RemindersPlugin,
|
||||
UsernameSaverPlugin,
|
||||
UtilityPlugin,
|
||||
|
|
Loading…
Add table
Reference in a new issue