diff --git a/src/profile/functions/index.ts b/src/profile/functions/index.ts index 336e642fd6..1ba44e28d6 100644 --- a/src/profile/functions/index.ts +++ b/src/profile/functions/index.ts @@ -17,6 +17,7 @@ export { editBusinessProfile } from './editBusinessProfile'; export { getMyStatus } from './getMyStatus'; export { isBusiness } from './isBusiness'; +export { removeMyProfilePicture } from './removeMyProfilePicture'; export { setMyProfileName } from './setMyProfileName'; export { setMyProfilePicture } from './setMyProfilePicture'; export { setMyStatus } from './setMyStatus'; diff --git a/src/profile/functions/removeMyProfilePicture.ts b/src/profile/functions/removeMyProfilePicture.ts new file mode 100644 index 0000000000..5040a5936c --- /dev/null +++ b/src/profile/functions/removeMyProfilePicture.ts @@ -0,0 +1,35 @@ +/*! + * Copyright 2023 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 { functions, UserPrefs } from '../../whatsapp'; + +/** + * Remove your profile picture + * + * @example + * ```javascript + * await WPP.profile.removeMyProfilePicture(); + * ``` + * + * @category Profile + */ + +export async function removeMyProfilePicture(): Promise { + const me = UserPrefs.getMaybeMeUser(); + const result = await functions.requestDeletePicture(me); + + return result.status === 200; +} diff --git a/src/whatsapp/functions/profilePic.ts b/src/whatsapp/functions/profilePic.ts index 2d5bba1cf1..0f30c3eb5a 100644 --- a/src/whatsapp/functions/profilePic.ts +++ b/src/whatsapp/functions/profilePic.ts @@ -39,7 +39,9 @@ export declare function sendSetPicture( * @whatsapp 78426 * @whatsapp 5018 >= 2.2204.13 */ -export declare function requestDeletePicture(chat: Wid): Promise; +export declare function requestDeletePicture( + chat: Wid +): Promise<{ status: number }>; exportModule( exports,