3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

logs: add support for embeds in log formats

This commit is contained in:
Dragory 2020-07-30 02:21:31 +03:00
parent b6b4154b2d
commit 8b22ce267d
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 75 additions and 54 deletions

View file

@ -59,7 +59,14 @@ export async function log(pluginData: PluginData<LogsPluginType>, type: LogType,
const message = await getLogMessage(pluginData, type, data);
if (message) {
const batched = opts.batched ?? true; // Default to batched unless explicitly disabled
// For non-string log messages (i.e. embeds) batching or chunking is not possible, so send them immediately
if (typeof message !== "string") {
await channel.createMessage(message).catch(noop);
return;
}
// Default to batched unless explicitly disabled
const batched = opts.batched ?? true;
const batchTime = opts.batch_time ?? 1000;
if (batched) {