mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-17 11:25:03 +00:00
Merge branch '240811_application_commands_merge_2' into next
This commit is contained in:
commit
43b8017985
279 changed files with 6192 additions and 3044 deletions
|
@ -11,6 +11,7 @@ import {
|
|||
messageToTemplateSafeMessage,
|
||||
userToTemplateSafeUser,
|
||||
} from "../../utils/templateSafeObjects.js";
|
||||
import { CommonPlugin } from "../Common/CommonPlugin.js";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin.js";
|
||||
import { runEvent } from "./functions/runEvent.js";
|
||||
import { CustomEventsPluginType, zCustomEventsConfig } from "./types.js";
|
||||
|
@ -28,6 +29,10 @@ export const CustomEventsPlugin = guildPlugin<CustomEventsPluginType>()({
|
|||
configParser: (input) => zCustomEventsConfig.parse(input),
|
||||
defaultOptions,
|
||||
|
||||
beforeStart(pluginData) {
|
||||
pluginData.state.common = pluginData.getPlugin(CommonPlugin);
|
||||
},
|
||||
|
||||
afterLoad(pluginData) {
|
||||
const config = pluginData.config.get();
|
||||
for (const [key, event] of Object.entries(config.events)) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Message } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { sendErrorMessage } from "../../../pluginUtils.js";
|
||||
import { TemplateSafeValueContainer } from "../../../templateFormatter.js";
|
||||
import { ActionError } from "../ActionError.js";
|
||||
import { addRoleAction } from "../actions/addRoleAction.js";
|
||||
|
@ -39,7 +38,7 @@ export async function runEvent(
|
|||
} catch (e) {
|
||||
if (e instanceof ActionError) {
|
||||
if (event.trigger.type === "command") {
|
||||
sendErrorMessage(pluginData, (eventData.msg as Message).channel, e.message);
|
||||
void pluginData.state.common.sendErrorMessage((eventData.msg as Message).channel, e.message);
|
||||
} else {
|
||||
// TODO: Where to log action errors from other kinds of triggers?
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { BasePluginType } from "knub";
|
||||
import { BasePluginType, pluginUtils } from "knub";
|
||||
import z from "zod";
|
||||
import { zBoundedCharacters, zBoundedRecord } from "../../utils.js";
|
||||
import { CommonPlugin } from "../Common/CommonPlugin.js";
|
||||
import { zAddRoleAction } from "./actions/addRoleAction.js";
|
||||
import { zCreateCaseAction } from "./actions/createCaseAction.js";
|
||||
import { zMakeRoleMentionableAction } from "./actions/makeRoleMentionableAction.js";
|
||||
|
@ -43,5 +44,6 @@ export interface CustomEventsPluginType extends BasePluginType {
|
|||
config: z.infer<typeof zCustomEventsConfig>;
|
||||
state: {
|
||||
clearTriggers: () => void;
|
||||
common: pluginUtils.PluginPublicInterface<typeof CommonPlugin>;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue