Skip to content

Commit

Permalink
♻️ Add message for top score
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Feb 25, 2021
1 parent cfdee2d commit 81c08bf
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from "path";
import { readFile } from "fs-extra";
import { readFile, readJson } from "fs-extra";
import axios from "axios";
import { load } from "js-yaml";
import { config } from "dotenv";
Expand Down Expand Up @@ -240,6 +240,22 @@ export const rescuetimeSlack = async () => {
},
],
});
const topScore = await readJson(join(".", "top-score.json"));
if (totalScore > Number(topScore)) {
await axios.post(config.webhook, {
username: config.botName,
icon_url: config.botIcon,
blocks: [
{
type: "section",
text: {
type: "mrkdwn",
text: "🎉 *THIS IS OUR TOP SCORE EVER!!!*",
},
},
],
});
}
}
console.log("Success");
};
Expand Down

0 comments on commit 81c08bf

Please sign in to comment.