Skip to content

Commit

Permalink
fix: Fixed group creation when you have your own number in the list
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Jun 17, 2022
1 parent a7e83af commit 4b76f5a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/group/functions/create.ts
Expand Up @@ -18,7 +18,7 @@ import { assertWid } from '../../assert';
import * as Chat from '../../chat';
import * as Contact from '../../contact';
import { WPPError } from '../../util';
import { ContactStore, Wid } from '../../whatsapp';
import { ContactStore, UserPrefs, Wid } from '../../whatsapp';
import * as wa_functions from '../../whatsapp/functions';

export async function create(
Expand All @@ -31,9 +31,14 @@ export async function create(

const participantsWids = participantsIds.map(assertWid);

const meWid = UserPrefs.getMaybeMeUser();
const wids: Wid[] = [];

for (const wid of participantsWids) {
if (meWid.equals(wid)) {
continue;
}

const contact = ContactStore.get(wid);
if (contact) {
wids.push(contact.id);
Expand All @@ -48,6 +53,10 @@ export async function create(
});
}

if (meWid.equals(info.wid)) {
continue;
}

wids.push(info.wid);
}

Expand Down

0 comments on commit 4b76f5a

Please sign in to comment.