mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-25 18:25:03 +00:00
fix(CustomEvents): message command types
This commit is contained in:
parent
07d33a2dc5
commit
caff6280e0
1 changed files with 6 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { GuildChannel, GuildMember, User } from "discord.js";
|
import { GuildChannel, GuildMember, User } from "discord.js";
|
||||||
import { guildPluginMessageCommand, parseSignature } from "knub";
|
import { guildPluginMessageCommand, parseSignature } from "knub";
|
||||||
|
import { TSignature } from "knub-command-manager";
|
||||||
import { commandTypes } from "../../commandTypes";
|
import { commandTypes } from "../../commandTypes";
|
||||||
import { makeIoTsConfigParser } from "../../pluginUtils";
|
import { makeIoTsConfigParser } from "../../pluginUtils";
|
||||||
import { createTypedTemplateSafeValueContainer, TemplateSafeValueContainer } from "../../templateFormatter";
|
import { createTypedTemplateSafeValueContainer, TemplateSafeValueContainer } from "../../templateFormatter";
|
||||||
|
@ -32,8 +33,10 @@ export const CustomEventsPlugin = zeppelinGuildPlugin<CustomEventsPluginType>()(
|
||||||
const config = pluginData.config.get();
|
const config = pluginData.config.get();
|
||||||
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: TSignature<any> = event.trigger.params
|
||||||
const eventCommand = guildPluginMessageCommand({
|
? parseSignature(event.trigger.params, commandTypes)
|
||||||
|
: {};
|
||||||
|
const eventCommand = guildPluginMessageCommand<CustomEventsPluginType>()({
|
||||||
trigger: event.trigger.name,
|
trigger: event.trigger.name,
|
||||||
permission: `events.${key}.trigger.can_use`,
|
permission: `events.${key}.trigger.can_use`,
|
||||||
signature,
|
signature,
|
||||||
|
@ -59,8 +62,7 @@ export const CustomEventsPlugin = zeppelinGuildPlugin<CustomEventsPluginType>()(
|
||||||
runEvent(pluginData, event, { msg: message, args }, values);
|
runEvent(pluginData, event, { msg: message, args }, values);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// FIXME: Typings
|
pluginData.messageCommands.add(eventCommand);
|
||||||
// pluginData.messageCommands.add(eventCommand);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue