From bf4920f4b0471ddf482bca3588b681b3cfd53c04 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 3 Oct 2020 16:15:02 +0300 Subject: [PATCH] Update log storage plugin example for beta.3 --- docs/plugins.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/plugins.md b/docs/plugins.md index c037e9e..53929e9 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -36,18 +36,18 @@ To use this custom attachment storage type, you would set the `attachmentStorage ### Example of a custom log storage type This example adds a custom type for the `logStorage` option called `"pastebin"` that uploads logs to Pastebin. -The code that handles API calls to Pastebin is left out, as it's not relevant to the example. + ```js module.exports = function({ logs, formatters }) { logs.addStorageType('pastebin', { async save(thread, threadMessages) { const formatLogResult = await formatters.formatLog(thread, threadMessages); - // formatLogResult.content contains the log text - // Some code here that uploads the full text to Pastebin, and stores the Pastebin link in the database + const pastebinUrl = await saveToPastebin(formatLogResult); // saveToPastebin is an example function that returns the pastebin URL for the saved log + return { url: pastebinUrl }; }, - getUrl(threadId) { - // Find the previously-saved Pastebin link from the database based on the thread id, and return it + getUrl(thread) { + return thread.log_storage_data.url; } }); };