Skip to content

Commit

Permalink
feat: Added WPP.status.sendVideoStatus function
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Jun 27, 2022
1 parent 2814ef3 commit 46bb3dc
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/status/functions/index.ts
Expand Up @@ -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';
45 changes: 45 additions & 0 deletions 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,<a long base64 file...>');
* ```
*/
export async function sendVideoStatus(
content: any,
options: VideoStatusOptions = {}
): Promise<any> {
options = {
...defaultSendStatusOptions,
...options,
};

return sendFileMessage('status@broadcast', content, {
...options,
createChat: true,
type: 'video',
});
}

0 comments on commit 46bb3dc

Please sign in to comment.