Skip to content

Commit

Permalink
Update handler.js
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoSobrino authored Apr 13, 2024
1 parent fb03f88 commit 581b503
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ export async function handler(chatUpdate) {
global.db.data.chats[m.chat] = {};
}
if (chat) {
//if (!('language' in chat)) chat.language = 'es';
if (!('language' in chat)) chat.language = 'es';
if (!('isBanned' in chat)) chat.isBanned = false;
if (!('welcome' in chat)) chat.welcome = true;
if (!('detect' in chat)) chat.detect = true;
Expand Down Expand Up @@ -1020,7 +1020,7 @@ export async function handler(chatUpdate) {
console.error(e);
}

const idioma = global.db.data.users[m.sender].language
const idioma = global.db.data.users[m.sender]?.language || 'es';
const _translate = JSON.parse(fs.readFileSync(`./language/${idioma}.json`))
const tradutor = _translate.handler.handler

Expand Down Expand Up @@ -1424,7 +1424,7 @@ export async function participantsUpdate({ id, participants, action }) {
* Opção de tradução de idioma
*
***********************/
const idioma = global.db.data.chats[id].language || 'es';
const idioma = global.db.data.chats[id]?.language || 'es';
const _translate = JSON.parse(fs.readFileSync(`./language/${idioma}.json`))
const tradutor = _translate.handler.participantsUpdate

Expand Down Expand Up @@ -1532,7 +1532,7 @@ export async function callUpdate(callUpdate) {
export async function deleteUpdate(message) {
const datas = global
const id = message.participant // Obtenga la identificaciΓ³n del usuario, solo dentro de esta funciΓ³n "deleteUpdate"
const idioma = datas.db.data.users[id].language || 'es';
const idioma = datas.db.data.users[id]?.language || 'es';
const _translate = JSON.parse(fs.readFileSync(`./language/${idioma}.json`))
const tradutor = _translate.handler.deleteUpdate

Expand Down

0 comments on commit 581b503

Please sign in to comment.