mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
If !tag eval fails, let the user know the error
This commit is contained in:
parent
f93291e604
commit
f71c0c076a
1 changed files with 14 additions and 2 deletions
|
@ -1,6 +1,9 @@
|
||||||
import { tagsCmd } from "../types";
|
import { tagsCmd } from "../types";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
import { renderTag } from "../util/renderTag";
|
import { renderTag } from "../util/renderTag";
|
||||||
|
import { MessageContent } from "eris";
|
||||||
|
import { TemplateParseError } from "../../../templateFormatter";
|
||||||
|
import { sendErrorMessage } from "../../../pluginUtils";
|
||||||
|
|
||||||
export const TagEvalCmd = tagsCmd({
|
export const TagEvalCmd = tagsCmd({
|
||||||
trigger: "tag eval",
|
trigger: "tag eval",
|
||||||
|
@ -11,7 +14,16 @@ export const TagEvalCmd = tagsCmd({
|
||||||
},
|
},
|
||||||
|
|
||||||
async run({ message: msg, args, pluginData }) {
|
async run({ message: msg, args, pluginData }) {
|
||||||
const rendered = await renderTag(pluginData, args.body);
|
try {
|
||||||
msg.channel.createMessage(rendered);
|
const rendered = await renderTag(pluginData, args.body);
|
||||||
|
msg.channel.createMessage(rendered);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof TemplateParseError) {
|
||||||
|
sendErrorMessage(pluginData, msg.channel, `Failed to render tag: ${e.message}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue