3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-25 10:25:01 +00:00

fix(CustomEvents): message command types

This commit is contained in:
Dragory 2023-04-01 14:01:30 +03:00
parent 07d33a2dc5
commit caff6280e0
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -1,5 +1,6 @@
import { GuildChannel, GuildMember, User } from "discord.js";
import { guildPluginMessageCommand, parseSignature } from "knub";
import { TSignature } from "knub-command-manager";
import { commandTypes } from "../../commandTypes";
import { makeIoTsConfigParser } from "../../pluginUtils";
import { createTypedTemplateSafeValueContainer, TemplateSafeValueContainer } from "../../templateFormatter";
@ -32,8 +33,10 @@ export const CustomEventsPlugin = zeppelinGuildPlugin<CustomEventsPluginType>()(
const config = pluginData.config.get();
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 = guildPluginMessageCommand({
const signature: TSignature<any> = event.trigger.params
? parseSignature(event.trigger.params, commandTypes)
: {};
const eventCommand = guildPluginMessageCommand<CustomEventsPluginType>()({
trigger: event.trigger.name,
permission: `events.${key}.trigger.can_use`,
signature,
@ -59,8 +62,7 @@ export const CustomEventsPlugin = zeppelinGuildPlugin<CustomEventsPluginType>()(
runEvent(pluginData, event, { msg: message, args }, values);
},
});
// FIXME: Typings
// pluginData.messageCommands.add(eventCommand);
pluginData.messageCommands.add(eventCommand);
}
}
},