diff --git a/src/status/functions/index.ts b/src/status/functions/index.ts index 794cefd62f..34d8ebd6a6 100644 --- a/src/status/functions/index.ts +++ b/src/status/functions/index.ts @@ -16,5 +16,6 @@ export { get } from './get'; export { getMyStatus } from './getMyStatus'; +export { ImageStatusOptions, sendImageStatus } from './sendImageStatus'; export { sendRawStatus, SendStatusOptions } from './sendRawStatus'; export { sendTextStatus, TextStatusOptions } from './sendTextStatus'; diff --git a/src/status/functions/sendImageStatus.ts b/src/status/functions/sendImageStatus.ts new file mode 100644 index 0000000000..e67324bc01 --- /dev/null +++ b/src/status/functions/sendImageStatus.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 ImageStatusOptions = SendStatusOptions; + +/** + * Send a image message to status stories + * + * @example + * ```javascript + * WPP.status.sendImageStatus('data:image/jpeg;base64,'); + * ``` + */ +export async function sendImageStatus( + content: any, + options: ImageStatusOptions = {} +): Promise { + options = { + ...defaultSendStatusOptions, + ...options, + }; + + return sendFileMessage('status@broadcast', content, { + ...options, + createChat: true, + type: 'image', + }); +} diff --git a/src/whatsapp/models/StatusV3Model.ts b/src/whatsapp/models/StatusV3Model.ts index 83837c5199..523371fd2a 100644 --- a/src/whatsapp/models/StatusV3Model.ts +++ b/src/whatsapp/models/StatusV3Model.ts @@ -17,13 +17,8 @@ import { StatusV3Collection } from '../collections'; import { exportProxyModel } from '../exportModule'; import { Wid } from '../misc'; -import { - Model, - ModelOptions, - ModelPropertiesContructor, - ModelProxy, -} from './Model'; -import { PropsChatBase, SessionChatBase } from './ModelChatBase'; +import { ModelOptions, ModelPropertiesContructor, ModelProxy } from './Model'; +import { ModelChatBase, PropsChatBase, SessionChatBase } from './ModelChatBase'; interface Props extends PropsChatBase { t?: any; @@ -55,7 +50,7 @@ export declare interface StatusV3Model /** @whatsapp 47896 * @whatsapp 547896 >= 2.2222.8 */ -export declare class StatusV3Model extends Model { +export declare class StatusV3Model extends ModelChatBase { idClass: typeof Wid; constructor( proterties?: ModelPropertiesContructor,