Skip to content

Commit

Permalink
Merge branch 'master' into asakura-mao
Browse files Browse the repository at this point in the history
  • Loading branch information
ColapsusHD committed Sep 19, 2024
2 parents 2b772ba + ad334b6 commit af071ec
Show file tree
Hide file tree
Showing 283 changed files with 1,226 additions and 452 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@
> [!IMPORTANT]\
> **No** se asegura que este **proyecto siga funcionando al 100% debido** a cuestiones de tiempo personales de @BrunoSobrino, por lo cual **el proyecto esta en manos de colaboradores** y usuarios que deseen aportar actualizaciones.
> [!WARNING]\
> **Este proyecto no ofrece soporte oficial para su uso en Termux.** Termux es una aplicación de terminal para Android y, aunque puede ser utilizada para ejecutar diversos programas, **este proyecto no está diseñado ni probado específicamente para funcionar en Termux**. Por lo tanto, **no garantizamos compatibilidad ni soporte técnico en este entorno**.

# Opciones de despliegue

Expand Down Expand Up @@ -114,6 +111,13 @@ En esta sección encontrarás **botones de despliegue** que te permitirán imple
[![Run on Repl.it](https://binbashbanana.github.io/deploy-buttons/buttons/remade/replit.svg)](https://repl.it/github/BrunoSobrino/TheMystic-Bot-MD)
[![Deploy to Render](https://binbashbanana.github.io/deploy-buttons/buttons/remade/render.svg)](https://dashboard.render.com/blueprint/new?repo=https://github.com/BrunoSobrino/TheMystic-Bot-MD)
<!-- [![Deploy to Vercel](https://binbashbanana.github.io/deploy-buttons/buttons/remade/vercel.svg)](https://vercel.com/new/clone?repository-url=https://github.com/BrunoSobrino/TheMystic-Bot-MD) -->
<a href="https://brunosobrino.github.io/TheMystic-Bot-MD/">
<img src="https://img.shields.io/badge/Android-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Termux">
</a>
<a href="https://brunosobrino.github.io/TheMystic-Bot-MD/">
<img src="https://img.shields.io/badge/Linux-black?style=for-the-badge&logo=linux&logoColor=white" alt="Linux">
<a href="https://brunosobrino.github.io/TheMystic-Bot-MD/">
<img src="https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white" alt="Windows">

# Soporte y Comunidad

Expand Down
43 changes: 19 additions & 24 deletions handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ export async function handler(chatUpdate) {
console.error(e);
}

const idioma = global.db.data.users[m.sender]?.language ?? 'es'; // is null? np the operator ?? fix that (i hope)
const idioma = global.db.data.users[m.sender]?.language || global.defaultLenguaje; // is null? np the operator ?? fix that (i hope)
const _translate = JSON.parse(fs.readFileSync(`./src/languages/${idioma}.json`))
const tradutor = _translate.handler.handler

Expand Down Expand Up @@ -831,7 +831,7 @@ export async function handler(chatUpdate) {
if (!['owner-unbanchat.js', 'info-creator.js'].includes(name) && chat && chat?.isBanned && !isROwner) return; // Except this
if (name != 'owner-unbanchat.js' && name != 'owner-exec.js' && name != 'owner-exec2.js' && chat?.isBanned && !isROwner) return; // Except this
//if ((name != 'owner-unbanchat.js' || name != 'owner-exec.js' || name != 'owner-exec2.js') && chat?.isBanned && !isROwner) return; // Except this

if (m.text && user.banned && !isROwner) {
if (typeof user.bannedMessageCount === 'undefined') {
user.bannedMessageCount = 0;
Expand Down Expand Up @@ -1068,17 +1068,12 @@ ${tradutor.texto1[1]} ${messageNumber}/3
* @param {import("baileys").BaileysEventMap<unknown>['group-participants.update']} groupsUpdate
*/
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 || global.defaultLenguaje;
const _translate = JSON.parse(fs.readFileSync(`./src/languages/${idioma}.json`))
const tradutor = _translate.handler.participantsUpdate

const m = mconn
if (opts['self']) return;
//if (m.conn.isInit) return;
if (global.db.data == null) await loadDatabase();
const chat = global.db.data.chats[id] || {};
const botTt = global.db.data.settings[mconn?.conn?.user?.jid] || {};
Expand All @@ -1091,15 +1086,15 @@ export async function participantsUpdate({ id, participants, action }) {
for (const user of participants) {
let pp = 'https://raw.githubusercontent.com/BrunoSobrino/TheMystic-Bot-MD/master/src/avatar_contact.png';
try {
pp = await m.conn.profilePictureUrl(user, 'image');
pp = await m?.conn?.profilePictureUrl(user, 'image');
} catch (e) {
} finally {
const apii = await mconn?.conn?.getFile(pp);
const antiArab = JSON.parse(fs.readFileSync('./src/antiArab.json'));
const userPrefix = antiArab.some((prefix) => user.startsWith(prefix));
const botTt2 = groupMetadata?.participants?.find((u) => m?.conn?.decodeJid(u.id) == m?.conn?.user?.jid) || {};
const isBotAdminNn = botTt2?.admin === 'admin' || false;
text = (action === 'add' ? (chat.sWelcome || tradutor.texto1 || conn.welcome || 'Welcome, @user!').replace('@subject', await m?.conn?.getName(id)).replace('@desc', groupMetadata.desc?.toString() || '*𝚂𝙸𝙽 𝙳𝙴𝚂𝙲𝚁𝙸𝙿𝙲𝙸𝙾𝙽*') :
text = (action === 'add' ? (chat.sWelcome || tradutor.texto1 || conn.welcome || 'Welcome, @user!').replace('@subject', await m?.conn?.getName(id)).replace('@desc', groupMetadata?.desc?.toString() || '*𝚂𝙸𝙽 𝙳𝙴𝚂𝙲𝚁𝙸𝙿𝙲𝙸𝙾𝙽*').replace('@user', '@' + user.split('@')[0]) :
(chat.sBye || tradutor.texto2 || conn.bye || 'Bye, @user!')).replace('@user', '@' + user.split('@')[0]);
if (userPrefix && chat.antiArab && botTt.restrict && isBotAdminNn && action === 'add') {
const responseb = await m.conn.groupParticipantsUpdate(id, [user], 'remove');
Expand All @@ -1116,16 +1111,16 @@ export async function participantsUpdate({ id, participants, action }) {
case 'promote':
case 'daradmin':
case 'darpoder':
text = (chat.sPromote || tradutor.texto3 || conn.spromote || '@user ```is now Admin```');
text = (chat.sPromote || tradutor.texto3 || conn?.spromote || '@user ```is now Admin```');
case 'demote':
case 'quitarpoder':
case 'quitaradmin':
if (!text) {
text = (chat.sDemote || tradutor.texto4 || conn.sdemote || '@user ```is no longer Admin```');
text = (chat?.sDemote || tradutor.texto4 || conn?.sdemote || '@user ```is no longer Admin```');
}
text = text.replace('@user', '@' + participants[0].split('@')[0]);
if (chat.detect && !chat?.isBanned) {
mconn.conn.sendMessage(id, { text, mentions: mconn.conn.parseMention(text) });
mconn?.conn?.sendMessage(id, { text, mentions: mconn?.conn?.parseMention(text) });
}
break;
}
Expand All @@ -1136,8 +1131,7 @@ export async function participantsUpdate({ id, participants, action }) {
* @param {import("baileys").BaileysEventMap<unknown>['groups.update']} groupsUpdate
*/
export async function groupsUpdate(groupsUpdate) {
//console.log(groupsUpdate)
const idioma = global.db.data.chats[groupsUpdate[0].id]?.language ?? 'es';
const idioma = global.db.data.chats[groupsUpdate[0].id]?.language || global.defaultLenguaje;
const _translate = JSON.parse(fs.readFileSync(`./src/languages/${idioma}.json`))
const tradutor = _translate.handler.participantsUpdate

Expand All @@ -1149,14 +1143,15 @@ export async function groupsUpdate(groupsUpdate) {
if (!id) continue;
if (groupUpdate.size == NaN) continue;
if (groupUpdate.subjectTime) continue;
const chats = global.db.data.chats[id]; let text = '';
const chats = global.db.data.chats[id];
let text = '';
if (!chats?.detect) continue;
if (groupUpdate.desc) text = (chats.sDesc || tradutor.texto5 || conn.sDesc || '```Description has been changed to```\n@desc').replace('@desc', groupUpdate.desc);
if (groupUpdate.subject) text = (chats.sSubject || tradutor.texto6 || conn.sSubject || '```Subject has been changed to```\n@subject').replace('@subject', groupUpdate.subject);
if (groupUpdate.icon) text = (chats.sIcon || tradutor.texto7 || conn.sIcon || '```Icon has been changed to```').replace('@icon', groupUpdate.icon);
if (groupUpdate.revoke) text = (chats.sRevoke || tradutor.texto8 || conn.sRevoke || '```Group link has been changed to```\n@revoke').replace('@revoke', groupUpdate.revoke);
if (groupUpdate?.desc) text = (chats?.sDesc || tradutor.texto5 || conn?.sDesc || '```Description has been changed to```\n@desc').replace('@desc', groupUpdate.desc);
if (groupUpdate?.subject) text = (chats?.sSubject || tradutor.texto6 || conn?.sSubject || '```Subject has been changed to```\n@subject').replace('@subject', groupUpdate.subject);
if (groupUpdate?.icon) text = (chats?.sIcon || tradutor.texto7 || conn?.sIcon || '```Icon has been changed to```').replace('@icon', groupUpdate.icon);
if (groupUpdate?.revoke) text = (chats?.sRevoke || tradutor.texto8 || conn?.sRevoke || '```Group link has been changed to```\n@revoke').replace('@revoke', groupUpdate.revoke);
if (!text) continue;
await mconn.conn.sendMessage(id, { text, mentions: mconn.conn.parseMention(text) });
await mconn?.conn?.sendMessage(id, { text, mentions: mconn?.conn?.parseMention(text) });
}
}

Expand All @@ -1179,8 +1174,8 @@ 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 id = message?.participant
const idioma = datas.db.data.users[id]?.language || global.defaultLenguaje;
const _translate = JSON.parse(fs.readFileSync(`./src/languages/${idioma}.json`))
const tradutor = _translate.handler.deleteUpdate

Expand Down Expand Up @@ -1211,7 +1206,7 @@ ${tradutor.texto1[5]}`.trim();

global.dfail = (type, m, conn) => {
const datas = global
const idioma = datas.db.data.users[m.sender].language ?? 'es';
const idioma = datas.db.data.users[m.sender].language || global.defaultLenguaje;
const _translate = JSON.parse(fs.readFileSync(`./src/languages/${idioma}.json`))
const tradutor = _translate.handler.dfail

Expand Down
151 changes: 151 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Mystic Bot🔮</title>
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&display=swap" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="web/favicon.ico">
<link rel="stylesheet" href="web/estilo.css">
<style>
/* Estilo de Carga*/
.loading-screen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #232323;
z-index: 1000;
}

.loading-screen p {
font-size: 2em;
font-family: 'Comfortaa', sans-serif;
}

/* Ocultar el Cargando cuando Cargo gg */
.hide {
display: none;
}
</style>
</head>
<body>
<div class="loading-screen" id="loading-screen">
<p>⌛Cargando⏳</p>
</div>

<video autoplay muted loop id="bg-video" preload="auto">
<source src="https://github.com/user-attachments/assets/39cbf647-28cd-4604-a717-ada1439d274b" type="video/mp4">
Er Video
</video>

<div class="content" id="content">
<p>⌛Cargando⏳</p>
</div>

<script>

function hideLoadingScreen() {
document.getElementById('loading-screen').classList.add('hide');
}


async function loadContent(url, fallbackUrl = null) {
try {
const response = await fetch(url);
if (!response.ok) throw new Error(`Error fetching ${url}: ${response.statusText}`);
document.getElementById('content').innerHTML = await response.text();

// Comentarios Disqus, PErsonalizable y Claramente Opcional.
loadDisqus();
} catch (error) {
console.error(`Error cargando D: ${error.message}`);
if (fallbackUrl) {
console.log(`Usando fallback URL: ${fallbackUrl}`);
loadContent(fallbackUrl);
} else {
document.getElementById('content').innerHTML = `<p>Error Cargando: ${error.message}</p>`;
}
}
}


function loadDisqus() {
const disqusDiv = document.createElement('div');
disqusDiv.id = 'disqus_thread';
document.getElementById('content').appendChild(disqusDiv);

const disqus_config = function () {
this.page.url = window.location.href;
this.page.identifier = document.title;
};

(function() {
const d = document, s = d.createElement('script');
s.src = 'https://amigos-steam.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
}


function getLocalizedUrl(urlBase) {
const lang = navigator.language || navigator.userLanguage;
const langMap = {
es: 'es.html',
pt: 'pt.html',
fr: 'fr.html',
ru: 'ru.html',
ar: 'ar.html',
hi: 'hi.html'
};
return urlBase + (langMap[lang.slice(0, 2)] || 'ingles.html');
}


function loadLocalizedContent(urlBase) {
const localizedUrl = getLocalizedUrl(urlBase);
const fallbackUrl = `${urlBase}ingles.html`;
loadContent(localizedUrl, fallbackUrl);
}


document.addEventListener("DOMContentLoaded", () => {
const bgVideo = document.getElementById('bg-video');


bgVideo.addEventListener('loadeddata', () => {
loadLocalizedContent('web/');
hideLoadingScreen();
});
});


document.addEventListener('click', (event) => {
const anchor = event.target.closest('a');
if (anchor && anchor.getAttribute('href')?.includes('web/')) {
event.preventDefault();
window.scrollTo({ top: 0, behavior: 'smooth' });
loadLocalizedContent(anchor.getAttribute('href').replace('.html', ''));
}
});


window.onpopstate = () => location.reload();
</script>

<!-- Widget de Discord -->
<script src="https://cdn.jsdelivr.net/npm/@widgetbot/crate@3" async defer>
new Crate({
server: '1278571215635877908',
channel: '1286022420330840215'
});
</script>

<noscript>JavaScript OFF. Se requiere JS activado para visualizar esta página. Consulta el repositorio si tienes problemas.</noscript>
</body>
</html>
Loading

0 comments on commit af071ec

Please sign in to comment.