mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 23:22:56 +00:00
enhancement(lint): Fix lint errors for src/modules/school.ts
Co-authored-by: NeonGamerBot-QK <neon@saahild.com> Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com>
This commit is contained in:
parent
15822ba8ce
commit
9f09fb507b
1 changed files with 34 additions and 28 deletions
|
|
@ -181,35 +181,41 @@ export function tempcronjob(app: ModifiedApp) {
|
|||
try {
|
||||
fetchHomePage().then((data) => {
|
||||
// app.db.set(`temp_mykcd_grades`, data);
|
||||
data.map(d => ({ grade: d.cumgrade, name: d.sectionidentifier, id: d.sectionid })).forEach(async d => {
|
||||
const instance = app.dbs.mykcd.get(`class_`+d.id)
|
||||
if(!instance) {
|
||||
// shout its been discovered
|
||||
await app.client.chat.postMessage({
|
||||
channel: `C07R8DYAZMM`,
|
||||
text: `Enrolled in *${d.name}* and starting with grade of *${d.grade || 0}%*`,
|
||||
data
|
||||
.map((d) => ({
|
||||
grade: d.cumgrade,
|
||||
name: d.sectionidentifier,
|
||||
id: d.sectionid,
|
||||
}))
|
||||
.forEach(async (d) => {
|
||||
const instance = app.dbs.mykcd.get(`class_` + d.id);
|
||||
if (!instance) {
|
||||
// shout its been discovered
|
||||
await app.client.chat.postMessage({
|
||||
channel: `C07R8DYAZMM`,
|
||||
text: `Enrolled in *${d.name}* and starting with grade of *${d.grade || 0}%*`,
|
||||
});
|
||||
} else {
|
||||
if (instance.grade !== d.grade) {
|
||||
// post emph
|
||||
await app.client.chat.postEphemeral({
|
||||
channel: `C07R8DYAZMM`,
|
||||
user: `U07L45W79E1`,
|
||||
text: `Hey for *${d.name}* your grade updated to *${d.grade}%* from *${instance.grade}%*, would you like to share it?`,
|
||||
// todo add button to share lol
|
||||
// blocks: [{
|
||||
// }]
|
||||
});
|
||||
}
|
||||
if (instance.name !== d.name) {
|
||||
await app.client.chat.postMessage({
|
||||
channel: `C07R8DYAZMM`,
|
||||
text: `Class *${instance.name}* -> *${d.name}*`,
|
||||
});
|
||||
}
|
||||
}
|
||||
app.dbs.mykcd.set(`class_` + d.id, d);
|
||||
});
|
||||
} else {
|
||||
if(instance.grade !== d.grade) {
|
||||
// post emph
|
||||
await app.client.chat.postEphemeral({
|
||||
channel: `C07R8DYAZMM`,
|
||||
user: `U07L45W79E1`,
|
||||
text: `Hey for *${d.name}* your grade updated to *${d.grade}%* from *${instance.grade}%*, would you like to share it?`,
|
||||
// todo add button to share lol
|
||||
// blocks: [{
|
||||
// }]
|
||||
});
|
||||
}
|
||||
if(instance.name !== d.name) {
|
||||
await app.client.chat.postMessage({
|
||||
channel: `C07R8DYAZMM`,
|
||||
text: `Class *${instance.name}* -> *${d.name}*`,
|
||||
});
|
||||
}
|
||||
}
|
||||
app.dbs.mykcd.set(`class_`+d.id, d)
|
||||
})
|
||||
});
|
||||
|
||||
console.log(`omg it worked`);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue