File size: 3,608 Bytes
b62a170 fc7a493 b62a170 fc7a493 b62a170 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
import { ApiProperty } from '@nestjs/swagger';
import { WAMessageAck } from './enums.dto';
import { ChatIdProperty, MessageIdProperty } from './properties.dto';
export class WALocation {
description?: string;
latitude: string;
longitude: string;
}
export class WAMedia {
@ApiProperty({
description: 'The URL for the media in the message if any',
example:
'http://localhost:7860/api/files/false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA.oga',
})
url: string;
@ApiProperty({
description: 'mimetype for the media in the message if any',
example: 'audio/jpeg',
})
mimetype?: string;
@ApiProperty({
description: 'The original filename in mediaUrl in the message if any',
example: 'example.pdf',
})
filename?: string;
}
class WAMessageBase {
@MessageIdProperty()
id: string;
/** */
@ApiProperty({
description: 'Unix timestamp for when the message was created',
example: 1666943582,
})
timestamp: number;
@ChatIdProperty({
description:
'ID for the Chat that this message was sent to, except if the message was sent by the current user ',
})
from: string;
@ApiProperty({
description: 'Indicates if the message was sent by the current user',
})
fromMe: boolean;
@ChatIdProperty({
description: `
* ID for who this message is for.
* If the message is sent by the current user, it will be the Chat to which the message is being sent.
* If the message is sent by another user, it will be the ID for the current user.
`,
})
to: string;
@ApiProperty({
description: 'For groups - participant who sent the message',
})
participant: string;
}
export class WAMessage extends WAMessageBase {
@ApiProperty({
description: 'Message content',
})
body: string;
@ApiProperty({
description: 'Indicates if the message has media available for download',
})
hasMedia: boolean;
media?: WAMedia = null;
@ApiProperty({
description:
'Use `media.url` instead! The URL for the media in the message if any',
deprecated: true,
example:
'http://localhost:7860/api/files/false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA.oga',
})
mediaUrl: string;
@ApiProperty({
description: 'ACK status for the message',
})
ack: WAMessageAck;
@ApiProperty({
description: 'ACK status name for the message',
})
ackName: string;
@ApiProperty({
description:
'If the message was sent to a group, this field will contain the user that sent the message.',
})
author?: string;
@ApiProperty({
description:
'Location information contained in the message, if the message is type "location"',
})
location?: WALocation;
@ApiProperty({
description: 'List of vCards contained in the message.',
})
vCards?: string[];
/** Returns message in a raw format */
@ApiProperty({
description:
'Message in a raw format that we get from WhatsApp. May be changed anytime, use it with caution! It depends a lot on the underlying backend.',
})
_data?: any;
}
export class WAReaction {
@ApiProperty({
description:
'Reaction to the message. Either the reaction (emoji) or empty string to remove the reaction',
})
text: string;
@ApiProperty({
description: 'Message ID for the message to react to',
example: 'false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA',
})
messageId: string;
}
export class WAMessageReaction extends WAMessageBase {
@ApiProperty({
description:
'Reaction to the message. Either the reaction (emoji) or empty string to remove the reaction',
})
reaction: WAReaction;
}
|