Skip to content

Commit 304e802

Browse files
committed
✨ feat: sendPoll #2948
1 parent 0bc5fe0 commit 304e802

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/api/Client.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ declare module WAPI {
130130
const setGroupEditToAdminsOnly: (groupId: string, onlyAdmins: boolean) => Promise<boolean>;
131131
const setGroupDescription: (groupId: string, description: string) => Promise<boolean>;
132132
const setGroupTitle: (groupId: string, title: string) => Promise<boolean>;
133+
const sendPoll: (groupId: string, name: string, options: string[]) => Promise<string>;
133134
const sendImageAsSticker: (webpBase64: string, to: string, metadata?: any) => Promise<string | boolean>;
134135
const sendStickerAsReply: (webpBase64: string, to: string, messageId: string, metadata?: any) => Promise<string | boolean>;
135136
const createGroup: (groupName: string, contactId: string|string[]) => Promise<any>;
@@ -1930,7 +1931,24 @@ public async testCallback(callbackToTest: SimpleListener, testData: any) : Prom
19301931
}
19311932

19321933

1933-
1934+
/**
1935+
* Send a poll to a group chat
1936+
* @param to chat id - a group chat is required
1937+
* @param name the name of the poll
1938+
* @param options an array of poll options
1939+
*/
1940+
public async sendPoll(
1941+
to: GroupChatId,
1942+
name: string,
1943+
options: string[]
1944+
) : Promise<MessageId> {
1945+
return await this.pup(
1946+
({ to, name, options }) => {
1947+
return WAPI.sendPoll(to, name, options );
1948+
},
1949+
{ to, name, options }
1950+
)
1951+
}
19341952

19351953
/**
19361954
* Sends a video to given chat as a gif, with caption or not, using base64

0 commit comments

Comments
 (0)