3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

tags: fix error on empty tag result

This commit is contained in:
Dragory 2020-09-15 23:31:41 +03:00
parent 6923d12aa7
commit 3f3d6af4ed
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 8 additions and 4 deletions

View file

@ -2,12 +2,12 @@ import { ExtendedMatchParams } from "knub/dist/config/PluginConfigManager";
import { PluginData } from "knub"; import { PluginData } from "knub";
import { TagsPluginType, TTagCategory } from "../types"; import { TagsPluginType, TTagCategory } from "../types";
import { renderTagFromString } from "./renderTagFromString"; import { renderTagFromString } from "./renderTagFromString";
import { convertDelayStringToMS } from "../../../utils"; import { convertDelayStringToMS, StrictMessageContent } from "../../../utils";
import escapeStringRegexp from "escape-string-regexp"; import escapeStringRegexp from "escape-string-regexp";
import { Member, MessageContent } from "eris"; import { Member } from "eris";
interface Result { interface Result {
renderedContent: MessageContent; renderedContent: StrictMessageContent;
tagName: string; tagName: string;
categoryName: string | null; categoryName: string | null;
category: TTagCategory | null; category: TTagCategory | null;

View file

@ -89,7 +89,11 @@ export async function onMessageCreate(pluginData: PluginData<TagsPluginType>, ms
return; return;
} }
if (typeof tagResult.renderedContent === "string" && tagResult.renderedContent.trim() === "") { if (
tagResult.renderedContent.content &&
!tagResult.renderedContent.embed &&
tagResult.renderedContent.content.trim() === ""
) {
pluginData.state.logs.log(LogType.BOT_ALERT, { pluginData.state.logs.log(LogType.BOT_ALERT, {
body: `Tag \`${tagResult.tagName}\` resulted in an empty message, so it couldn't be sent`, body: `Tag \`${tagResult.tagName}\` resulted in an empty message, so it couldn't be sent`,
}); });