Git Product home page Git Product logo

Comments (6)

TapsHTS avatar TapsHTS commented on August 13, 2024

J'ai essayé sa:

    const timetable = await session.timetable()
    const proAway = timetable.filter((edt) => (cache.homeworks.some((cacheTable) => cacheTable.isAway === edt.isAway)));
    if (proAway.length > 0 && proAway.length <= 3) {
        proAway.forEach((edt) => sendDiscordNotificationAbs(edt));
    }
    

    // Mise à jour du cache pour l'emploie du temps
        writeCache({
            ...cache,
            timetable
        })


    // Déconnexion de Pronote
    session.logout();

};

/**
 * Envoi un notification en cas d'absence sur Discord et SMS
 * @param {pronote.PronoteTimetable} edt La matière de la note
 */

const sendDiscordNotificationAbs = (edt) => {
    (async () => {
    const taps = await client.users.fetch("321213174454026240").catch(e => { console.log(e)});
    const ewan = await client.users.fetch("716379190332752014").catch(e => { console.log(e)});
    const d = new Date(edt.from);

    const abs = `Il y a un professeur absent: ${edt.teacher} le ${d.getUTCDate}/${d.getUTCMonth}/${d.getUTCFullYear} à ${d.getUTCHours()} : ${d.getUTCMinutes()}\n`

    taps.send(abs)
    // ewan.send(abs)
    fetch(`https://smsapi.free-mobile.fr/sendmsg?user=pass=&msg=${encodeURIComponent(abs)}`)

    })
};

from pronote-bot-discord.

TapsHTS avatar TapsHTS commented on August 13, 2024

Bon en tous cas sa écrit dans le cache donc bon

from pronote-bot-discord.

Androz2091 avatar Androz2091 commented on August 13, 2024

Salut, je regarde ça dès que possible, je pense que je l'ajouterai définitivement au bot dans les prochains jours

from pronote-bot-discord.

Androz2091 avatar Androz2091 commented on August 13, 2024

ça vient peut-être des arguments passés à session.timetable()

from pronote-bot-discord.

TapsHTS avatar TapsHTS commented on August 13, 2024

C'est bien comme sa qu'il faut récupérer l'edt ?

from pronote-bot-discord.

Androz2091 avatar Androz2091 commented on August 13, 2024

Oui. Les cours annulés sont dispo en v1.2.0, n'hésite pas à me mp sur discord si tu as des questions

from pronote-bot-discord.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.