diff --git a/example.js b/example.js index 529a8c4..4885398 100644 --- a/example.js +++ b/example.js @@ -210,6 +210,18 @@ client.on('message', async msg => { msg.reply('I can only edit my own messages'); } } + } else if (msg.body === '!updatelabels') { + const chat = await msg.getChat(); + await chat.changeLabels([0, 1]); + } else if (msg.body === '!addlabels') { + const chat = await msg.getChat(); + let labels = (await chat.getLabels()).map(l => l.id); + labels.push('0'); + labels.push('1'); + await chat.changeLabels(labels); + } else if (msg.body === '!removelabels') { + const chat = await msg.getChat(); + await chat.changeLabels([]); } }); diff --git a/index.d.ts b/index.d.ts index a9864d4..7e2b86c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -71,6 +71,9 @@ declare namespace WAWebJS { /** Get all current Labels */ getLabels(): Promise + + /** Change labels in chats */ + addOrRemoveLabels(labelIds: Array, chatIds: Array): Promise /** Get Label instance by ID */ getLabelById(labelId: string): Promise