mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 03:39:29 +00:00
first commit on wsl
This commit is contained in:
@@ -12,6 +12,7 @@ const wbotMessageListener = () => {
|
||||
const wbot = getWbot();
|
||||
|
||||
wbot.on("message", async msg => {
|
||||
console.log(msg);
|
||||
let newMessage;
|
||||
// console.log(msg);
|
||||
if (msg.from === "status@broadcast") {
|
||||
@@ -19,14 +20,14 @@ const wbotMessageListener = () => {
|
||||
}
|
||||
try {
|
||||
const msgContact = await msg.getContact();
|
||||
const imageUrl = await msgContact.getProfilePicUrl();
|
||||
const profilePicUrl = await msgContact.getProfilePicUrl();
|
||||
try {
|
||||
let contact = await Contact.findOne({
|
||||
where: { number: msgContact.number },
|
||||
});
|
||||
|
||||
if (contact) {
|
||||
await contact.update({ profilePicUrl: imageUrl });
|
||||
await contact.update({ profilePicUrl: profilePicUrl });
|
||||
}
|
||||
|
||||
if (!contact) {
|
||||
@@ -34,12 +35,18 @@ const wbotMessageListener = () => {
|
||||
contact = await Contact.create({
|
||||
name: msgContact.pushname || msgContact.number.toString(),
|
||||
number: msgContact.number,
|
||||
profilePicUrl: imageUrl,
|
||||
profilePicUrl: profilePicUrl,
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (msg.hasQuotedMsg) {
|
||||
const quotedMessage = await msg.getQuotedMessage();
|
||||
console.log("quoted", quotedMessage);
|
||||
}
|
||||
|
||||
if (msg.hasMedia) {
|
||||
const media = await msg.downloadMedia();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ module.exports = (req, res, next) => {
|
||||
try {
|
||||
const [, token] = req.get("Authorization").split(" ");
|
||||
decodedToken = jwt.verify(token, "mysecret");
|
||||
// todo >> find user in DB and store in req.user to use latter, or throw an error if user not exists anymore
|
||||
req.userId = decodedToken.userId;
|
||||
} catch (err) {
|
||||
err.statusCode = 401;
|
||||
|
||||
2513
backend/yarn.lock
Normal file
2513
backend/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
ReferrerUrl=https://notificationsounds.com/message-tones/juntos-607
|
||||
HostUrl=https://notificationsounds.com/message-tones/juntos-607/download/mp3
|
||||
@@ -1,4 +0,0 @@
|
||||
[ZoneTransfer]
|
||||
ZoneId=3
|
||||
ReferrerUrl=https://notificationsounds.com/message-tones/juntos-607
|
||||
HostUrl=https://notificationsounds.com/message-tones/juntos-607/download/ogg
|
||||
11504
frontend/yarn.lock
Normal file
11504
frontend/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user