Skip to content

Commit

Permalink
feat: Added WPP.profile.removeMyProfilePicture function (#923)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Mar 4, 2023
1 parent 1f26500 commit 307e567
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/profile/functions/index.ts
Expand Up @@ -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';
35 changes: 35 additions & 0 deletions 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<boolean> {
const me = UserPrefs.getMaybeMeUser();
const result = await functions.requestDeletePicture(me);

return result.status === 200;
}
4 changes: 3 additions & 1 deletion src/whatsapp/functions/profilePic.ts
Expand Up @@ -39,7 +39,9 @@ export declare function sendSetPicture(
* @whatsapp 78426
* @whatsapp 5018 >= 2.2204.13
*/
export declare function requestDeletePicture(chat: Wid): Promise<any>;
export declare function requestDeletePicture(
chat: Wid
): Promise<{ status: number }>;

exportModule(
exports,
Expand Down

0 comments on commit 307e567

Please sign in to comment.