From 55b83bea7cad893aabda4ab5e05c248fb66e1e51 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 22 Feb 2022 13:50:33 +0100 Subject: [feature] Add postDataCallbackFunc to allow cleanup (#408) --- internal/media/types.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/media/types.go') diff --git a/internal/media/types.go b/internal/media/types.go index a6b38b467..cceff216c 100644 --- a/internal/media/types.go +++ b/internal/media/types.go @@ -119,3 +119,9 @@ type AdditionalEmojiInfo struct { // DataFunc represents a function used to retrieve the raw bytes of a piece of media. type DataFunc func(ctx context.Context) (reader io.Reader, fileSize int, err error) + +// PostDataCallbackFunc represents a function executed after the DataFunc has been executed, +// and the returned reader has been read. It can be used to clean up any remaining resources. +// +// This can be set to nil, and will then not be executed. +type PostDataCallbackFunc func(ctx context.Context) error -- cgit v1.2.3