Cleanup + add remaining utils

This commit is contained in:
Adhiraj Singh
2021-07-12 23:50:08 +05:30
parent 89cf8004e9
commit 71e34fc5f8
15 changed files with 234 additions and 74 deletions

View File

@@ -54,4 +54,5 @@ export type ChatModification =
messages: { id: string, fromMe?: boolean }[],
star: boolean
}
}
} |
{ delete: true }

View File

@@ -78,7 +78,6 @@ export type AnyMediaMessageContent = (
{ mimetype?: string }
export type AnyRegularMessageContent =
string |
({
text: string
}
@@ -109,14 +108,15 @@ export type MiscMessageGenerationOptions = {
timestamp?: Date
/** the message you want to quote */
quoted?: WAMessage
}
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
userJid: string
/** disappearing messages settings */
ephemeralOptions?: {
expiration: number | string
eph_setting_ts: number | string
}
}
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
userJid: string
}
export type MediaGenerationOptions = {
logger?: Logger
agent?: Agent
@@ -132,4 +132,20 @@ export type MessageUpdateType = 'prepend' | 'append' | 'notify' | 'last'
export interface MessageInfo {
reads: {jid: string, t: string}[]
deliveries: {jid: string, t: string}[]
}
}
export interface MessageStatusUpdate {
from: string
to: string
/** Which participant caused the update (only for groups) */
participant?: string
timestamp: Date
/** Message IDs read/delivered */
ids: string[]
/** Status of the Message IDs */
type: WAMessageStatus
}
export type WAMessageCursor = { before: WAMessageKey | undefined } | { after: WAMessageKey | undefined }

View File

@@ -195,5 +195,7 @@ export type BaileysEventMap = {
}
export interface BaileysEventEmitter extends EventEmitter {
on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): this
off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): this
removeAllListeners<T extends keyof BaileysEventMap>(event: T): this
emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean
}