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:
parent
6923d12aa7
commit
3f3d6af4ed
2 changed files with 8 additions and 4 deletions
|
@ -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;
|
||||||
|
|
|
@ -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`,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue