diff --git a/src/plugins/Tags.ts b/src/plugins/Tags.ts index 71dc9511..b141ef15 100644 --- a/src/plugins/Tags.ts +++ b/src/plugins/Tags.ts @@ -1,4 +1,4 @@ -import { decorators as d, IPluginOptions } from "knub"; +import { decorators as d, IPluginOptions, logger } from "knub"; import { Message, TextChannel } from "eris"; import { errorMessage, successMessage } from "../utils"; import { GuildTags } from "../data/GuildTags"; @@ -195,10 +195,19 @@ export class TagsPlugin extends ZeppelinPlugin v.value); // Format the string - body = await renderTemplate(body, { - args: tagArgs, - ...this.tagFunctions, - }); + try { + body = await renderTemplate(body, { + args: tagArgs, + ...this.tagFunctions, + }); + } catch (e) { + if (e instanceof TemplateParseError) { + logger.warn(`Invalid tag format!\nError: ${e.message}\nFormat: ${tag.body}`); + return; + } else { + throw e; + } + } const channel = this.guild.channels.get(msg.channel_id) as TextChannel; const responseMsg = await channel.createMessage(body);