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

tags: send bot alert if a tag renders empty and cannot be sent

This commit is contained in:
Dragory 2020-07-30 01:45:49 +03:00
parent 0a4b4147c6
commit 5882bbda4e
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -138,6 +138,13 @@ export async function onMessageCreate(pluginData: PluginData<TagsPluginType>, ms
return;
}
if (typeof renderedTag === "string" && renderedTag.trim() === "") {
pluginData.state.logs.log(LogType.BOT_ALERT, {
body: `Tag \`${matchedTagName}\` resulted in an empty message, so it couldn't be sent`,
});
return;
}
const responseMsg = await channel.createMessage(renderedTag);
// Save the command-response message pair once the message is in our database