From 46bb3dc8c532d5bb816e47f5ca6dc11de55b6008 Mon Sep 17 00:00:00 2001 From: Edgard Date: Sun, 26 Jun 2022 22:27:26 -0300 Subject: [PATCH] feat: Added WPP.status.sendVideoStatus function --- src/status/functions/index.ts | 1 + src/status/functions/sendVideoStatus.ts | 45 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/status/functions/sendVideoStatus.ts diff --git a/src/status/functions/index.ts b/src/status/functions/index.ts index 34d8ebd6a6..4e60a43afe 100644 --- a/src/status/functions/index.ts +++ b/src/status/functions/index.ts @@ -19,3 +19,4 @@ export { getMyStatus } from './getMyStatus'; export { ImageStatusOptions, sendImageStatus } from './sendImageStatus'; export { sendRawStatus, SendStatusOptions } from './sendRawStatus'; export { sendTextStatus, TextStatusOptions } from './sendTextStatus'; +export { sendVideoStatus, VideoStatusOptions } from './sendVideoStatus'; diff --git a/src/status/functions/sendVideoStatus.ts b/src/status/functions/sendVideoStatus.ts new file mode 100644 index 0000000000..52e95d00b0 --- /dev/null +++ b/src/status/functions/sendVideoStatus.ts @@ -0,0 +1,45 @@ +/*! + * Copyright 2021 WPPConnect Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { sendFileMessage } from '../../chat'; +import { defaultSendStatusOptions } from '..'; +import { SendStatusOptions } from './sendRawStatus'; + +export type VideoStatusOptions = SendStatusOptions; + +/** + * Send a video message to status stories + * + * @example + * ```javascript + * WPP.status.sendVideoStatus('data:video/mp4;base64,'); + * ``` + */ +export async function sendVideoStatus( + content: any, + options: VideoStatusOptions = {} +): Promise { + options = { + ...defaultSendStatusOptions, + ...options, + }; + + return sendFileMessage('status@broadcast', content, { + ...options, + createChat: true, + type: 'video', + }); +}