mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Improve empty message detection when rendering tags
This commit is contained in:
parent
3def728ab5
commit
ff98670cf5
3 changed files with 43 additions and 5 deletions
|
@ -6,6 +6,7 @@ import { validate } from "../../../validatorUtils";
|
|||
import { LogType } from "../../../data/LogType";
|
||||
import { TextChannel } from "eris";
|
||||
import { matchAndRenderTagFromString } from "./matchAndRenderTagFromString";
|
||||
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
|
||||
|
||||
export async function onMessageCreate(pluginData: GuildPluginData<TagsPluginType>, msg: SavedMessage) {
|
||||
if (msg.is_bot) return;
|
||||
|
@ -91,11 +92,7 @@ export async function onMessageCreate(pluginData: GuildPluginData<TagsPluginType
|
|||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
tagResult.renderedContent.content &&
|
||||
!tagResult.renderedContent.embed &&
|
||||
tagResult.renderedContent.content.trim() === ""
|
||||
) {
|
||||
if (messageIsEmpty(tagResult.renderedContent)) {
|
||||
pluginData.state.logs.log(LogType.BOT_ALERT, {
|
||||
body: `Tag \`${tagResult.tagName}\` resulted in an empty message, so it couldn't be sent`,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue