diff --git a/backend/src/plugins/AutoReactions/types.ts b/backend/src/plugins/AutoReactions/types.ts index 4751fa94..cb4930f9 100644 --- a/backend/src/plugins/AutoReactions/types.ts +++ b/backend/src/plugins/AutoReactions/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { GuildAutoReactions } from "../../data/GuildAutoReactions"; import { GuildLogs } from "../../data/GuildLogs"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; @@ -20,5 +20,5 @@ export interface AutoReactionsPluginType extends BasePluginType { }; } -export const autoReactionsCmd = typedGuildCommand(); -export const autoReactionsEvt = typedGuildEventListener(); +export const autoReactionsCmd = guildPluginMessageCommand(); +export const autoReactionsEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Automod/commands/AntiraidClearCmd.ts b/backend/src/plugins/Automod/commands/AntiraidClearCmd.ts index 3f119b6b..fd31d4b1 100644 --- a/backend/src/plugins/Automod/commands/AntiraidClearCmd.ts +++ b/backend/src/plugins/Automod/commands/AntiraidClearCmd.ts @@ -1,9 +1,9 @@ -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { sendSuccessMessage } from "../../../pluginUtils"; import { setAntiraidLevel } from "../functions/setAntiraidLevel"; import { AutomodPluginType } from "../types"; -export const AntiraidClearCmd = typedGuildCommand()({ +export const AntiraidClearCmd = guildPluginMessageCommand()({ trigger: ["antiraid clear", "antiraid reset", "antiraid none", "antiraid off"], permission: "can_set_antiraid", diff --git a/backend/src/plugins/Automod/commands/SetAntiraidCmd.ts b/backend/src/plugins/Automod/commands/SetAntiraidCmd.ts index 3ec0f2f9..159ff576 100644 --- a/backend/src/plugins/Automod/commands/SetAntiraidCmd.ts +++ b/backend/src/plugins/Automod/commands/SetAntiraidCmd.ts @@ -1,10 +1,10 @@ -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils"; import { setAntiraidLevel } from "../functions/setAntiraidLevel"; import { AutomodPluginType } from "../types"; -export const SetAntiraidCmd = typedGuildCommand()({ +export const SetAntiraidCmd = guildPluginMessageCommand()({ trigger: "antiraid", permission: "can_set_antiraid", diff --git a/backend/src/plugins/Automod/commands/ViewAntiraidCmd.ts b/backend/src/plugins/Automod/commands/ViewAntiraidCmd.ts index 5c208497..f25f8e96 100644 --- a/backend/src/plugins/Automod/commands/ViewAntiraidCmd.ts +++ b/backend/src/plugins/Automod/commands/ViewAntiraidCmd.ts @@ -1,7 +1,7 @@ -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { AutomodPluginType } from "../types"; -export const ViewAntiraidCmd = typedGuildCommand()({ +export const ViewAntiraidCmd = guildPluginMessageCommand()({ trigger: "antiraid", permission: "can_view_antiraid", diff --git a/backend/src/plugins/Automod/events/RunAutomodOnJoinLeaveEvt.ts b/backend/src/plugins/Automod/events/RunAutomodOnJoinLeaveEvt.ts index faaff383..4cf34db2 100644 --- a/backend/src/plugins/Automod/events/RunAutomodOnJoinLeaveEvt.ts +++ b/backend/src/plugins/Automod/events/RunAutomodOnJoinLeaveEvt.ts @@ -1,9 +1,9 @@ -import { typedGuildEventListener } from "knub"; +import { guildPluginEventListener } from "knub"; import { RecentActionType } from "../constants"; import { runAutomod } from "../functions/runAutomod"; import { AutomodContext, AutomodPluginType } from "../types"; -export const RunAutomodOnJoinEvt = typedGuildEventListener()({ +export const RunAutomodOnJoinEvt = guildPluginEventListener()({ event: "guildMemberAdd", listener({ pluginData, args: { member } }) { const context: AutomodContext = { @@ -26,7 +26,7 @@ export const RunAutomodOnJoinEvt = typedGuildEventListener()( }, }); -export const RunAutomodOnLeaveEvt = typedGuildEventListener()({ +export const RunAutomodOnLeaveEvt = guildPluginEventListener()({ event: "guildMemberRemove", listener({ pluginData, args: { member } }) { const context: AutomodContext = { diff --git a/backend/src/plugins/Automod/events/RunAutomodOnMemberUpdate.ts b/backend/src/plugins/Automod/events/RunAutomodOnMemberUpdate.ts index 86e8ad46..f6c3518a 100644 --- a/backend/src/plugins/Automod/events/RunAutomodOnMemberUpdate.ts +++ b/backend/src/plugins/Automod/events/RunAutomodOnMemberUpdate.ts @@ -1,10 +1,10 @@ -import { typedGuildEventListener } from "knub"; +import { guildPluginEventListener } from "knub"; import diff from "lodash.difference"; import isEqual from "lodash.isequal"; import { runAutomod } from "../functions/runAutomod"; import { AutomodContext, AutomodPluginType } from "../types"; -export const RunAutomodOnMemberUpdate = typedGuildEventListener()({ +export const RunAutomodOnMemberUpdate = guildPluginEventListener()({ event: "guildMemberUpdate", listener({ pluginData, args: { oldMember, newMember } }) { if (!oldMember) return; diff --git a/backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts b/backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts index 2687778e..977c8426 100644 --- a/backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts +++ b/backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts @@ -1,9 +1,9 @@ -import { typedGuildEventListener } from "knub"; +import { guildPluginEventListener } from "knub"; import { RecentActionType } from "../constants"; import { runAutomod } from "../functions/runAutomod"; import { AutomodContext, AutomodPluginType } from "../types"; -export const RunAutomodOnThreadCreate = typedGuildEventListener()({ +export const RunAutomodOnThreadCreate = guildPluginEventListener()({ event: "threadCreate", async listener({ pluginData, args: { thread } }) { const user = thread.ownerId @@ -32,7 +32,7 @@ export const RunAutomodOnThreadCreate = typedGuildEventListener()({ +export const RunAutomodOnThreadDelete = guildPluginEventListener()({ event: "threadDelete", async listener({ pluginData, args: { thread } }) { const user = thread.ownerId @@ -54,7 +54,7 @@ export const RunAutomodOnThreadDelete = typedGuildEventListener()({ +export const RunAutomodOnThreadUpdate = guildPluginEventListener()({ event: "threadUpdate", async listener({ pluginData, args: { oldThread, newThread: thread } }) { const user = thread.ownerId diff --git a/backend/src/plugins/BotControl/types.ts b/backend/src/plugins/BotControl/types.ts index f2da13ef..28389848 100644 --- a/backend/src/plugins/BotControl/types.ts +++ b/backend/src/plugins/BotControl/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGlobalCommand, typedGlobalEventListener } from "knub"; +import { BasePluginType, globalPluginMessageCommand, globalPluginEventListener } from "knub"; import { AllowedGuilds } from "../../data/AllowedGuilds"; import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments"; import { Configs } from "../../data/Configs"; @@ -26,5 +26,5 @@ export interface BotControlPluginType extends BasePluginType { }; } -export const botControlCmd = typedGlobalCommand(); -export const botControlEvt = typedGlobalEventListener(); +export const botControlCmd = globalPluginMessageCommand(); +export const botControlEvt = globalPluginEventListener(); diff --git a/backend/src/plugins/ChannelArchiver/types.ts b/backend/src/plugins/ChannelArchiver/types.ts index ba33834c..b7968b3a 100644 --- a/backend/src/plugins/ChannelArchiver/types.ts +++ b/backend/src/plugins/ChannelArchiver/types.ts @@ -1,7 +1,7 @@ -import { BasePluginType, typedGuildCommand } from "knub"; +import { BasePluginType, guildPluginMessageCommand } from "knub"; export interface ChannelArchiverPluginType extends BasePluginType { state: {}; } -export const channelArchiverCmd = typedGuildCommand(); +export const channelArchiverCmd = guildPluginMessageCommand(); diff --git a/backend/src/plugins/CompanionChannels/types.ts b/backend/src/plugins/CompanionChannels/types.ts index 070295af..46a8a45f 100644 --- a/backend/src/plugins/CompanionChannels/types.ts +++ b/backend/src/plugins/CompanionChannels/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, CooldownManager, typedGuildEventListener } from "knub"; +import { BasePluginType, CooldownManager, guildPluginEventListener } from "knub"; import { GuildLogs } from "../../data/GuildLogs"; import { tNullable } from "../../utils"; @@ -29,4 +29,4 @@ export interface CompanionChannelsPluginType extends BasePluginType { }; } -export const companionChannelsEvt = typedGuildEventListener(); +export const companionChannelsEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/ContextMenus/types.ts b/backend/src/plugins/ContextMenus/types.ts index e73d686d..02c4a29c 100644 --- a/backend/src/plugins/ContextMenus/types.ts +++ b/backend/src/plugins/ContextMenus/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginEventListener } from "knub"; import { GuildContextMenuLinks } from "../../data/GuildContextMenuLinks"; export const ConfigSchema = t.type({ @@ -22,4 +22,4 @@ export interface ContextMenuPluginType extends BasePluginType { }; } -export const contextMenuEvt = typedGuildEventListener(); +export const contextMenuEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Counters/commands/AddCounterCmd.ts b/backend/src/plugins/Counters/commands/AddCounterCmd.ts index c045469f..486a45d4 100644 --- a/backend/src/plugins/Counters/commands/AddCounterCmd.ts +++ b/backend/src/plugins/Counters/commands/AddCounterCmd.ts @@ -1,5 +1,5 @@ import { Snowflake, TextChannel } from "discord.js"; -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { waitForReply } from "knub/dist/helpers"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage } from "../../../pluginUtils"; @@ -7,7 +7,7 @@ import { resolveUser, UnknownUser } from "../../../utils"; import { changeCounterValue } from "../functions/changeCounterValue"; import { CountersPluginType } from "../types"; -export const AddCounterCmd = typedGuildCommand()({ +export const AddCounterCmd = guildPluginMessageCommand()({ trigger: ["counters add", "counter add", "addcounter"], permission: "can_edit", diff --git a/backend/src/plugins/Counters/commands/CountersListCmd.ts b/backend/src/plugins/Counters/commands/CountersListCmd.ts index f725ac71..58b5712b 100644 --- a/backend/src/plugins/Counters/commands/CountersListCmd.ts +++ b/backend/src/plugins/Counters/commands/CountersListCmd.ts @@ -1,10 +1,10 @@ -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { sendErrorMessage } from "../../../pluginUtils"; import { trimMultilineString, ucfirst } from "../../../utils"; import { getGuildPrefix } from "../../../utils/getGuildPrefix"; import { CountersPluginType } from "../types"; -export const CountersListCmd = typedGuildCommand()({ +export const CountersListCmd = guildPluginMessageCommand()({ trigger: ["counters list", "counter list", "counters"], permission: "can_view", @@ -44,7 +44,7 @@ export const CountersListCmd = typedGuildCommand()({ message.channel.send( trimMultilineString(` ${counterLines.join("\n\n")} - + ${hintLines.join("\n")} `), ); diff --git a/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts b/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts index af8dc9ad..3a44ecaa 100644 --- a/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts +++ b/backend/src/plugins/Counters/commands/ResetAllCounterValuesCmd.ts @@ -1,11 +1,11 @@ -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils"; import { confirm, noop, trimMultilineString } from "../../../utils"; import { resetAllCounterValues } from "../functions/resetAllCounterValues"; import { CountersPluginType } from "../types"; -export const ResetAllCounterValuesCmd = typedGuildCommand()({ +export const ResetAllCounterValuesCmd = guildPluginMessageCommand()({ trigger: ["counters reset_all"], permission: "can_reset_all", diff --git a/backend/src/plugins/Counters/commands/ResetCounterCmd.ts b/backend/src/plugins/Counters/commands/ResetCounterCmd.ts index 2c92d329..56e7672e 100644 --- a/backend/src/plugins/Counters/commands/ResetCounterCmd.ts +++ b/backend/src/plugins/Counters/commands/ResetCounterCmd.ts @@ -1,5 +1,5 @@ import { Snowflake, TextChannel } from "discord.js"; -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { waitForReply } from "knub/dist/helpers"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage } from "../../../pluginUtils"; @@ -7,7 +7,7 @@ import { resolveUser, UnknownUser } from "../../../utils"; import { setCounterValue } from "../functions/setCounterValue"; import { CountersPluginType } from "../types"; -export const ResetCounterCmd = typedGuildCommand()({ +export const ResetCounterCmd = guildPluginMessageCommand()({ trigger: ["counters reset", "counter reset", "resetcounter"], permission: "can_edit", diff --git a/backend/src/plugins/Counters/commands/SetCounterCmd.ts b/backend/src/plugins/Counters/commands/SetCounterCmd.ts index 5052c23c..2b488511 100644 --- a/backend/src/plugins/Counters/commands/SetCounterCmd.ts +++ b/backend/src/plugins/Counters/commands/SetCounterCmd.ts @@ -1,5 +1,5 @@ import { Snowflake, TextChannel } from "discord.js"; -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { waitForReply } from "knub/dist/helpers"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage } from "../../../pluginUtils"; @@ -7,7 +7,7 @@ import { resolveUser, UnknownUser } from "../../../utils"; import { setCounterValue } from "../functions/setCounterValue"; import { CountersPluginType } from "../types"; -export const SetCounterCmd = typedGuildCommand()({ +export const SetCounterCmd = guildPluginMessageCommand()({ trigger: ["counters set", "counter set", "setcounter"], permission: "can_edit", diff --git a/backend/src/plugins/Counters/commands/ViewCounterCmd.ts b/backend/src/plugins/Counters/commands/ViewCounterCmd.ts index 9a4cbca5..d4d95b76 100644 --- a/backend/src/plugins/Counters/commands/ViewCounterCmd.ts +++ b/backend/src/plugins/Counters/commands/ViewCounterCmd.ts @@ -1,12 +1,12 @@ import { Snowflake, TextChannel } from "discord.js"; -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { waitForReply } from "knub/dist/helpers"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage } from "../../../pluginUtils"; import { resolveUser, UnknownUser } from "../../../utils"; import { CountersPluginType } from "../types"; -export const ViewCounterCmd = typedGuildCommand()({ +export const ViewCounterCmd = guildPluginMessageCommand()({ trigger: ["counters view", "counter view", "viewcounter", "counter"], permission: "can_view", diff --git a/backend/src/plugins/CustomEvents/CustomEventsPlugin.ts b/backend/src/plugins/CustomEvents/CustomEventsPlugin.ts index 391ee191..65ad223e 100644 --- a/backend/src/plugins/CustomEvents/CustomEventsPlugin.ts +++ b/backend/src/plugins/CustomEvents/CustomEventsPlugin.ts @@ -1,4 +1,4 @@ -import { parseSignature, typedGuildCommand } from "knub"; +import { parseSignature, guildPluginMessageCommand } from "knub"; import { commandTypes } from "../../commandTypes"; import { stripObjectToScalars, UnknownUser } from "../../utils"; import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint"; @@ -32,7 +32,7 @@ export const CustomEventsPlugin = zeppelinGuildPlugin()( for (const [key, event] of Object.entries(config.events)) { if (event.trigger.type === "command") { const signature = event.trigger.params ? parseSignature(event.trigger.params, commandTypes) : {}; - const eventCommand = typedGuildCommand({ + const eventCommand = guildPluginMessageCommand({ trigger: event.trigger.name, permission: `events.${key}.trigger.can_use`, signature, diff --git a/backend/src/plugins/GuildAccessMonitor/GuildAccessMonitorPlugin.ts b/backend/src/plugins/GuildAccessMonitor/GuildAccessMonitorPlugin.ts index 80da1ebd..c0445685 100644 --- a/backend/src/plugins/GuildAccessMonitor/GuildAccessMonitorPlugin.ts +++ b/backend/src/plugins/GuildAccessMonitor/GuildAccessMonitorPlugin.ts @@ -1,6 +1,6 @@ import { Guild } from "discord.js"; import * as t from "io-ts"; -import { BasePluginType, GlobalPluginData, typedGlobalEventListener } from "knub"; +import { BasePluginType, GlobalPluginData, globalPluginEventListener } from "knub"; import { AllowedGuilds } from "../../data/AllowedGuilds"; import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint"; import { env } from "../../env"; @@ -29,7 +29,7 @@ export const GuildAccessMonitorPlugin = zeppelinGlobalPlugin()({ + globalPluginEventListener()({ event: "guildCreate", listener({ pluginData, args: { guild } }) { checkGuild(pluginData, guild); diff --git a/backend/src/plugins/GuildInfoSaver/GuildInfoSaverPlugin.ts b/backend/src/plugins/GuildInfoSaver/GuildInfoSaverPlugin.ts index dbb0c214..695486b2 100644 --- a/backend/src/plugins/GuildInfoSaver/GuildInfoSaverPlugin.ts +++ b/backend/src/plugins/GuildInfoSaver/GuildInfoSaverPlugin.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { GuildPluginData, typedGuildEventListener } from "knub"; +import { GuildPluginData, guildPluginEventListener } from "knub"; import { AllowedGuilds } from "../../data/AllowedGuilds"; import { MINUTES } from "../../utils"; import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint"; @@ -14,7 +14,7 @@ export const GuildInfoSaverPlugin = zeppelinGuildPlugin(); -export const locateUserEvt = typedGuildEventListener(); +export const locateUserCmd = guildPluginMessageCommand(); +export const locateUserEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Logs/types.ts b/backend/src/plugins/Logs/types.ts index 511636a6..f3417d4f 100644 --- a/backend/src/plugins/Logs/types.ts +++ b/backend/src/plugins/Logs/types.ts @@ -1,6 +1,6 @@ import * as t from "io-ts"; import { z } from "zod"; -import { BasePluginType, CooldownManager, typedGuildEventListener } from "knub"; +import { BasePluginType, CooldownManager, guildPluginEventListener } from "knub"; import { GuildArchives } from "../../data/GuildArchives"; import { GuildCases } from "../../data/GuildCases"; import { GuildLogs } from "../../data/GuildLogs"; @@ -96,7 +96,7 @@ export interface LogsPluginType extends BasePluginType { }; } -export const logsEvt = typedGuildEventListener(); +export const logsEvt = guildPluginEventListener(); export const LogTypeData = z.object({ [LogType.MEMBER_WARN]: z.object({ diff --git a/backend/src/plugins/MessageSaver/types.ts b/backend/src/plugins/MessageSaver/types.ts index 28495da3..d698be6f 100644 --- a/backend/src/plugins/MessageSaver/types.ts +++ b/backend/src/plugins/MessageSaver/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { Queue } from "../../Queue"; @@ -15,5 +15,5 @@ export interface MessageSaverPluginType extends BasePluginType { }; } -export const messageSaverCmd = typedGuildCommand(); -export const messageSaverEvt = typedGuildEventListener(); +export const messageSaverCmd = guildPluginMessageCommand(); +export const messageSaverEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/ModActions/types.ts b/backend/src/plugins/ModActions/types.ts index 16e8e15e..cf7ce81b 100644 --- a/backend/src/plugins/ModActions/types.ts +++ b/backend/src/plugins/ModActions/types.ts @@ -1,7 +1,7 @@ import { TextChannel } from "discord.js"; import { EventEmitter } from "events"; import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { Case } from "../../data/entities/Case"; import { GuildCases } from "../../data/GuildCases"; import { GuildLogs } from "../../data/GuildLogs"; @@ -149,5 +149,5 @@ export interface BanOptions { export type ModActionType = "note" | "warn" | "mute" | "unmute" | "kick" | "ban" | "unban"; -export const modActionsCmd = typedGuildCommand(); -export const modActionsEvt = typedGuildEventListener(); +export const modActionsCmd = guildPluginMessageCommand(); +export const modActionsEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Mutes/types.ts b/backend/src/plugins/Mutes/types.ts index b612b029..a447300e 100644 --- a/backend/src/plugins/Mutes/types.ts +++ b/backend/src/plugins/Mutes/types.ts @@ -1,7 +1,7 @@ import { GuildMember } from "discord.js"; import { EventEmitter } from "events"; import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { Case } from "../../data/entities/Case"; import { Mute } from "../../data/entities/Mute"; import { GuildArchives } from "../../data/GuildArchives"; @@ -79,5 +79,5 @@ export interface MuteOptions { isAutomodAction?: boolean; } -export const mutesCmd = typedGuildCommand(); -export const mutesEvt = typedGuildEventListener(); +export const mutesCmd = guildPluginMessageCommand(); +export const mutesEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/NameHistory/types.ts b/backend/src/plugins/NameHistory/types.ts index 8102b59f..f74c2a53 100644 --- a/backend/src/plugins/NameHistory/types.ts +++ b/backend/src/plugins/NameHistory/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { GuildNicknameHistory } from "../../data/GuildNicknameHistory"; import { UsernameHistory } from "../../data/UsernameHistory"; import { Queue } from "../../Queue"; @@ -18,5 +18,5 @@ export interface NameHistoryPluginType extends BasePluginType { }; } -export const nameHistoryCmd = typedGuildCommand(); -export const nameHistoryEvt = typedGuildEventListener(); +export const nameHistoryCmd = guildPluginMessageCommand(); +export const nameHistoryEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Persist/types.ts b/backend/src/plugins/Persist/types.ts index 8475f4be..8ab258b7 100644 --- a/backend/src/plugins/Persist/types.ts +++ b/backend/src/plugins/Persist/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginEventListener } from "knub"; import { GuildLogs } from "../../data/GuildLogs"; import { GuildPersistedData } from "../../data/GuildPersistedData"; @@ -19,4 +19,4 @@ export interface PersistPluginType extends BasePluginType { }; } -export const persistEvt = typedGuildEventListener(); +export const persistEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Phisherman/PhishermanPlugin.ts b/backend/src/plugins/Phisherman/PhishermanPlugin.ts index 4b8a9d5e..7ed9a255 100644 --- a/backend/src/plugins/Phisherman/PhishermanPlugin.ts +++ b/backend/src/plugins/Phisherman/PhishermanPlugin.ts @@ -1,4 +1,4 @@ -import { PluginOptions, typedGuildCommand } from "knub"; +import { PluginOptions, guildPluginMessageCommand } from "knub"; import { GuildPingableRoles } from "../../data/GuildPingableRoles"; import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint"; import { ConfigSchema, PhishermanPluginType } from "./types"; diff --git a/backend/src/plugins/PingableRoles/types.ts b/backend/src/plugins/PingableRoles/types.ts index cc479a99..56328bf3 100644 --- a/backend/src/plugins/PingableRoles/types.ts +++ b/backend/src/plugins/PingableRoles/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { PingableRole } from "../../data/entities/PingableRole"; import { GuildPingableRoles } from "../../data/GuildPingableRoles"; @@ -18,5 +18,5 @@ export interface PingableRolesPluginType extends BasePluginType { }; } -export const pingableRolesCmd = typedGuildCommand(); -export const pingableRolesEvt = typedGuildEventListener(); +export const pingableRolesCmd = guildPluginMessageCommand(); +export const pingableRolesEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Post/types.ts b/backend/src/plugins/Post/types.ts index 493e8444..815b19b8 100644 --- a/backend/src/plugins/Post/types.ts +++ b/backend/src/plugins/Post/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand } from "knub"; +import { BasePluginType, guildPluginMessageCommand } from "knub"; import { GuildLogs } from "../../data/GuildLogs"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildScheduledPosts } from "../../data/GuildScheduledPosts"; @@ -20,4 +20,4 @@ export interface PostPluginType extends BasePluginType { }; } -export const postCmd = typedGuildCommand(); +export const postCmd = guildPluginMessageCommand(); diff --git a/backend/src/plugins/ReactionRoles/types.ts b/backend/src/plugins/ReactionRoles/types.ts index 412d798a..61c8f0e1 100644 --- a/backend/src/plugins/ReactionRoles/types.ts +++ b/backend/src/plugins/ReactionRoles/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { GuildReactionRoles } from "../../data/GuildReactionRoles"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { Queue } from "../../Queue"; @@ -43,5 +43,5 @@ export interface ReactionRolesPluginType extends BasePluginType { }; } -export const reactionRolesCmd = typedGuildCommand(); -export const reactionRolesEvt = typedGuildEventListener(); +export const reactionRolesCmd = guildPluginMessageCommand(); +export const reactionRolesEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Reminders/types.ts b/backend/src/plugins/Reminders/types.ts index be9f3fdb..5bc896ba 100644 --- a/backend/src/plugins/Reminders/types.ts +++ b/backend/src/plugins/Reminders/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand } from "knub"; +import { BasePluginType, guildPluginMessageCommand } from "knub"; import { GuildReminders } from "../../data/GuildReminders"; export const ConfigSchema = t.type({ @@ -20,4 +20,4 @@ export interface RemindersPluginType extends BasePluginType { }; } -export const remindersCmd = typedGuildCommand(); +export const remindersCmd = guildPluginMessageCommand(); diff --git a/backend/src/plugins/RoleButtons/commands/resetButtons.ts b/backend/src/plugins/RoleButtons/commands/resetButtons.ts index 0445e5b3..2e082a77 100644 --- a/backend/src/plugins/RoleButtons/commands/resetButtons.ts +++ b/backend/src/plugins/RoleButtons/commands/resetButtons.ts @@ -1,10 +1,10 @@ -import { typedGuildCommand } from "knub"; +import { guildPluginMessageCommand } from "knub"; import { RoleButtonsPluginType } from "../types"; import { commandTypeHelpers as ct } from "../../../commandTypes"; import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils"; import { applyAllRoleButtons } from "../functions/applyAllRoleButtons"; -export const resetButtonsCmd = typedGuildCommand()({ +export const resetButtonsCmd = guildPluginMessageCommand()({ trigger: "role_buttons reset", description: "In case of issues, you can run this command to have Zeppelin 'forget' about specific role buttons and re-apply them. This will also repost the message, if not targeting an existing message.", diff --git a/backend/src/plugins/RoleButtons/events/buttonInteraction.ts b/backend/src/plugins/RoleButtons/events/buttonInteraction.ts index 579ea7e9..2b734a38 100644 --- a/backend/src/plugins/RoleButtons/events/buttonInteraction.ts +++ b/backend/src/plugins/RoleButtons/events/buttonInteraction.ts @@ -1,11 +1,11 @@ -import { typedGuildEventListener } from "knub"; +import { guildPluginEventListener } from "knub"; import { RoleButtonsPluginType, TRoleButtonOption } from "../types"; import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin"; import { GuildMember } from "discord.js"; import { getAllRolesInButtons } from "../functions/getAllRolesInButtons"; import { parseCustomId } from "../../../utils/parseCustomId"; -export const onButtonInteraction = typedGuildEventListener()({ +export const onButtonInteraction = guildPluginEventListener()({ event: "interactionCreate", async listener({ pluginData, args }) { if (!args.interaction.isButton()) { diff --git a/backend/src/plugins/RoleManager/types.ts b/backend/src/plugins/RoleManager/types.ts index d3adc30b..3494b1ea 100644 --- a/backend/src/plugins/RoleManager/types.ts +++ b/backend/src/plugins/RoleManager/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand } from "knub"; +import { BasePluginType, guildPluginMessageCommand } from "knub"; import { GuildLogs } from "../../data/GuildLogs"; import { GuildRoleQueue } from "../../data/GuildRoleQueue"; diff --git a/backend/src/plugins/Roles/types.ts b/backend/src/plugins/Roles/types.ts index e8c614a6..346dc562 100644 --- a/backend/src/plugins/Roles/types.ts +++ b/backend/src/plugins/Roles/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand } from "knub"; +import { BasePluginType, guildPluginMessageCommand } from "knub"; import { GuildLogs } from "../../data/GuildLogs"; export const ConfigSchema = t.type({ @@ -16,4 +16,4 @@ export interface RolesPluginType extends BasePluginType { }; } -export const rolesCmd = typedGuildCommand(); +export const rolesCmd = guildPluginMessageCommand(); diff --git a/backend/src/plugins/SelfGrantableRoles/types.ts b/backend/src/plugins/SelfGrantableRoles/types.ts index dbebcf9f..08d665df 100644 --- a/backend/src/plugins/SelfGrantableRoles/types.ts +++ b/backend/src/plugins/SelfGrantableRoles/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, CooldownManager, typedGuildCommand } from "knub"; +import { BasePluginType, CooldownManager, guildPluginMessageCommand } from "knub"; const RoleMap = t.record(t.string, t.array(t.string)); @@ -31,4 +31,4 @@ export interface SelfGrantableRolesPluginType extends BasePluginType { }; } -export const selfGrantableRolesCmd = typedGuildCommand(); +export const selfGrantableRolesCmd = guildPluginMessageCommand(); diff --git a/backend/src/plugins/Slowmode/types.ts b/backend/src/plugins/Slowmode/types.ts index 21f0de69..49f853d0 100644 --- a/backend/src/plugins/Slowmode/types.ts +++ b/backend/src/plugins/Slowmode/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { GuildLogs } from "../../data/GuildLogs"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSlowmodes } from "../../data/GuildSlowmodes"; @@ -27,5 +27,5 @@ export interface SlowmodePluginType extends BasePluginType { }; } -export const slowmodeCmd = typedGuildCommand(); -export const slowmodeEvt = typedGuildEventListener(); +export const slowmodeCmd = guildPluginMessageCommand(); +export const slowmodeEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Spam/types.ts b/backend/src/plugins/Spam/types.ts index 68697f02..1e561477 100644 --- a/backend/src/plugins/Spam/types.ts +++ b/backend/src/plugins/Spam/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginEventListener } from "knub"; import { GuildArchives } from "../../data/GuildArchives"; import { GuildLogs } from "../../data/GuildLogs"; import { GuildMutes } from "../../data/GuildMutes"; @@ -77,4 +77,4 @@ export interface SpamPluginType extends BasePluginType { }; } -export const spamEvt = typedGuildEventListener(); +export const spamEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Starboard/types.ts b/backend/src/plugins/Starboard/types.ts index 4e1f54eb..84409284 100644 --- a/backend/src/plugins/Starboard/types.ts +++ b/backend/src/plugins/Starboard/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildStarboardMessages } from "../../data/GuildStarboardMessages"; import { GuildStarboardReactions } from "../../data/GuildStarboardReactions"; @@ -44,5 +44,5 @@ export interface StarboardPluginType extends BasePluginType { }; } -export const starboardCmd = typedGuildCommand(); -export const starboardEvt = typedGuildEventListener(); +export const starboardCmd = guildPluginMessageCommand(); +export const starboardEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Tags/types.ts b/backend/src/plugins/Tags/types.ts index 7c0ce10c..7ff9328f 100644 --- a/backend/src/plugins/Tags/types.ts +++ b/backend/src/plugins/Tags/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { GuildArchives } from "../../data/GuildArchives"; import { GuildLogs } from "../../data/GuildLogs"; import { GuildSavedMessages } from "../../data/GuildSavedMessages"; @@ -68,5 +68,5 @@ export interface TemplateFunction { examples?: string[]; } -export const tagsCmd = typedGuildCommand(); -export const tagsEvt = typedGuildEventListener(); +export const tagsCmd = guildPluginMessageCommand(); +export const tagsEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Tags/util/onMessageDelete.ts b/backend/src/plugins/Tags/util/onMessageDelete.ts index b0692f4c..206c9465 100644 --- a/backend/src/plugins/Tags/util/onMessageDelete.ts +++ b/backend/src/plugins/Tags/util/onMessageDelete.ts @@ -1,10 +1,10 @@ import { Snowflake, TextChannel } from "discord.js"; -import { GuildPluginData, typedGuildEventListener } from "knub"; +import { GuildPluginData, guildPluginEventListener } from "knub"; import { SavedMessage } from "../../../data/entities/SavedMessage"; import { TagsPluginType } from "../types"; import { noop } from "../../../utils"; -export const onMessageDelete = typedGuildEventListener({ +export const onMessageDelete = guildPluginEventListener({ event: "messageDelete", async listener({ pluginData, args: { message: msg } }) { // Command message was deleted -> delete the response as well diff --git a/backend/src/plugins/TimeAndDate/types.ts b/backend/src/plugins/TimeAndDate/types.ts index c0144bfd..102d620b 100644 --- a/backend/src/plugins/TimeAndDate/types.ts +++ b/backend/src/plugins/TimeAndDate/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand } from "knub"; +import { BasePluginType, guildPluginMessageCommand } from "knub"; import { GuildMemberTimezones } from "../../data/GuildMemberTimezones"; import { tNullable, tPartialDictionary } from "../../utils"; import { tValidTimezone } from "../../utils/tValidTimezone"; @@ -19,4 +19,4 @@ export interface TimeAndDatePluginType extends BasePluginType { }; } -export const timeAndDateCmd = typedGuildCommand(); +export const timeAndDateCmd = guildPluginMessageCommand(); diff --git a/backend/src/plugins/UsernameSaver/types.ts b/backend/src/plugins/UsernameSaver/types.ts index 9a4a6b04..70fc3f12 100644 --- a/backend/src/plugins/UsernameSaver/types.ts +++ b/backend/src/plugins/UsernameSaver/types.ts @@ -1,4 +1,4 @@ -import { BasePluginType, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginEventListener } from "knub"; import { UsernameHistory } from "../../data/UsernameHistory"; import { Queue } from "../../Queue"; @@ -9,4 +9,4 @@ export interface UsernameSaverPluginType extends BasePluginType { }; } -export const usernameSaverEvt = typedGuildEventListener(); +export const usernameSaverEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/Utility/types.ts b/backend/src/plugins/Utility/types.ts index 15f6e925..949d3042 100644 --- a/backend/src/plugins/Utility/types.ts +++ b/backend/src/plugins/Utility/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub"; import { GuildArchives } from "../../data/GuildArchives"; import { GuildCases } from "../../data/GuildCases"; import { GuildLogs } from "../../data/GuildLogs"; @@ -52,5 +52,5 @@ export interface UtilityPluginType extends BasePluginType { }; } -export const utilityCmd = typedGuildCommand(); -export const utilityEvt = typedGuildEventListener(); +export const utilityCmd = guildPluginMessageCommand(); +export const utilityEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/WelcomeMessage/types.ts b/backend/src/plugins/WelcomeMessage/types.ts index c4a995da..682cfe39 100644 --- a/backend/src/plugins/WelcomeMessage/types.ts +++ b/backend/src/plugins/WelcomeMessage/types.ts @@ -1,5 +1,5 @@ import * as t from "io-ts"; -import { BasePluginType, typedGuildEventListener } from "knub"; +import { BasePluginType, guildPluginEventListener } from "knub"; import { GuildLogs } from "../../data/GuildLogs"; import { tNullable } from "../../utils"; @@ -18,4 +18,4 @@ export interface WelcomeMessagePluginType extends BasePluginType { }; } -export const welcomeMessageEvt = typedGuildEventListener(); +export const welcomeMessageEvt = guildPluginEventListener(); diff --git a/backend/src/plugins/ZeppelinPluginBlueprint.ts b/backend/src/plugins/ZeppelinPluginBlueprint.ts index bb8cc70d..a5f8fec9 100644 --- a/backend/src/plugins/ZeppelinPluginBlueprint.ts +++ b/backend/src/plugins/ZeppelinPluginBlueprint.ts @@ -5,8 +5,8 @@ import { GlobalPluginData, GuildPluginBlueprint, GuildPluginData, - typedGlobalPlugin, - typedGuildPlugin, + globalPlugin, + guildPlugin, } from "knub"; import { PluginOptions } from "knub/dist/config/configTypes"; import { Awaitable } from "knub/dist/utils"; @@ -50,8 +50,8 @@ export function zeppelinGuildPlugin(): < export function zeppelinGuildPlugin(...args) { if (args.length) { - const blueprint = typedGuildPlugin( - ...(args as Parameters), + const blueprint = guildPlugin( + ...(args as Parameters), ) as unknown as ZeppelinGuildPluginBlueprint; blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor); return blueprint; @@ -84,8 +84,8 @@ export function zeppelinGlobalPlugin(): < export function zeppelinGlobalPlugin(...args) { if (args.length) { - const blueprint = typedGlobalPlugin( - ...(args as Parameters), + const blueprint = globalPlugin( + ...(args as Parameters), ) as unknown as ZeppelinGlobalPluginBlueprint; // @ts-ignore FIXME: Check the types here blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor);