-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b0700d
commit 83f3b79
Showing
58 changed files
with
5,288 additions
and
815 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import * as fs from 'fs'; | ||
|
||
declare module WAPI { | ||
// New | ||
const sendImage: ( | ||
to: string, | ||
imgBase64: string, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
declare module WAPI { | ||
const sendSeen: (to: string) => void; | ||
const sendMessage: (to: string, content: string) => string; | ||
} | ||
|
||
/** | ||
* Sends a text message to given chat | ||
* @param to chat id: [email protected] | ||
* @param content text message | ||
*/ | ||
export async function sendText(to: string, content: string) { | ||
return await this.page.evaluate( | ||
({ to, content }) => { | ||
WAPI.sendSeen(to); | ||
return WAPI.sendMessage(to, content); | ||
}, | ||
{ to, content } | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export enum ExposedFn { | ||
OnMessage = 'onMessage', | ||
OnAnyMessage = 'onAnyMessage', | ||
onAck = 'onAck', | ||
onParticipantsChanged = 'onParticipantsChanged', | ||
onStateChanged = 'onStateChanged', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export enum AckType { | ||
ACK_ERROR = -1, | ||
ACK_PENDING = 0, | ||
ACK_SERVER = 1, | ||
ACK_DEVICE = 2, | ||
ACK_READ = 3, | ||
ACK_PLAYED = 4, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum ChatState { | ||
TYPING = 0, | ||
RECORDING = 1, | ||
PAUSED = 2, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum GroupChangeEvent { | ||
Remove = 'remove', | ||
Add = 'add', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Id } from './id'; | ||
import { Id } from '.'; | ||
|
||
export interface GroupMetadata { | ||
id: Id; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export enum GroupNotificationType { | ||
Add = 'add', | ||
Inivite = 'invite', | ||
Remove = 'remove', | ||
Leave = 'leave', | ||
Subject = 'subject', | ||
Description = 'description', | ||
Picture = 'picture', | ||
Announce = 'announce', | ||
Restrict = 'restrict', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
export { Chat } from './chat'; | ||
export { ChatState } from './chat-state'; | ||
export { Contact } from './contact'; | ||
export { GroupChangeEvent } from './group-change-event'; | ||
export { GroupMetadata } from './group-metadata'; | ||
export { GroupNotificationType } from './group-notification-type'; | ||
export { Id } from './id'; | ||
export { Message } from './message'; | ||
export { ParticipantEvent } from './participant-event'; | ||
export { PartialMessage } from './partial-message'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export interface LiveLocation { | ||
id: string; | ||
lat: number; | ||
lng: number; | ||
speed: number; | ||
lastUpdated: number; | ||
accuracy: number; | ||
degrees: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export enum MessageTypes { | ||
TEXT = 'chat', | ||
AUDIO = 'audio', | ||
VOICE = 'ptt', | ||
IMAGE = 'image', | ||
VIDEO = 'video', | ||
DOCUMENT = 'document', | ||
STICKER = 'sticker', | ||
LOCATION = 'location', | ||
CONTACT_CARD = 'vcard', | ||
CONTACT_CARD_MULTI = 'multi_vcard', | ||
REVOKED = 'revoked', | ||
UNKNOWN = 'unknown', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export interface PartialMessage { | ||
id: ID; | ||
body: string; | ||
type: string; | ||
t: number; | ||
notifyName: string; | ||
from: string; | ||
to: string; | ||
self: string; | ||
ack: number; | ||
invis: boolean; | ||
star: boolean; | ||
broadcast: boolean; | ||
mentionedJidList: any[]; | ||
isForwarded: boolean; | ||
labels: any[]; | ||
} | ||
|
||
interface ID { | ||
fromMe: boolean; | ||
remote: string; | ||
id: string; | ||
_serialized: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { GroupChangeEvent, Id } from '.'; | ||
|
||
export interface ParticipantEvent { | ||
by: Id; | ||
action: GroupChangeEvent; | ||
who: [Id]; | ||
} |
Oops, something went wrong.