mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 04:29:15 +00:00
Add group chat functions, slight refactoring
This commit is contained in:
16
src/factories/ChatFactory.js
Normal file
16
src/factories/ChatFactory.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const PrivateChat = require('../structures/PrivateChat');
|
||||
const GroupChat = require('../structures/GroupChat');
|
||||
|
||||
class ChatFactory {
|
||||
static create(client, data) {
|
||||
if(data.isGroup) {
|
||||
return new GroupChat(client, data);
|
||||
}
|
||||
|
||||
return new PrivateChat(client, data);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ChatFactory;
|
||||
Reference in New Issue
Block a user