Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alive.js #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

alive.js #10

wants to merge 1 commit into from

Conversation

saajidff2007
Copy link

const { zokou } = require('../framework/zokou');
const {addOrUpdateDataInAlive , getDataFromAlive} = require('../bdd/alive')
const moment = require("moment-timezone");
const s = require(__dirname + "/../set");

zokou(
{
nomCom : 'alive',
categorie : 'General'

},async (dest,zk,commandeOptions) => {

const {ms , arg, repondre,superUser} = commandeOptions;

const data = await getDataFromAlive();

if (!arg || !arg[0] || arg.join('') === '') {

if(data) {
   
    const {message , lien} = data;


    var mode = "public";
    if ((s.MODE).toLocaleLowerCase() != "yes") {
        mode = "private";
    }
  

 
moment.tz.setDefault('EAT');

// Créer une date et une heure en EAT
const temps = moment().format('HH:mm:ss');
const date = moment().format('DD/MM/YYYY');

const alivemsg = `

Owner : ${s.OWNER_NAME}
Mode : ${mode}
Date : ${date}
Time : ${temps}

${message}

FLASH-MD by France King is alive`

if (lien.match(/.(mp4|gif)$/i)) {
try {
zk.sendMessage(dest, { video: { url: lien }, caption: alivemsg }, { quoted: ms });
}
catch (e) {
console.log("🥵🥵 Menu erreur " + e);
repondre("🥵🥵 Menu erreur " + e);
}
}
// Checking for .jpeg or .png
else if (lien.match(/.(jpeg|png|jpg)$/i)) {
try {
zk.sendMessage(dest, { image: { url: lien }, caption: alivemsg }, { quoted: ms });
}
catch (e) {
console.log("🥵🥵 Menu erreur " + e);
repondre("🥵🥵 Menu erreur " + e);
}
}
else {

repondre(alivemsg);

}

} else {
    if(!superUser) { repondre("there is no alive for this bot") ; return};

  await   repondre("💫👽𝗜 𝗔𝗠 𝗔𝗟𝗜𝗩𝗘 𝗦𝗔𝗔𝗝𝗜 𝗠𝗗 𝗕𝗢𝗧👽💫");
     repondre(" *Support msi and msi ! cyber saaji")
 }

} else {

if(!superUser) { repondre ("Only the owner can  modify the alive") ; return};


const texte = arg.join(' ').split(';')[0];
const tlien = arg.join(' ').split(';')[1]; 

await addOrUpdateDataInAlive(texte , tlien)

repondre('message alive refresh successfully')

}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant