3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +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 { 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<AutoReactionsPluginType>();
export const autoReactionsEvt = typedGuildEventListener<AutoReactionsPluginType>();
export const autoReactionsCmd = guildPluginMessageCommand<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 { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { AutomodPluginType } from "../types";
export const AntiraidClearCmd = typedGuildCommand<AutomodPluginType>()({
export const AntiraidClearCmd = guildPluginMessageCommand<AutomodPluginType>()({
trigger: ["antiraid clear", "antiraid reset", "antiraid none", "antiraid off"],
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 { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { AutomodPluginType } from "../types";
export const SetAntiraidCmd = typedGuildCommand<AutomodPluginType>()({
export const SetAntiraidCmd = guildPluginMessageCommand<AutomodPluginType>()({
trigger: "antiraid",
permission: "can_set_antiraid",

View file

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

View file

@ -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<AutomodPluginType>()({
export const RunAutomodOnJoinEvt = guildPluginEventListener<AutomodPluginType>()({
event: "guildMemberAdd",
listener({ pluginData, args: { member } }) {
const context: AutomodContext = {
@ -26,7 +26,7 @@ export const RunAutomodOnJoinEvt = typedGuildEventListener<AutomodPluginType>()(
},
});
export const RunAutomodOnLeaveEvt = typedGuildEventListener<AutomodPluginType>()({
export const RunAutomodOnLeaveEvt = guildPluginEventListener<AutomodPluginType>()({
event: "guildMemberRemove",
listener({ pluginData, args: { member } }) {
const context: AutomodContext = {

View file

@ -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<AutomodPluginType>()({
export const RunAutomodOnMemberUpdate = guildPluginEventListener<AutomodPluginType>()({
event: "guildMemberUpdate",
listener({ pluginData, args: { oldMember, newMember } }) {
if (!oldMember) return;

View file

@ -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<AutomodPluginType>()({
export const RunAutomodOnThreadCreate = guildPluginEventListener<AutomodPluginType>()({
event: "threadCreate",
async listener({ pluginData, args: { thread } }) {
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",
async listener({ pluginData, args: { thread } }) {
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",
async listener({ pluginData, args: { oldThread, newThread: thread } }) {
const user = thread.ownerId

View file

@ -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<BotControlPluginType>();
export const botControlEvt = typedGlobalEventListener<BotControlPluginType>();
export const botControlCmd = globalPluginMessageCommand<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 {
state: {};
}
export const channelArchiverCmd = typedGuildCommand<ChannelArchiverPluginType>();
export const channelArchiverCmd = guildPluginMessageCommand<ChannelArchiverPluginType>();

View file

@ -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<CompanionChannelsPluginType>();
export const companionChannelsEvt = guildPluginEventListener<CompanionChannelsPluginType>();

View file

@ -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<ContextMenuPluginType>();
export const contextMenuEvt = guildPluginEventListener<ContextMenuPluginType>();

View file

@ -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<CountersPluginType>()({
export const AddCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters add", "counter add", "addcounter"],
permission: "can_edit",

View file

@ -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<CountersPluginType>()({
export const CountersListCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters list", "counter list", "counters"],
permission: "can_view",
@ -44,7 +44,7 @@ export const CountersListCmd = typedGuildCommand<CountersPluginType>()({
message.channel.send(
trimMultilineString(`
${counterLines.join("\n\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 { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { confirm, noop, trimMultilineString } from "../../../utils";
import { resetAllCounterValues } from "../functions/resetAllCounterValues";
import { CountersPluginType } from "../types";
export const ResetAllCounterValuesCmd = typedGuildCommand<CountersPluginType>()({
export const ResetAllCounterValuesCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters reset_all"],
permission: "can_reset_all",

View file

@ -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<CountersPluginType>()({
export const ResetCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters reset", "counter reset", "resetcounter"],
permission: "can_edit",

View file

@ -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<CountersPluginType>()({
export const SetCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters set", "counter set", "setcounter"],
permission: "can_edit",

View file

@ -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<CountersPluginType>()({
export const ViewCounterCmd = guildPluginMessageCommand<CountersPluginType>()({
trigger: ["counters view", "counter view", "viewcounter", "counter"],
permission: "can_view",

View file

@ -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<CustomEventsPluginType>()(
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,

View file

@ -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<GuildAccessMonitorP
configSchema: t.type({}),
events: [
typedGlobalEventListener<GuildAccessMonitorPluginType>()({
globalPluginEventListener<GuildAccessMonitorPluginType>()({
event: "guildCreate",
listener({ pluginData, args: { guild } }) {
checkGuild(pluginData, guild);

View file

@ -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<GuildInfoSaverPluginType
configSchema: t.type({}),
events: [
typedGuildEventListener({
guildPluginEventListener({
event: "guildUpdate",
listener({ args }) {
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 { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { ConfigSchema, InternalPosterPluginType } from "./types";

View file

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

View file

@ -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<LogsPluginType>();
export const logsEvt = guildPluginEventListener<LogsPluginType>();
export const LogTypeData = z.object({
[LogType.MEMBER_WARN]: z.object({

View file

@ -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<MessageSaverPluginType>();
export const messageSaverEvt = typedGuildEventListener<MessageSaverPluginType>();
export const messageSaverCmd = guildPluginMessageCommand<MessageSaverPluginType>();
export const messageSaverEvt = guildPluginEventListener<MessageSaverPluginType>();

View file

@ -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<ModActionsPluginType>();
export const modActionsEvt = typedGuildEventListener<ModActionsPluginType>();
export const modActionsCmd = guildPluginMessageCommand<ModActionsPluginType>();
export const modActionsEvt = guildPluginEventListener<ModActionsPluginType>();

View file

@ -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<MutesPluginType>();
export const mutesEvt = typedGuildEventListener<MutesPluginType>();
export const mutesCmd = guildPluginMessageCommand<MutesPluginType>();
export const mutesEvt = guildPluginEventListener<MutesPluginType>();

View file

@ -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<NameHistoryPluginType>();
export const nameHistoryEvt = typedGuildEventListener<NameHistoryPluginType>();
export const nameHistoryCmd = guildPluginMessageCommand<NameHistoryPluginType>();
export const nameHistoryEvt = guildPluginEventListener<NameHistoryPluginType>();

View file

@ -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<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 { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { ConfigSchema, PhishermanPluginType } from "./types";

View file

@ -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<PingableRolesPluginType>();
export const pingableRolesEvt = typedGuildEventListener<PingableRolesPluginType>();
export const pingableRolesCmd = guildPluginMessageCommand<PingableRolesPluginType>();
export const pingableRolesEvt = guildPluginEventListener<PingableRolesPluginType>();

View file

@ -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<PostPluginType>();
export const postCmd = guildPluginMessageCommand<PostPluginType>();

View file

@ -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<ReactionRolesPluginType>();
export const reactionRolesEvt = typedGuildEventListener<ReactionRolesPluginType>();
export const reactionRolesCmd = guildPluginMessageCommand<ReactionRolesPluginType>();
export const reactionRolesEvt = guildPluginEventListener<ReactionRolesPluginType>();

View file

@ -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<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 { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { applyAllRoleButtons } from "../functions/applyAllRoleButtons";
export const resetButtonsCmd = typedGuildCommand<RoleButtonsPluginType>()({
export const resetButtonsCmd = guildPluginMessageCommand<RoleButtonsPluginType>()({
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.",

View file

@ -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<RoleButtonsPluginType>()({
export const onButtonInteraction = guildPluginEventListener<RoleButtonsPluginType>()({
event: "interactionCreate",
async listener({ pluginData, args }) {
if (!args.interaction.isButton()) {

View file

@ -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";

View file

@ -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<RolesPluginType>();
export const rolesCmd = guildPluginMessageCommand<RolesPluginType>();

View file

@ -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<SelfGrantableRolesPluginType>();
export const selfGrantableRolesCmd = guildPluginMessageCommand<SelfGrantableRolesPluginType>();

View file

@ -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<SlowmodePluginType>();
export const slowmodeEvt = typedGuildEventListener<SlowmodePluginType>();
export const slowmodeCmd = guildPluginMessageCommand<SlowmodePluginType>();
export const slowmodeEvt = guildPluginEventListener<SlowmodePluginType>();

View file

@ -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<SpamPluginType>();
export const spamEvt = guildPluginEventListener<SpamPluginType>();

View file

@ -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<StarboardPluginType>();
export const starboardEvt = typedGuildEventListener<StarboardPluginType>();
export const starboardCmd = guildPluginMessageCommand<StarboardPluginType>();
export const starboardEvt = guildPluginEventListener<StarboardPluginType>();

View file

@ -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<TagsPluginType>();
export const tagsEvt = typedGuildEventListener<TagsPluginType>();
export const tagsCmd = guildPluginMessageCommand<TagsPluginType>();
export const tagsEvt = guildPluginEventListener<TagsPluginType>();

View file

@ -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

View file

@ -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<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 { 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 { 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<UtilityPluginType>();
export const utilityEvt = typedGuildEventListener<UtilityPluginType>();
export const utilityCmd = guildPluginMessageCommand<UtilityPluginType>();
export const utilityEvt = guildPluginEventListener<UtilityPluginType>();

View file

@ -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<WelcomeMessagePluginType>();
export const welcomeMessageEvt = guildPluginEventListener<WelcomeMessagePluginType>();

View file

@ -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<TPluginType extends BasePluginType>(): <
export function zeppelinGuildPlugin(...args) {
if (args.length) {
const blueprint = typedGuildPlugin(
...(args as Parameters<typeof typedGuildPlugin>),
const blueprint = guildPlugin(
...(args as Parameters<typeof guildPlugin>),
) as unknown as ZeppelinGuildPluginBlueprint;
blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor);
return blueprint;
@ -84,8 +84,8 @@ export function zeppelinGlobalPlugin<TPluginType extends BasePluginType>(): <
export function zeppelinGlobalPlugin(...args) {
if (args.length) {
const blueprint = typedGlobalPlugin(
...(args as Parameters<typeof typedGlobalPlugin>),
const blueprint = globalPlugin(
...(args as Parameters<typeof globalPlugin>),
) as unknown as ZeppelinGlobalPluginBlueprint;
// @ts-ignore FIXME: Check the types here
blueprint.configPreprocessor = getPluginConfigPreprocessor(blueprint, blueprint.configPreprocessor);