3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 14:11:50 +00:00

new knub typings

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
metal 2023-03-11 11:07:43 +00:00 committed by GitHub
parent 386ca4d488
commit 166b237541
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 114 additions and 114 deletions

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildAutoReactions } from "../../data/GuildAutoReactions"; import { GuildAutoReactions } from "../../data/GuildAutoReactions";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
@ -20,5 +20,5 @@ export interface AutoReactionsPluginType extends BasePluginType {
}; };
} }
export const autoReactionsCmd = typedGuildCommand<AutoReactionsPluginType>(); export const autoReactionsCmd = guildPluginMessageCommand<AutoReactionsPluginType>();
export const autoReactionsEvt = typedGuildEventListener<AutoReactionsPluginType>(); export const autoReactionsEvt = guildPluginEventListener<AutoReactionsPluginType>();

View file

@ -1,9 +1,9 @@
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { sendSuccessMessage } from "../../../pluginUtils"; import { sendSuccessMessage } from "../../../pluginUtils";
import { setAntiraidLevel } from "../functions/setAntiraidLevel"; import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { AutomodPluginType } from "../types"; import { AutomodPluginType } from "../types";
export const AntiraidClearCmd = typedGuildCommand<AutomodPluginType>()({ export const AntiraidClearCmd = guildPluginMessageCommand<AutomodPluginType>()({
trigger: ["antiraid clear", "antiraid reset", "antiraid none", "antiraid off"], trigger: ["antiraid clear", "antiraid reset", "antiraid none", "antiraid off"],
permission: "can_set_antiraid", permission: "can_set_antiraid",

View file

@ -1,10 +1,10 @@
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils"; import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { setAntiraidLevel } from "../functions/setAntiraidLevel"; import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { AutomodPluginType } from "../types"; import { AutomodPluginType } from "../types";
export const SetAntiraidCmd = typedGuildCommand<AutomodPluginType>()({ export const SetAntiraidCmd = guildPluginMessageCommand<AutomodPluginType>()({
trigger: "antiraid", trigger: "antiraid",
permission: "can_set_antiraid", permission: "can_set_antiraid",

View file

@ -1,7 +1,7 @@
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { AutomodPluginType } from "../types"; import { AutomodPluginType } from "../types";
export const ViewAntiraidCmd = typedGuildCommand<AutomodPluginType>()({ export const ViewAntiraidCmd = guildPluginMessageCommand<AutomodPluginType>()({
trigger: "antiraid", trigger: "antiraid",
permission: "can_view_antiraid", permission: "can_view_antiraid",

View file

@ -1,9 +1,9 @@
import { typedGuildEventListener } from "knub"; import { guildPluginEventListener } from "knub";
import { RecentActionType } from "../constants"; import { RecentActionType } from "../constants";
import { runAutomod } from "../functions/runAutomod"; import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types"; import { AutomodContext, AutomodPluginType } from "../types";
export const RunAutomodOnJoinEvt = typedGuildEventListener<AutomodPluginType>()({ export const RunAutomodOnJoinEvt = guildPluginEventListener<AutomodPluginType>()({
event: "guildMemberAdd", event: "guildMemberAdd",
listener({ pluginData, args: { member } }) { listener({ pluginData, args: { member } }) {
const context: AutomodContext = { const context: AutomodContext = {
@ -26,7 +26,7 @@ export const RunAutomodOnJoinEvt = typedGuildEventListener<AutomodPluginType>()(
}, },
}); });
export const RunAutomodOnLeaveEvt = typedGuildEventListener<AutomodPluginType>()({ export const RunAutomodOnLeaveEvt = guildPluginEventListener<AutomodPluginType>()({
event: "guildMemberRemove", event: "guildMemberRemove",
listener({ pluginData, args: { member } }) { listener({ pluginData, args: { member } }) {
const context: AutomodContext = { const context: AutomodContext = {

View file

@ -1,10 +1,10 @@
import { typedGuildEventListener } from "knub"; import { guildPluginEventListener } from "knub";
import diff from "lodash.difference"; import diff from "lodash.difference";
import isEqual from "lodash.isequal"; import isEqual from "lodash.isequal";
import { runAutomod } from "../functions/runAutomod"; import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types"; import { AutomodContext, AutomodPluginType } from "../types";
export const RunAutomodOnMemberUpdate = typedGuildEventListener<AutomodPluginType>()({ export const RunAutomodOnMemberUpdate = guildPluginEventListener<AutomodPluginType>()({
event: "guildMemberUpdate", event: "guildMemberUpdate",
listener({ pluginData, args: { oldMember, newMember } }) { listener({ pluginData, args: { oldMember, newMember } }) {
if (!oldMember) return; if (!oldMember) return;

View file

@ -1,9 +1,9 @@
import { typedGuildEventListener } from "knub"; import { guildPluginEventListener } from "knub";
import { RecentActionType } from "../constants"; import { RecentActionType } from "../constants";
import { runAutomod } from "../functions/runAutomod"; import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types"; import { AutomodContext, AutomodPluginType } from "../types";
export const RunAutomodOnThreadCreate = typedGuildEventListener<AutomodPluginType>()({ export const RunAutomodOnThreadCreate = guildPluginEventListener<AutomodPluginType>()({
event: "threadCreate", event: "threadCreate",
async listener({ pluginData, args: { thread } }) { async listener({ pluginData, args: { thread } }) {
const user = thread.ownerId const user = thread.ownerId
@ -32,7 +32,7 @@ export const RunAutomodOnThreadCreate = typedGuildEventListener<AutomodPluginTyp
}, },
}); });
export const RunAutomodOnThreadDelete = typedGuildEventListener<AutomodPluginType>()({ export const RunAutomodOnThreadDelete = guildPluginEventListener<AutomodPluginType>()({
event: "threadDelete", event: "threadDelete",
async listener({ pluginData, args: { thread } }) { async listener({ pluginData, args: { thread } }) {
const user = thread.ownerId const user = thread.ownerId
@ -54,7 +54,7 @@ export const RunAutomodOnThreadDelete = typedGuildEventListener<AutomodPluginTyp
}, },
}); });
export const RunAutomodOnThreadUpdate = typedGuildEventListener<AutomodPluginType>()({ export const RunAutomodOnThreadUpdate = guildPluginEventListener<AutomodPluginType>()({
event: "threadUpdate", event: "threadUpdate",
async listener({ pluginData, args: { oldThread, newThread: thread } }) { async listener({ pluginData, args: { oldThread, newThread: thread } }) {
const user = thread.ownerId const user = thread.ownerId

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGlobalCommand, typedGlobalEventListener } from "knub"; import { BasePluginType, globalPluginMessageCommand, globalPluginEventListener } from "knub";
import { AllowedGuilds } from "../../data/AllowedGuilds"; import { AllowedGuilds } from "../../data/AllowedGuilds";
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments"; import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
import { Configs } from "../../data/Configs"; import { Configs } from "../../data/Configs";
@ -26,5 +26,5 @@ export interface BotControlPluginType extends BasePluginType {
}; };
} }
export const botControlCmd = typedGlobalCommand<BotControlPluginType>(); export const botControlCmd = globalPluginMessageCommand<BotControlPluginType>();
export const botControlEvt = typedGlobalEventListener<BotControlPluginType>(); export const botControlEvt = globalPluginEventListener<BotControlPluginType>();

View file

@ -1,7 +1,7 @@
import { BasePluginType, typedGuildCommand } from "knub"; import { BasePluginType, guildPluginMessageCommand } from "knub";
export interface ChannelArchiverPluginType extends BasePluginType { export interface ChannelArchiverPluginType extends BasePluginType {
state: {}; state: {};
} }
export const channelArchiverCmd = typedGuildCommand<ChannelArchiverPluginType>(); export const channelArchiverCmd = guildPluginMessageCommand<ChannelArchiverPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, CooldownManager, typedGuildEventListener } from "knub"; import { BasePluginType, CooldownManager, guildPluginEventListener } from "knub";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { tNullable } from "../../utils"; import { tNullable } from "../../utils";
@ -29,4 +29,4 @@ export interface CompanionChannelsPluginType extends BasePluginType {
}; };
} }
export const companionChannelsEvt = typedGuildEventListener<CompanionChannelsPluginType>(); export const companionChannelsEvt = guildPluginEventListener<CompanionChannelsPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginEventListener } from "knub";
import { GuildContextMenuLinks } from "../../data/GuildContextMenuLinks"; import { GuildContextMenuLinks } from "../../data/GuildContextMenuLinks";
export const ConfigSchema = t.type({ export const ConfigSchema = t.type({
@ -22,4 +22,4 @@ export interface ContextMenuPluginType extends BasePluginType {
}; };
} }
export const contextMenuEvt = typedGuildEventListener<ContextMenuPluginType>(); export const contextMenuEvt = guildPluginEventListener<ContextMenuPluginType>();

View file

@ -1,5 +1,5 @@
import { Snowflake, TextChannel } from "discord.js"; import { Snowflake, TextChannel } from "discord.js";
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { waitForReply } from "knub/dist/helpers"; import { waitForReply } from "knub/dist/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils"; import { sendErrorMessage } from "../../../pluginUtils";
@ -7,7 +7,7 @@ import { resolveUser, UnknownUser } from "../../../utils";
import { changeCounterValue } from "../functions/changeCounterValue"; import { changeCounterValue } from "../functions/changeCounterValue";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
export const AddCounterCmd = typedGuildCommand<CountersPluginType>()({ export const AddCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters add", "counter add", "addcounter"], trigger: ["counters add", "counter add", "addcounter"],
permission: "can_edit", permission: "can_edit",

View file

@ -1,10 +1,10 @@
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { sendErrorMessage } from "../../../pluginUtils"; import { sendErrorMessage } from "../../../pluginUtils";
import { trimMultilineString, ucfirst } from "../../../utils"; import { trimMultilineString, ucfirst } from "../../../utils";
import { getGuildPrefix } from "../../../utils/getGuildPrefix"; import { getGuildPrefix } from "../../../utils/getGuildPrefix";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
export const CountersListCmd = typedGuildCommand<CountersPluginType>()({ export const CountersListCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters list", "counter list", "counters"], trigger: ["counters list", "counter list", "counters"],
permission: "can_view", permission: "can_view",
@ -44,7 +44,7 @@ export const CountersListCmd = typedGuildCommand<CountersPluginType>()({
message.channel.send( message.channel.send(
trimMultilineString(` trimMultilineString(`
${counterLines.join("\n\n")} ${counterLines.join("\n\n")}
${hintLines.join("\n")} ${hintLines.join("\n")}
`), `),
); );

View file

@ -1,11 +1,11 @@
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils"; import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { confirm, noop, trimMultilineString } from "../../../utils"; import { confirm, noop, trimMultilineString } from "../../../utils";
import { resetAllCounterValues } from "../functions/resetAllCounterValues"; import { resetAllCounterValues } from "../functions/resetAllCounterValues";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
export const ResetAllCounterValuesCmd = typedGuildCommand<CountersPluginType>()({ export const ResetAllCounterValuesCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters reset_all"], trigger: ["counters reset_all"],
permission: "can_reset_all", permission: "can_reset_all",

View file

@ -1,5 +1,5 @@
import { Snowflake, TextChannel } from "discord.js"; import { Snowflake, TextChannel } from "discord.js";
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { waitForReply } from "knub/dist/helpers"; import { waitForReply } from "knub/dist/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils"; import { sendErrorMessage } from "../../../pluginUtils";
@ -7,7 +7,7 @@ import { resolveUser, UnknownUser } from "../../../utils";
import { setCounterValue } from "../functions/setCounterValue"; import { setCounterValue } from "../functions/setCounterValue";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
export const ResetCounterCmd = typedGuildCommand<CountersPluginType>()({ export const ResetCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters reset", "counter reset", "resetcounter"], trigger: ["counters reset", "counter reset", "resetcounter"],
permission: "can_edit", permission: "can_edit",

View file

@ -1,5 +1,5 @@
import { Snowflake, TextChannel } from "discord.js"; import { Snowflake, TextChannel } from "discord.js";
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { waitForReply } from "knub/dist/helpers"; import { waitForReply } from "knub/dist/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils"; import { sendErrorMessage } from "../../../pluginUtils";
@ -7,7 +7,7 @@ import { resolveUser, UnknownUser } from "../../../utils";
import { setCounterValue } from "../functions/setCounterValue"; import { setCounterValue } from "../functions/setCounterValue";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
export const SetCounterCmd = typedGuildCommand<CountersPluginType>()({ export const SetCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters set", "counter set", "setcounter"], trigger: ["counters set", "counter set", "setcounter"],
permission: "can_edit", permission: "can_edit",

View file

@ -1,12 +1,12 @@
import { Snowflake, TextChannel } from "discord.js"; import { Snowflake, TextChannel } from "discord.js";
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { waitForReply } from "knub/dist/helpers"; import { waitForReply } from "knub/dist/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils"; import { sendErrorMessage } from "../../../pluginUtils";
import { resolveUser, UnknownUser } from "../../../utils"; import { resolveUser, UnknownUser } from "../../../utils";
import { CountersPluginType } from "../types"; import { CountersPluginType } from "../types";
export const ViewCounterCmd = typedGuildCommand<CountersPluginType>()({ export const ViewCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters view", "counter view", "viewcounter", "counter"], trigger: ["counters view", "counter view", "viewcounter", "counter"],
permission: "can_view", permission: "can_view",

View file

@ -1,4 +1,4 @@
import { parseSignature, typedGuildCommand } from "knub"; import { parseSignature, guildPluginMessageCommand } from "knub";
import { commandTypes } from "../../commandTypes"; import { commandTypes } from "../../commandTypes";
import { stripObjectToScalars, UnknownUser } from "../../utils"; import { stripObjectToScalars, UnknownUser } from "../../utils";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint"; import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
@ -32,7 +32,7 @@ export const CustomEventsPlugin = zeppelinGuildPlugin<CustomEventsPluginType>()(
for (const [key, event] of Object.entries(config.events)) { for (const [key, event] of Object.entries(config.events)) {
if (event.trigger.type === "command") { if (event.trigger.type === "command") {
const signature = event.trigger.params ? parseSignature(event.trigger.params, commandTypes) : {}; const signature = event.trigger.params ? parseSignature(event.trigger.params, commandTypes) : {};
const eventCommand = typedGuildCommand({ const eventCommand = guildPluginMessageCommand({
trigger: event.trigger.name, trigger: event.trigger.name,
permission: `events.${key}.trigger.can_use`, permission: `events.${key}.trigger.can_use`,
signature, signature,

View file

@ -1,6 +1,6 @@
import { Guild } from "discord.js"; import { Guild } from "discord.js";
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, GlobalPluginData, typedGlobalEventListener } from "knub"; import { BasePluginType, GlobalPluginData, globalPluginEventListener } from "knub";
import { AllowedGuilds } from "../../data/AllowedGuilds"; import { AllowedGuilds } from "../../data/AllowedGuilds";
import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint"; import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint";
import { env } from "../../env"; import { env } from "../../env";
@ -29,7 +29,7 @@ export const GuildAccessMonitorPlugin = zeppelinGlobalPlugin<GuildAccessMonitorP
configSchema: t.type({}), configSchema: t.type({}),
events: [ events: [
typedGlobalEventListener<GuildAccessMonitorPluginType>()({ globalPluginEventListener<GuildAccessMonitorPluginType>()({
event: "guildCreate", event: "guildCreate",
listener({ pluginData, args: { guild } }) { listener({ pluginData, args: { guild } }) {
checkGuild(pluginData, guild); checkGuild(pluginData, guild);

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { GuildPluginData, typedGuildEventListener } from "knub"; import { GuildPluginData, guildPluginEventListener } from "knub";
import { AllowedGuilds } from "../../data/AllowedGuilds"; import { AllowedGuilds } from "../../data/AllowedGuilds";
import { MINUTES } from "../../utils"; import { MINUTES } from "../../utils";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint"; import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
@ -14,7 +14,7 @@ export const GuildInfoSaverPlugin = zeppelinGuildPlugin<GuildInfoSaverPluginType
configSchema: t.type({}), configSchema: t.type({}),
events: [ events: [
typedGuildEventListener({ guildPluginEventListener({
event: "guildUpdate", event: "guildUpdate",
listener({ args }) { listener({ args }) {
void updateGuildInfo(args.newGuild); void updateGuildInfo(args.newGuild);

View file

@ -1,4 +1,4 @@
import { PluginOptions, typedGuildCommand } from "knub"; import { PluginOptions, guildPluginMessageCommand } from "knub";
import { GuildPingableRoles } from "../../data/GuildPingableRoles"; import { GuildPingableRoles } from "../../data/GuildPingableRoles";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint"; import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { ConfigSchema, InternalPosterPluginType } from "./types"; import { ConfigSchema, InternalPosterPluginType } from "./types";

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildVCAlerts } from "../../data/GuildVCAlerts"; import { GuildVCAlerts } from "../../data/GuildVCAlerts";
import Timeout = NodeJS.Timeout; import Timeout = NodeJS.Timeout;
@ -18,5 +18,5 @@ export interface LocateUserPluginType extends BasePluginType {
}; };
} }
export const locateUserCmd = typedGuildCommand<LocateUserPluginType>(); export const locateUserCmd = guildPluginMessageCommand<LocateUserPluginType>();
export const locateUserEvt = typedGuildEventListener<LocateUserPluginType>(); export const locateUserEvt = guildPluginEventListener<LocateUserPluginType>();

View file

@ -1,6 +1,6 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { z } from "zod"; import { z } from "zod";
import { BasePluginType, CooldownManager, typedGuildEventListener } from "knub"; import { BasePluginType, CooldownManager, guildPluginEventListener } from "knub";
import { GuildArchives } from "../../data/GuildArchives"; import { GuildArchives } from "../../data/GuildArchives";
import { GuildCases } from "../../data/GuildCases"; import { GuildCases } from "../../data/GuildCases";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
@ -96,7 +96,7 @@ export interface LogsPluginType extends BasePluginType {
}; };
} }
export const logsEvt = typedGuildEventListener<LogsPluginType>(); export const logsEvt = guildPluginEventListener<LogsPluginType>();
export const LogTypeData = z.object({ export const LogTypeData = z.object({
[LogType.MEMBER_WARN]: z.object({ [LogType.MEMBER_WARN]: z.object({

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { Queue } from "../../Queue"; import { Queue } from "../../Queue";
@ -15,5 +15,5 @@ export interface MessageSaverPluginType extends BasePluginType {
}; };
} }
export const messageSaverCmd = typedGuildCommand<MessageSaverPluginType>(); export const messageSaverCmd = guildPluginMessageCommand<MessageSaverPluginType>();
export const messageSaverEvt = typedGuildEventListener<MessageSaverPluginType>(); export const messageSaverEvt = guildPluginEventListener<MessageSaverPluginType>();

View file

@ -1,7 +1,7 @@
import { TextChannel } from "discord.js"; import { TextChannel } from "discord.js";
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import * as t from "io-ts"; 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 { Case } from "../../data/entities/Case";
import { GuildCases } from "../../data/GuildCases"; import { GuildCases } from "../../data/GuildCases";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
@ -149,5 +149,5 @@ export interface BanOptions {
export type ModActionType = "note" | "warn" | "mute" | "unmute" | "kick" | "ban" | "unban"; export type ModActionType = "note" | "warn" | "mute" | "unmute" | "kick" | "ban" | "unban";
export const modActionsCmd = typedGuildCommand<ModActionsPluginType>(); export const modActionsCmd = guildPluginMessageCommand<ModActionsPluginType>();
export const modActionsEvt = typedGuildEventListener<ModActionsPluginType>(); export const modActionsEvt = guildPluginEventListener<ModActionsPluginType>();

View file

@ -1,7 +1,7 @@
import { GuildMember } from "discord.js"; import { GuildMember } from "discord.js";
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import * as t from "io-ts"; 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 { Case } from "../../data/entities/Case";
import { Mute } from "../../data/entities/Mute"; import { Mute } from "../../data/entities/Mute";
import { GuildArchives } from "../../data/GuildArchives"; import { GuildArchives } from "../../data/GuildArchives";
@ -79,5 +79,5 @@ export interface MuteOptions {
isAutomodAction?: boolean; isAutomodAction?: boolean;
} }
export const mutesCmd = typedGuildCommand<MutesPluginType>(); export const mutesCmd = guildPluginMessageCommand<MutesPluginType>();
export const mutesEvt = typedGuildEventListener<MutesPluginType>(); export const mutesEvt = guildPluginEventListener<MutesPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildNicknameHistory } from "../../data/GuildNicknameHistory"; import { GuildNicknameHistory } from "../../data/GuildNicknameHistory";
import { UsernameHistory } from "../../data/UsernameHistory"; import { UsernameHistory } from "../../data/UsernameHistory";
import { Queue } from "../../Queue"; import { Queue } from "../../Queue";
@ -18,5 +18,5 @@ export interface NameHistoryPluginType extends BasePluginType {
}; };
} }
export const nameHistoryCmd = typedGuildCommand<NameHistoryPluginType>(); export const nameHistoryCmd = guildPluginMessageCommand<NameHistoryPluginType>();
export const nameHistoryEvt = typedGuildEventListener<NameHistoryPluginType>(); export const nameHistoryEvt = guildPluginEventListener<NameHistoryPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginEventListener } from "knub";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { GuildPersistedData } from "../../data/GuildPersistedData"; import { GuildPersistedData } from "../../data/GuildPersistedData";
@ -19,4 +19,4 @@ export interface PersistPluginType extends BasePluginType {
}; };
} }
export const persistEvt = typedGuildEventListener<PersistPluginType>(); export const persistEvt = guildPluginEventListener<PersistPluginType>();

View file

@ -1,4 +1,4 @@
import { PluginOptions, typedGuildCommand } from "knub"; import { PluginOptions, guildPluginMessageCommand } from "knub";
import { GuildPingableRoles } from "../../data/GuildPingableRoles"; import { GuildPingableRoles } from "../../data/GuildPingableRoles";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint"; import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { ConfigSchema, PhishermanPluginType } from "./types"; import { ConfigSchema, PhishermanPluginType } from "./types";

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; 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 { PingableRole } from "../../data/entities/PingableRole";
import { GuildPingableRoles } from "../../data/GuildPingableRoles"; import { GuildPingableRoles } from "../../data/GuildPingableRoles";
@ -18,5 +18,5 @@ export interface PingableRolesPluginType extends BasePluginType {
}; };
} }
export const pingableRolesCmd = typedGuildCommand<PingableRolesPluginType>(); export const pingableRolesCmd = guildPluginMessageCommand<PingableRolesPluginType>();
export const pingableRolesEvt = typedGuildEventListener<PingableRolesPluginType>(); export const pingableRolesEvt = guildPluginEventListener<PingableRolesPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand } from "knub"; import { BasePluginType, guildPluginMessageCommand } from "knub";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { GuildScheduledPosts } from "../../data/GuildScheduledPosts"; import { GuildScheduledPosts } from "../../data/GuildScheduledPosts";
@ -20,4 +20,4 @@ export interface PostPluginType extends BasePluginType {
}; };
} }
export const postCmd = typedGuildCommand<PostPluginType>(); export const postCmd = guildPluginMessageCommand<PostPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildReactionRoles } from "../../data/GuildReactionRoles"; import { GuildReactionRoles } from "../../data/GuildReactionRoles";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { Queue } from "../../Queue"; import { Queue } from "../../Queue";
@ -43,5 +43,5 @@ export interface ReactionRolesPluginType extends BasePluginType {
}; };
} }
export const reactionRolesCmd = typedGuildCommand<ReactionRolesPluginType>(); export const reactionRolesCmd = guildPluginMessageCommand<ReactionRolesPluginType>();
export const reactionRolesEvt = typedGuildEventListener<ReactionRolesPluginType>(); export const reactionRolesEvt = guildPluginEventListener<ReactionRolesPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand } from "knub"; import { BasePluginType, guildPluginMessageCommand } from "knub";
import { GuildReminders } from "../../data/GuildReminders"; import { GuildReminders } from "../../data/GuildReminders";
export const ConfigSchema = t.type({ export const ConfigSchema = t.type({
@ -20,4 +20,4 @@ export interface RemindersPluginType extends BasePluginType {
}; };
} }
export const remindersCmd = typedGuildCommand<RemindersPluginType>(); export const remindersCmd = guildPluginMessageCommand<RemindersPluginType>();

View file

@ -1,10 +1,10 @@
import { typedGuildCommand } from "knub"; import { guildPluginMessageCommand } from "knub";
import { RoleButtonsPluginType } from "../types"; import { RoleButtonsPluginType } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils"; import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { applyAllRoleButtons } from "../functions/applyAllRoleButtons"; import { applyAllRoleButtons } from "../functions/applyAllRoleButtons";
export const resetButtonsCmd = typedGuildCommand<RoleButtonsPluginType>()({ export const resetButtonsCmd = guildPluginMessageCommand<RoleButtonsPluginType>()({
trigger: "role_buttons reset", trigger: "role_buttons reset",
description: 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.", "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.",

View file

@ -1,11 +1,11 @@
import { typedGuildEventListener } from "knub"; import { guildPluginEventListener } from "knub";
import { RoleButtonsPluginType, TRoleButtonOption } from "../types"; import { RoleButtonsPluginType, TRoleButtonOption } from "../types";
import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin"; import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin";
import { GuildMember } from "discord.js"; import { GuildMember } from "discord.js";
import { getAllRolesInButtons } from "../functions/getAllRolesInButtons"; import { getAllRolesInButtons } from "../functions/getAllRolesInButtons";
import { parseCustomId } from "../../../utils/parseCustomId"; import { parseCustomId } from "../../../utils/parseCustomId";
export const onButtonInteraction = typedGuildEventListener<RoleButtonsPluginType>()({ export const onButtonInteraction = guildPluginEventListener<RoleButtonsPluginType>()({
event: "interactionCreate", event: "interactionCreate",
async listener({ pluginData, args }) { async listener({ pluginData, args }) {
if (!args.interaction.isButton()) { if (!args.interaction.isButton()) {

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand } from "knub"; import { BasePluginType, guildPluginMessageCommand } from "knub";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { GuildRoleQueue } from "../../data/GuildRoleQueue"; import { GuildRoleQueue } from "../../data/GuildRoleQueue";

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand } from "knub"; import { BasePluginType, guildPluginMessageCommand } from "knub";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
export const ConfigSchema = t.type({ export const ConfigSchema = t.type({
@ -16,4 +16,4 @@ export interface RolesPluginType extends BasePluginType {
}; };
} }
export const rolesCmd = typedGuildCommand<RolesPluginType>(); export const rolesCmd = guildPluginMessageCommand<RolesPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; 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)); const RoleMap = t.record(t.string, t.array(t.string));
@ -31,4 +31,4 @@ export interface SelfGrantableRolesPluginType extends BasePluginType {
}; };
} }
export const selfGrantableRolesCmd = typedGuildCommand<SelfGrantableRolesPluginType>(); export const selfGrantableRolesCmd = guildPluginMessageCommand<SelfGrantableRolesPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { GuildSlowmodes } from "../../data/GuildSlowmodes"; import { GuildSlowmodes } from "../../data/GuildSlowmodes";
@ -27,5 +27,5 @@ export interface SlowmodePluginType extends BasePluginType {
}; };
} }
export const slowmodeCmd = typedGuildCommand<SlowmodePluginType>(); export const slowmodeCmd = guildPluginMessageCommand<SlowmodePluginType>();
export const slowmodeEvt = typedGuildEventListener<SlowmodePluginType>(); export const slowmodeEvt = guildPluginEventListener<SlowmodePluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginEventListener } from "knub";
import { GuildArchives } from "../../data/GuildArchives"; import { GuildArchives } from "../../data/GuildArchives";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { GuildMutes } from "../../data/GuildMutes"; import { GuildMutes } from "../../data/GuildMutes";
@ -77,4 +77,4 @@ export interface SpamPluginType extends BasePluginType {
}; };
} }
export const spamEvt = typedGuildEventListener<SpamPluginType>(); export const spamEvt = guildPluginEventListener<SpamPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { GuildStarboardMessages } from "../../data/GuildStarboardMessages"; import { GuildStarboardMessages } from "../../data/GuildStarboardMessages";
import { GuildStarboardReactions } from "../../data/GuildStarboardReactions"; import { GuildStarboardReactions } from "../../data/GuildStarboardReactions";
@ -44,5 +44,5 @@ export interface StarboardPluginType extends BasePluginType {
}; };
} }
export const starboardCmd = typedGuildCommand<StarboardPluginType>(); export const starboardCmd = guildPluginMessageCommand<StarboardPluginType>();
export const starboardEvt = typedGuildEventListener<StarboardPluginType>(); export const starboardEvt = guildPluginEventListener<StarboardPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildArchives } from "../../data/GuildArchives"; import { GuildArchives } from "../../data/GuildArchives";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages"; import { GuildSavedMessages } from "../../data/GuildSavedMessages";
@ -68,5 +68,5 @@ export interface TemplateFunction {
examples?: string[]; examples?: string[];
} }
export const tagsCmd = typedGuildCommand<TagsPluginType>(); export const tagsCmd = guildPluginMessageCommand<TagsPluginType>();
export const tagsEvt = typedGuildEventListener<TagsPluginType>(); export const tagsEvt = guildPluginEventListener<TagsPluginType>();

View file

@ -1,10 +1,10 @@
import { Snowflake, TextChannel } from "discord.js"; import { Snowflake, TextChannel } from "discord.js";
import { GuildPluginData, typedGuildEventListener } from "knub"; import { GuildPluginData, guildPluginEventListener } from "knub";
import { SavedMessage } from "../../../data/entities/SavedMessage"; import { SavedMessage } from "../../../data/entities/SavedMessage";
import { TagsPluginType } from "../types"; import { TagsPluginType } from "../types";
import { noop } from "../../../utils"; import { noop } from "../../../utils";
export const onMessageDelete = typedGuildEventListener({ export const onMessageDelete = guildPluginEventListener({
event: "messageDelete", event: "messageDelete",
async listener({ pluginData, args: { message: msg } }) { async listener({ pluginData, args: { message: msg } }) {
// Command message was deleted -> delete the response as well // Command message was deleted -> delete the response as well

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand } from "knub"; import { BasePluginType, guildPluginMessageCommand } from "knub";
import { GuildMemberTimezones } from "../../data/GuildMemberTimezones"; import { GuildMemberTimezones } from "../../data/GuildMemberTimezones";
import { tNullable, tPartialDictionary } from "../../utils"; import { tNullable, tPartialDictionary } from "../../utils";
import { tValidTimezone } from "../../utils/tValidTimezone"; import { tValidTimezone } from "../../utils/tValidTimezone";
@ -19,4 +19,4 @@ export interface TimeAndDatePluginType extends BasePluginType {
}; };
} }
export const timeAndDateCmd = typedGuildCommand<TimeAndDatePluginType>(); export const timeAndDateCmd = guildPluginMessageCommand<TimeAndDatePluginType>();

View file

@ -1,4 +1,4 @@
import { BasePluginType, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginEventListener } from "knub";
import { UsernameHistory } from "../../data/UsernameHistory"; import { UsernameHistory } from "../../data/UsernameHistory";
import { Queue } from "../../Queue"; import { Queue } from "../../Queue";
@ -9,4 +9,4 @@ export interface UsernameSaverPluginType extends BasePluginType {
}; };
} }
export const usernameSaverEvt = typedGuildEventListener<UsernameSaverPluginType>(); export const usernameSaverEvt = guildPluginEventListener<UsernameSaverPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
import { GuildArchives } from "../../data/GuildArchives"; import { GuildArchives } from "../../data/GuildArchives";
import { GuildCases } from "../../data/GuildCases"; import { GuildCases } from "../../data/GuildCases";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
@ -52,5 +52,5 @@ export interface UtilityPluginType extends BasePluginType {
}; };
} }
export const utilityCmd = typedGuildCommand<UtilityPluginType>(); export const utilityCmd = guildPluginMessageCommand<UtilityPluginType>();
export const utilityEvt = typedGuildEventListener<UtilityPluginType>(); export const utilityEvt = guildPluginEventListener<UtilityPluginType>();

View file

@ -1,5 +1,5 @@
import * as t from "io-ts"; import * as t from "io-ts";
import { BasePluginType, typedGuildEventListener } from "knub"; import { BasePluginType, guildPluginEventListener } from "knub";
import { GuildLogs } from "../../data/GuildLogs"; import { GuildLogs } from "../../data/GuildLogs";
import { tNullable } from "../../utils"; import { tNullable } from "../../utils";
@ -18,4 +18,4 @@ export interface WelcomeMessagePluginType extends BasePluginType {
}; };
} }
export const welcomeMessageEvt = typedGuildEventListener<WelcomeMessagePluginType>(); export const welcomeMessageEvt = guildPluginEventListener<WelcomeMessagePluginType>();

View file

@ -5,8 +5,8 @@ import {
GlobalPluginData, GlobalPluginData,
GuildPluginBlueprint, GuildPluginBlueprint,
GuildPluginData, GuildPluginData,
typedGlobalPlugin, globalPlugin,
typedGuildPlugin, guildPlugin,
} from "knub"; } from "knub";
import { PluginOptions } from "knub/dist/config/configTypes"; import { PluginOptions } from "knub/dist/config/configTypes";
import { Awaitable } from "knub/dist/utils"; import { Awaitable } from "knub/dist/utils";
@ -50,8 +50,8 @@ export function zeppelinGuildPlugin<TPluginType extends BasePluginType>(): <
export function zeppelinGuildPlugin(...args) { export function zeppelinGuildPlugin(...args) {
if (args.length) { if (args.length) {
const blueprint = typedGuildPlugin( const blueprint = guildPlugin(
...(args as Parameters<typeof typedGuildPlugin>), ...(args as Parameters<typeof guildPlugin>),
) as unknown as ZeppelinGuildPluginBlueprint; ) as unknown as ZeppelinGuildPluginBlueprint;
blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor); blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor);
return blueprint; return blueprint;
@ -84,8 +84,8 @@ export function zeppelinGlobalPlugin<TPluginType extends BasePluginType>(): <
export function zeppelinGlobalPlugin(...args) { export function zeppelinGlobalPlugin(...args) {
if (args.length) { if (args.length) {
const blueprint = typedGlobalPlugin( const blueprint = globalPlugin(
...(args as Parameters<typeof typedGlobalPlugin>), ...(args as Parameters<typeof globalPlugin>),
) as unknown as ZeppelinGlobalPluginBlueprint; ) as unknown as ZeppelinGlobalPluginBlueprint;
// @ts-ignore FIXME: Check the types here // @ts-ignore FIXME: Check the types here
blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor); blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor);