mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 04:29:15 +00:00
Basic Chat and Message model implementation
This commit is contained in:
@@ -21,4 +21,20 @@ exports.Events = {
|
||||
READY: 'ready',
|
||||
MESSAGE_CREATE: 'message',
|
||||
QR_RECEIVED: 'qr'
|
||||
}
|
||||
|
||||
exports.MessageTypes = {
|
||||
TEXT: 'chat',
|
||||
AUDIO: 'audio',
|
||||
VOICE: 'ptt',
|
||||
IMAGE: 'image',
|
||||
VIDEO: 'video',
|
||||
DOCUMENT: 'document',
|
||||
STICKER: 'sticker'
|
||||
}
|
||||
|
||||
exports.ChatTypes = {
|
||||
SOLO: 'solo',
|
||||
GROUP: 'group',
|
||||
UNKNOWN: 'unknown'
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* Exposes the internal Store to the WhatsApp Web client
|
||||
*/
|
||||
exports.ExposeStore = () => {
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
function getAllModules() {
|
||||
return new Promise((resolve) => {
|
||||
const id = _.uniqueId("fakeModule_");
|
||||
@@ -38,17 +38,25 @@ exports.ExposeStore = () => {
|
||||
return webpackJsonp([], null, [id]);
|
||||
}
|
||||
|
||||
var store_id = 0;
|
||||
let store_id = 0;
|
||||
|
||||
function init() {
|
||||
window.Store = _requireById(store_id).default;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
init();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds extra props to the serialization of a model
|
||||
*/
|
||||
exports.LoadExtraProps = (model, props) => {
|
||||
console.log(model, props);
|
||||
Store[model].models[0].__props = Store[model].models[0].__props.concat(props);
|
||||
}
|
||||
|
||||
exports.MarkAllRead = () => {
|
||||
let Chats = Store.Chat.models;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user