androz2091 / pronote-bot-discord Goto Github PK
View Code? Open in Web Editor NEWUn bot Discord pour envoyer les nouveaux devoirs dans un serveur Discord 📚
Un bot Discord pour envoyer les nouveaux devoirs dans un serveur Discord 📚
Bonjour !
J'ai un petit problème avec le code du bot Pronote .
Lorsque le bot récupère les notes, j'ai bien noté la période en tant que trimestre :
const marks = await session.marks("trimester");
Mais au final, il me récupère tout de même l'entièreté de mes notes et calcule donc une moyenne erronée du trimestre :
{
"averages": {
"student": 17.07,
"studentClass": 13.49
}
}
J'avais modifié le code pour pouvoir ajouter un message contenant ma moyenne mais ça ne fonctionne pas du coup
Est-ce que quelqu'un sais comment résoudre ce problème ?
Je vous remercie
PS : J'avais précédemment demandé de l'aide sur le Discord
Bonjour, j'aimerais savoir comment vous avez fait pour récupérer la dernière note.
Ps : j'aimerais m'envoyer un sms dés que j'ai une nouvelle note !
Cordialement
Ready. Logged as Pronote Bot#6259!
B:****\Desktop\pronote-bot-discord-1.2.2\pronote-bot-discord\index.js:93
timetable.filter((lesson) => lesson.isAway).forEach((lesson) => {
^
TypeError: Cannot read properties of null (reading 'filter')
at pronoteSynchronization (B:****\Desktop\pronote-bot-discord-1.2.2\pronote-bot-discord\index.js:93:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
J'essaye de faire un système quand les profs son absent:
const timetable = await session.timetable()
const proAway = timetable.filter((away) => (away.isAway));
proAway.forEach((edt) => sendDiscordNotificationAbs(edt));
// Mise à jour du cache pour l'emploie du temps
writeCache({
...cache,
timetable
})
const sendDiscordNotificationAbs = (edt) => {
(async () => {
const taps = await client.users.fetch("321213174454026240").catch(e => { console.log(e)});
const d = new Date(edt.from);
const abs = `Il y a un professeur absent: ${edt.teacher} à ${d.getUTCHours() + ':' + d.getUTCMinutes() +'\n'}`
taps.send(abs)
fetch(`https://smsapi.free-mobile.fr/sendmsg?user=&pass=&msg=${encodeURIComponent(abs)}`)
})
};
Sa écrit dans le cache, mais sa envoie pas de message ?
Yop ! Est-ce que l'académie de Aix Marseille fonctionne ?
car j'ai sa ?
(node:31436) UnhandledPromiseRejectionWarning: TypeError: cas[casName] is not a function
at getStart (D:\Users\legot\Visual\pronote-bot-discord-master\node_modules\pronote-api\src\auth.js:60:30)
at Object.login (D:\Users\legot\Visual\pronote-bot-discord-master\node_modules\pronote-api\src\auth.js:15:25)
at pronoteSynchronization (D:\Users\legot\Visual\pronote-bot-discord-master\index.js:50:35)
at Client.<anonymous> (D:\Users\legot\Visual\pronote-bot-discord-master\index.js:96:5)
at Client.emit (events.js:210:5)
at WebSocketManager.triggerClientReady (D:\Users\legot\Visual\pronote-bot-discord-master\node_modules\discord.js\src\client\websocket\WebSocketManager.js:431:17)
at WebSocketManager.checkShardsReady (D:\Users\legot\Visual\pronote-bot-discord-master\node_modules\discord.js\src\client\websocket\WebSocketManager.js:415:10)
at WebSocketShard.<anonymous> (D:\Users\legot\Visual\pronote-bot-discord-master\node_modules\discord.js\src\client\websocket\WebSocketManager.js:197:14)
at WebSocketShard.emit (events.js:210:5)
at WebSocketShard.checkReady (D:\Users\legot\Visual\pronote-bot-discord-master\node_modules\discord.js\src\client\websocket\WebSocketShard.js:475:12)
(node:31436) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:31436) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Je suis nouveau sur github et je ne sais pas comment installer des choses, et je voudra bien une expliquation plus détaillé. Merci pour votre compréhension.
Je suis debutant sur github et je ne sais pas comment faire toute les etapes donc peut on m'expliquer svp
Due to the End Of Life of pronote-api the repository Litarvan/pronote-api was emptied his history, and the NPM package was deleted
const nextWeekDay = new Date();
nextWeekDay.setDate(nextWeekDay.getDate() + 30);
const timetable = await session.timetable(new Date(), nextWeekDay);
const awayNotifications = [];
timetable.filter((lesson) => lesson.isAway).forEach((lesson) => {
if (!cache.lessonsAway.some((lessonID) => lessonID === lesson.id)){
awayNotifications.push({
teacher: lesson.teacher,
from: lesson.from,
subject: lesson.subject,
id: lesson.id
});
}
});
if (awayNotifications.length) {
awayNotifications.forEach((awayNotif) => sendDiscordNotificationAway(awayNotif));
}
writeCache({
...cache,
lessonsAway: [
...cache.lessonsAway,
...awayNotifications.map((n) => n.id)
]
});
Don't work :/
Comment on fait pour récupérer une note en utilisant une commande ?
Bonsoir, j'ai un soucis
Quand je lance le bot celui si me dis
npm ERR! code ENOVERSIONS
npm ERR! No versions available for pronote-api
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yeikzy\AppData\Local\npm-cache_logs\2022-02-08T12_20_29_523Z-debug-0.log
Bonjour,
Je voudrais avoir le code complet pour copier coller pour que le bot envoi l'emploi du temps tout les lundis !
Salut,
je dois surement poser une question assez basique, mais ou dois-je cloner le repository ? j'ai essayer dans le terminal d'après une vidéo et ça semble marcher, cependant lorsque je met installer les dépendances (num install) ca ne marche pas
Merci,
Algorythm
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.